Commit 369239ef by Ralf Wildenhues Committed by Ralf Wildenhues

re PR c/28800 (warning "ISO C forbids an empty source file" could be improved)

gcc/:
PR c/28800
* c-parser.c (c_parser_translation_unit): Warn for empty
translation unit, not empty source file.

gcc/testsuite/:
PR c/28800
* gcc.dg/empty-source-2.c: Adjust for warning message.
* gcc.dg/empty-source-3.c: Likewise.
* gcc.dg/pack-test-2.c: Adjust comment.
* gcc.dg/pragma-ep-2.c: Likewise.
* gcc.dg/pragma-re-2.c: Likewise.
* gcc.dg/va-arg-2.c: Likewise.

From-SVN: r132690
parent e19bb186
2008-02-26 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
PR c/28800
* c-parser.c (c_parser_translation_unit): Warn for empty
translation unit, not empty source file.
2008-02-26 Paul Brook <paul@codesourcery.com> 2008-02-26 Paul Brook <paul@codesourcery.com>
* config/arm/arm.c (thumb_set_frame_pointer): Ensure SP is first * config/arm/arm.c (thumb_set_frame_pointer): Ensure SP is first
......
...@@ -1069,7 +1069,7 @@ c_parser_translation_unit (c_parser *parser) ...@@ -1069,7 +1069,7 @@ c_parser_translation_unit (c_parser *parser)
if (c_parser_next_token_is (parser, CPP_EOF)) if (c_parser_next_token_is (parser, CPP_EOF))
{ {
if (pedantic) if (pedantic)
pedwarn ("%HISO C forbids an empty source file", pedwarn ("%HISO C forbids an empty translation unit",
&c_parser_peek_token (parser)->location); &c_parser_peek_token (parser)->location);
} }
else else
......
2008-02-26 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
PR c/28800
* gcc.dg/empty-source-2.c: Adjust for warning message.
* gcc.dg/empty-source-3.c: Likewise.
* gcc.dg/pack-test-2.c: Adjust comment.
* gcc.dg/pragma-ep-2.c: Likewise.
* gcc.dg/pragma-re-2.c: Likewise.
* gcc.dg/va-arg-2.c: Likewise.
2008-02-26 Tobias Burnus <burnus@net-b.de> 2008-02-26 Tobias Burnus <burnus@net-b.de>
PR fortran/35033 PR fortran/35033
...@@ -3,4 +3,4 @@ ...@@ -3,4 +3,4 @@
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-pedantic" } */ /* { dg-options "-pedantic" } */
/* { dg-warning "ISO C forbids an empty source file" "empty" { target *-*-* } 6 } */ /* { dg-warning "ISO C forbids an empty translation unit" "empty" { target *-*-* } 6 } */
...@@ -4,4 +4,4 @@ ...@@ -4,4 +4,4 @@
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-pedantic-errors" } */ /* { dg-options "-pedantic-errors" } */
/* { dg-error "ISO C forbids an empty source file" "empty" { target *-*-* } 7 } */ /* { dg-error "ISO C forbids an empty translation unit" "empty" { target *-*-* } 7 } */
...@@ -22,4 +22,4 @@ ...@@ -22,4 +22,4 @@
#pragma pack(push, foo, 3) /* { dg-warning "small power of two" } */ #pragma pack(push, foo, 3) /* { dg-warning "small power of two" } */
extern int blah; /* prevent "ISO C forbids an empty source file" */ extern int blah; /* prevent "ISO C forbids an empty translation unit" */
...@@ -4,4 +4,4 @@ ...@@ -4,4 +4,4 @@
#pragma extern_prefix foo /* { dg-warning "malformed" } */ #pragma extern_prefix foo /* { dg-warning "malformed" } */
#pragma extern_prefix "foo" 1 /* { dg-warning "junk" } */ #pragma extern_prefix "foo" 1 /* { dg-warning "junk" } */
int bar; /* silence `ISO C forbids an empty source file' warning */ int bar; /* silence `ISO C forbids an empty translation unit' warning */
...@@ -5,4 +5,4 @@ ...@@ -5,4 +5,4 @@
#pragma redefine_extname foo 1 /* { dg-warning "malformed" } */ #pragma redefine_extname foo 1 /* { dg-warning "malformed" } */
#pragma redefine_extname foo bar 2 /* { dg-warning "junk" } */ #pragma redefine_extname foo bar 2 /* { dg-warning "junk" } */
int bar; /* silence `ISO C forbids an empty source file' warning */ int bar; /* silence `ISO C forbids an empty translation unit' warning */
...@@ -9,4 +9,4 @@ ...@@ -9,4 +9,4 @@
/* { dg-error "no longer implements" "#error 1" { target *-*-* } 4 } */ /* { dg-error "no longer implements" "#error 1" { target *-*-* } 4 } */
/* { dg-error "Revise your code" "#error 2" { target *-*-* } 5 } */ /* { dg-error "Revise your code" "#error 2" { target *-*-* } 5 } */
int x; /* prevent empty-source-file warning */ int x; /* prevent empty-translation-unit warning */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment