diff options
author | steven <steven@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-09-17 13:14:53 +0000 |
---|---|---|
committer | steven <steven@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-09-17 13:14:53 +0000 |
commit | bc7ab021bd686514c98cae58a39ebc09976d5a15 (patch) | |
tree | db0c9c78d97e02a45d563a0b352ac781b1e79a92 | |
parent | e6c961dde1572f17ecb50594c5858ab22c92d4a0 (diff) | |
download | ppe42-gcc-bc7ab021bd686514c98cae58a39ebc09976d5a15.tar.gz ppe42-gcc-bc7ab021bd686514c98cae58a39ebc09976d5a15.zip |
gcc/
PR c/25993
* c-opts.c (c_common_handle_option): Ignore the -std options
if the input language is assembly.
testsuite/
PR c/25993
* gcc.dg/pr25993.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@117005 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c-opts.c | 19 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr25993.c | 14 |
4 files changed, 39 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 261926af016..9cb013809ea 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2006-09-17 Steven Bosscher <steven@gcc.gnu.org> + + PR c/25993 + * c-opts.c (c_common_handle_option): Ignore the -std options + if the input language is assembly. + 2006-09-17 Ira Rosen <irar@il.ibm.com> PR tree-opt/21591 diff --git a/gcc/c-opts.c b/gcc/c-opts.c index 2937b7995cd..5821deabb96 100644 --- a/gcc/c-opts.c +++ b/gcc/c-opts.c @@ -268,6 +268,10 @@ c_common_handle_option (size_t scode, const char *arg, int value) enum opt_code code = (enum opt_code) scode; int result = 1; + /* Prevent resetting the language standard to a C dialect when the driver + has already determined that we're looking at assembler input. */ + bool preprocessing_asm_p = (cpp_get_options (parse_in)->lang == CLK_ASM); + switch (code) { default: @@ -905,29 +909,34 @@ c_common_handle_option (size_t scode, const char *arg, int value) case OPT_std_c__98: case OPT_std_gnu__98: - set_std_cxx98 (code == OPT_std_c__98 /* ISO */); + if (!preprocessing_asm_p) + set_std_cxx98 (code == OPT_std_c__98 /* ISO */); break; case OPT_std_c89: case OPT_std_iso9899_1990: case OPT_std_iso9899_199409: - set_std_c89 (code == OPT_std_iso9899_199409 /* c94 */, true /* ISO */); + if (!preprocessing_asm_p) + set_std_c89 (code == OPT_std_iso9899_199409 /* c94 */, true /* ISO */); break; case OPT_std_gnu89: - set_std_c89 (false /* c94 */, false /* ISO */); + if (!preprocessing_asm_p) + set_std_c89 (false /* c94 */, false /* ISO */); break; case OPT_std_c99: case OPT_std_c9x: case OPT_std_iso9899_1999: case OPT_std_iso9899_199x: - set_std_c99 (true /* ISO */); + if (!preprocessing_asm_p) + set_std_c99 (true /* ISO */); break; case OPT_std_gnu99: case OPT_std_gnu9x: - set_std_c99 (false /* ISO */); + if (!preprocessing_asm_p) + set_std_c99 (false /* ISO */); break; case OPT_trigraphs: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 89cc01b37f1..0864aeb373e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-09-16 Steven Bosscher <steven@gcc.gnu.org> + + PR c/25993 + * gcc.dg/pr25993.c: New test. + 2006-09-17 Ira Rosen <irar@il.ibm.com> PR tree-opt/21591 diff --git a/gcc/testsuite/gcc.dg/pr25993.c b/gcc/testsuite/gcc.dg/pr25993.c new file mode 100644 index 00000000000..392bbedfeb1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr25993.c @@ -0,0 +1,14 @@ +/* { dg-do assemble { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-std=c99 -x assembler-with-cpp" } */ + +#ifndef __ASSEMBLER__ +extern int func(void); +#else +.global func +.type func,%function +.align 4 +func: + ret +.size func,.-func +#endif + |