This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Fix preprocessor/7150
- From: Neil Booth <neil at daikokuya dot co dot uk>
- To: Jason R Thorpe <thorpej at wasabisystems dot com>, gcc-bugs at gcc dot gnu dot org
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 1 Jul 2002 13:48:30 +0100
- Subject: Re: Fix preprocessor/7150
- References: <20020629143556.GA32110@daikokuya.co.uk> <20020629122526.F1614@dr-evil.shagadelic.org>
Jason R Thorpe wrote:-
> Yes, the segv is gone. But it still doesn't work properly :-)
>
> I've attached some files as an example of the failure.
>
> x86_64-unknown-netbsd-gcc -traditional-cpp -M \
> -D_LOCORE -Dx86_64 -D_KERNEL microtime.S
>
> In file included from microtime.S:36:
> asm.h:71: unterminated #ifdef
> asm.h:64: unterminated #ifndef
> asm.h:41: unterminated #ifndef
>
> Also attached is the output of:
>
> x86_64-unknown-netbsd-gcc -traditional-cpp -E \
> -D_LOCORE -Dx86_64 -D_KERNEL microtime.S
>
> Look for "SHOULD NOT BE HERE" and "NEITHER SHOULD THIS". Also note that
> the _ENTRY() macro (used by ENTRY()) from asm.h does not get expanded.
Thanks for the feedback. I can't reproduce your -M issue with
unterminated #ifdefs. Let me know if it is still there for you.
[I've just noticed I omitted to commit cppmacro.c in my previous patch.
I've applied it now; I think that may be what fixes this.]
I believe the last two issues are fixed with this patch and testcase,
which I've applied as obvious. Let me know how things look for you
now.
Thanks,
Neil.
* cpptrad.c (skip_whitespace): Pass pointer to prior char.
testsuite:
* gcc.dg/cpp/trad/escaped-nl.c: New test.
Index: cpptrad.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cpptrad.c,v
retrieving revision 1.22
diff -u -p -r1.22 cpptrad.c
--- cpptrad.c 28 Jun 2002 06:26:54 -0000 1.22
+++ cpptrad.c 1 Jul 2002 12:48:02 -0000
@@ -284,7 +284,7 @@ skip_whitespace (pfile, cur, skip_commen
out--;
if (c == '\\' && is_vspace (*cur))
{
- cur = skip_escaped_newlines (pfile, cur);
+ cur = skip_escaped_newlines (pfile, cur - 1);
continue;
}
Index: testsuite//gcc.dg/cpp/trad/escaped-nl.c
===================================================================
RCS file: testsuite//gcc.dg/cpp/trad/escaped-nl.c
diff -N testsuite//gcc.dg/cpp/trad/escaped-nl.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite//gcc.dg/cpp/trad/escaped-nl.c 1 Jul 2002 12:48:03 -0000
@@ -0,0 +1,10 @@
+/* Test escaped newlines at start of macro definition are properly
+ skipped (buglet in skip_whitespace () in cpptrad.c). */
+
+/* { dg-do preprocess } */
+
+#define NUM \
+100
+#if NUM != 100
+# error NUM not defined properly /* { dg-bogus "error" } */
+#endif