]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR preprocessor/7070 (internal error with -Wunknown-pragmas && empty #pragma)
authorNeil Booth <neil@daikokuya.co.uk>
Thu, 27 Jun 2002 22:27:13 +0000 (22:27 +0000)
committerNeil Booth <neil@gcc.gnu.org>
Thu, 27 Jun 2002 22:27:13 +0000 (22:27 +0000)
PR preprocessor/7070
* c-lex.c (cb_def_pragma): Don't try to spell CPP_EOF.
testsuite:
* gcc.dg/Wunknownprag.c: New tests.

From-SVN: r55045

gcc/ChangeLog
gcc/c-lex.c
gcc/testsuite/ChangeLog

index 7da8935cce048073fc2dd5feff70bc6421ef815d..41be19fa6c52f0460b6fb1683d807545e60ea2e4 100644 (file)
@@ -1,3 +1,8 @@
+2002-06-27  Neil Booth  <neil@daikokuya.co.uk>
+
+       PR preprocessor/7070
+       * c-lex.c (cb_def_pragma): Don't try to spell CPP_EOF.
+
 2002-06-27  Gerald Pfeifer  <pfeifer@dbai.tuwien.ac.at>
 
        * doc/install.texi (Binaries): Add Sinix/Reliant Unix.  Move
index 9eb308c3c2f0bfdbc5f338eb1cb4c604e55019ea..48b087e538e7548e0892e2be316e723766b67269 100644 (file)
@@ -334,20 +334,21 @@ cb_def_pragma (pfile, line)
      -Wunknown-pragmas has been given.  */
   if (warn_unknown_pragmas > in_system_header)
     {
-      const unsigned char *space, *name = 0;
+      const unsigned char *space, *name;
       const cpp_token *s;
 
+      space = name = (const unsigned char *) "";
       s = cpp_get_token (pfile);
-      space = cpp_token_as_text (pfile, s);
-      s = cpp_get_token (pfile);
-      if (s->type == CPP_NAME)
-       name = cpp_token_as_text (pfile, s);
+      if (s->type != CPP_EOF)
+       {
+         space = cpp_token_as_text (pfile, s);
+         s = cpp_get_token (pfile);
+         if (s->type == CPP_NAME)
+           name = cpp_token_as_text (pfile, s);
+       }
 
       lineno = SOURCE_LINE (map, line);
-      if (name)
-       warning ("ignoring #pragma %s %s", space, name);
-      else
-       warning ("ignoring #pragma %s", space);
+      warning ("ignoring #pragma %s %s", space, name);
     }
 }
 
index cfb85cbcee66d5ce0dcc414b9311454149eb7568..fe3eb616af912fbc777acbdaaca558f46724e932 100644 (file)
@@ -1,3 +1,7 @@
+2002-06-27  Neil Booth  <neil@daikokuya.co.uk>
+
+       * gcc.dg/Wunknownprag.c: New tests.
+
 2002-06-27  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/6695