aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-opts.c
diff options
context:
space:
mode:
authorSteven Bosscher <steven@gcc.gnu.org>2006-09-17 13:14:53 +0000
committerSteven Bosscher <steven@gcc.gnu.org>2006-09-17 13:14:53 +0000
commit69723be2b39c9517ebe919b6f81b9b3b78d44b0a (patch)
treedb0c9c78d97e02a45d563a0b352ac781b1e79a92 /gcc/c-opts.c
parent7a7d38044dabb00eee2089a951a2da5afe9d548e (diff)
downloadgcc-69723be2b39c9517ebe919b6f81b9b3b78d44b0a.zip
gcc-69723be2b39c9517ebe919b6f81b9b3b78d44b0a.tar.gz
gcc-69723be2b39c9517ebe919b6f81b9b3b78d44b0a.tar.bz2
re PR c/25993 (-std= produces incorrect preprocessor output for .S)
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. From-SVN: r117005
Diffstat (limited to 'gcc/c-opts.c')
-rw-r--r--gcc/c-opts.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/gcc/c-opts.c b/gcc/c-opts.c
index 2937b79..5821dea 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: