aboutsummaryrefslogtreecommitdiff
path: root/gcc/cpptrad.c
diff options
context:
space:
mode:
authorNathanael Nerode <neroden@gcc.gnu.org>2003-11-19 18:48:53 +0000
committerNathanael Nerode <neroden@gcc.gnu.org>2003-11-19 18:48:53 +0000
commitdd2cc6dc8f4d3cad4affbbe5a52f8fc27ba09a61 (patch)
tree9d929780fb0ff894cb0d344e4982b7cfd958f43c /gcc/cpptrad.c
parent09c557200827e64caca503b1b31c3e74fb225dc8 (diff)
downloadgcc-dd2cc6dc8f4d3cad4affbbe5a52f8fc27ba09a61.zip
gcc-dd2cc6dc8f4d3cad4affbbe5a52f8fc27ba09a61.tar.gz
gcc-dd2cc6dc8f4d3cad4affbbe5a52f8fc27ba09a61.tar.bz2
cpptrad.c (_cpp_scan_out_logical_line): Improve test for whether directive begins at the beginning of a line.
* cpptrad.c (_cpp_scan_out_logical_line): Improve test for whether directive begins at the beginning of a line. (testsuite) * gcc.dg/cpp/trad/xwin1.c: New test case. From-SVN: r73740
Diffstat (limited to 'gcc/cpptrad.c')
-rw-r--r--gcc/cpptrad.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/cpptrad.c b/gcc/cpptrad.c
index 0f98a8a..6da19cc 100644
--- a/gcc/cpptrad.c
+++ b/gcc/cpptrad.c
@@ -350,6 +350,7 @@ _cpp_scan_out_logical_line (cpp_reader *pfile, cpp_macro *macro)
unsigned int c, paren_depth = 0, quote;
enum ls lex_state = ls_none;
bool header_ok;
+ const uchar *start_of_input_line;
fmacro.buff = NULL;
@@ -359,6 +360,9 @@ _cpp_scan_out_logical_line (cpp_reader *pfile, cpp_macro *macro)
RLIMIT (pfile->context) = pfile->buffer->rlimit;
pfile->out.cur = pfile->out.base;
pfile->out.first_line = pfile->line;
+ /* start_of_input_line is needed to make sure that directives really,
+ really start at the first character of the line. */
+ start_of_input_line = pfile->buffer->cur;
new_context:
context = pfile->context;
cur = CUR (context);
@@ -581,7 +585,7 @@ _cpp_scan_out_logical_line (cpp_reader *pfile, cpp_macro *macro)
break;
case '#':
- if (out - 1 == pfile->out.base
+ if (cur - 1 == start_of_input_line
/* A '#' from a macro doesn't start a directive. */
&& !pfile->context->prev
&& !pfile->state.in_directive)