From: Nathanael Nerode Date: Wed, 10 Dec 2003 16:57:06 +0000 (+0000) Subject: backport: cpptrad.c (_cpp_scan_out_logical_line): Improve test for whether directive... X-Git-Tag: releases/gcc-3.3.3~215 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a5c9d87d06766ae11336ca066cd0903c5068229;p=thirdparty%2Fgcc.git backport: cpptrad.c (_cpp_scan_out_logical_line): Improve test for whether directive begins at the beginning of a line. Backport from mainline (fixes unreported regression): * cpptrad.c (_cpp_scan_out_logical_line): Improve test for whether directive begins at the beginning of a line. (testsuite) Backport from mainline: * gcc.dg/cpp/trad/xwin1.c: New test case. From-SVN: r74502 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f378c7aa1932..139b1bef3268 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2003-12-10 Nathanael Nerode + + Backport from mainline (fixes unreported regression): + * cpptrad.c (_cpp_scan_out_logical_line): Improve test for + whether directive begins at the beginning of a line. + 2003-12-10 Eric Botcazou PR target/13354 diff --git a/gcc/cpptrad.c b/gcc/cpptrad.c index 5c66659f02b1..27cce2f6e280 100644 --- a/gcc/cpptrad.c +++ b/gcc/cpptrad.c @@ -438,6 +438,7 @@ scan_out_logical_line (pfile, 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; @@ -448,6 +449,9 @@ scan_out_logical_line (pfile, 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); @@ -682,7 +686,7 @@ scan_out_logical_line (pfile, 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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d35950b639ad..2693b2958687 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2003-12-10 Nathanael Nerode + + Backport from mainline: + * gcc.dg/cpp/trad/xwin1.c: New test case. + 2003-12-10 Eric Botcazou Backport from mainline: