re PR preprocessor/7070 (internal error with -Wunknown-pragmas && empty #pragma)

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: r55021
This commit is contained in:
Neil Booth 2002-06-27 05:59:53 +00:00 committed by Neil Booth
parent 0c14a54df6
commit 0647023885
4 changed files with 30 additions and 9 deletions

View 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-26 Bob Wilson <bob.wilson@acm.org>
* config/xtensa/xtensa-protos.h (xtensa_return_addr): Declare.

View File

@ -322,20 +322,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);
}
}

View File

@ -1,3 +1,7 @@
2002-06-27 Neil Booth <neil@daikokuya.co.uk>
* gcc.dg/Wunknownprag.c: New tests.
Tue Jun 25 21:50:38 2002 J"orn Rennecke <joern.rennecke@superh.com>
* gcc.c-torture/execute/simd-2.c: New test.

View File

@ -0,0 +1,11 @@
/* Copyright (C) 2002 Free Software Foundation, Inc. */
/* { dg-do compile } */
/* { dg-options "-Wunknown-pragmas" } */
/* We used to get "unspellable token: CPP_EOF" warnings. */
#pragma /* { dg-warning "ignoring #pragma" } */
#pragma ~ /* { dg-warning "ignoring #pragma" } */
#pragma baz /* { dg-warning "ignoring #pragma" } */
#pragma baz baz /* { dg-warning "ignoring #pragma" } */