This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] PR25993
- From: Steven Bosscher <stevenb dot gcc at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: jsm28 at gcc dot gnu dot org
- Date: Sat, 16 Sep 2006 21:46:00 +0200
- Subject: [PATCH] PR25993
:ADDPATCH C:
In this bug, the -std=* options would cause the C front end to override
the driver and claim that the input file is C source instead of assembly.
Fixed by ignoring the -std=* options if the cpp_reader input format is
CLK_ASM.
If I don't hear from anyone I'll commit this as obvious.
Gr.
Steven
Index: c-opts.c
===================================================================
--- c-opts.c (revision 116991)
+++ c-opts.c (working copy)
@@ -268,6 +268,10 @@ c_common_handle_option (size_t scode, co
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, co
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: