This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix preprocessor/7138
- From: Neil Booth <neil at daikokuya dot co dot uk>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 28 Jun 2002 07:25:03 +0100
- Subject: Fix preprocessor/7138
Introduced by the recent switch to integrated traditional
preprocessing.
Neil.
PR preprocessor/7138
* cpplib.c (_cpp_handle_directive): Do traditional
preparation after setting state.angled_headers.
* cpptrad.c (scan_out_logical_line): Fix potential
quote bug.
Index: cpplib.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cpplib.c,v
retrieving revision 1.315
diff -u -p -r1.315 cpplib.c
--- cpplib.c 27 Jun 2002 06:01:57 -0000 1.315
+++ cpplib.c 28 Jun 2002 06:24:13 -0000
@@ -388,10 +388,6 @@ _cpp_handle_directive (pfile, indented)
"style of line directive is a GCC extension");
}
- pfile->directive = dir;
- if (CPP_OPTION (pfile, traditional))
- prepare_directive_trad (pfile);
-
if (dir)
{
/* If we have a directive that is not an opening conditional,
@@ -441,6 +437,10 @@ _cpp_handle_directive (pfile, indented)
cpp_error (pfile, DL_ERROR, "invalid preprocessing directive #%s",
cpp_token_as_text (pfile, dname));
}
+
+ pfile->directive = dir;
+ if (CPP_OPTION (pfile, traditional))
+ prepare_directive_trad (pfile);
if (dir)
{
Index: cpptrad.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cpptrad.c,v
retrieving revision 1.21
diff -u -p -r1.21 cpptrad.c
--- cpptrad.c 27 Jun 2002 06:01:57 -0000 1.21
+++ cpptrad.c 28 Jun 2002 06:24:13 -0000
@@ -435,12 +435,13 @@ scan_out_logical_line (pfile, macro)
const uchar *cur;
uchar *out;
struct fun_macro fmacro;
- unsigned int c, paren_depth = 0, quote = 0;
+ unsigned int c, paren_depth = 0, quote;
enum ls lex_state = ls_none;
fmacro.buff = NULL;
start_logical_line:
+ quote = 0;
CUR (pfile->context) = pfile->buffer->cur;
RLIMIT (pfile->context) = pfile->buffer->rlimit;
pfile->out.cur = pfile->out.base;
@@ -502,7 +503,7 @@ scan_out_logical_line (pfile, macro)
quote = '>';
break;
case '>':
- if (pfile->state.angled_headers && c == quote)
+ if (c == quote)
{
pfile->state.angled_headers = false;
quote = 0;