Subject: Fix for PR#23300 (cpp and -Wtraditional)
To: None <tech-toolchain@netbsd.org>
From: James Chacon <jmc@netbsd.org>
List: tech-toolchain
Date: 12/15/2003 16:14:18
I tend to agree with the logic in the PR as #error was used before C89 as
a way to stop the pre-processor even though it wasn't a valid token. Doing
what gcc suggests gives you the opposite behavior which probably isn't
expected. Therefore #error should probably be excluded from this warning.

Anyone have a problem with the attached patch?

James

Index: gnu/dist/gcc/gcc/cpplib.c
===================================================================
RCS file: /cvsroot/src/gnu/dist/gcc/gcc/cpplib.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 cpplib.c
--- gnu/dist/gcc/gcc/cpplib.c	18 Oct 2003 11:04:56 -0000	1.1.1.2
+++ gnu/dist/gcc/gcc/cpplib.c	15 Dec 2003 22:12:45 -0000
@@ -329,7 +329,7 @@
 	cpp_error (pfile, DL_WARNING,
 		   "traditional C ignores #%s with the # indented",
 		   dir->name);
-      else if (!indented && dir->origin != KANDR)
+      else if (!indented && dir->origin != KANDR && dir != &dtable[T_ERROR])
 	cpp_error (pfile, DL_WARNING,
 		   "suggest hiding #%s from traditional C with an indented #",
 		   dir->name);