diff options
author | kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4> | 1997-04-13 18:30:13 +0000 |
---|---|---|
committer | kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4> | 1997-04-13 18:30:13 +0000 |
commit | a5b6178ad69416a75e853de5e30edf2da815af22 (patch) | |
tree | 5fea26b882fbfca80ad8463d09355f8519f060e7 /gcc/cpplib.c | |
parent | 0b399586de28510d398d520ba42cc93b298383f3 (diff) | |
download | ppe42-gcc-a5b6178ad69416a75e853de5e30edf2da815af22.tar.gz ppe42-gcc-a5b6178ad69416a75e853de5e30edf2da815af22.zip |
(do_include): Diagnose #import and #include_next if pedantic and if
not in a system header.
(do_warning): #warning now causes an error if -pedantic-errors is
given; this is needed since #warning isn't ANSI.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@13887 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cpplib.c')
-rw-r--r-- | gcc/cpplib.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/cpplib.c b/gcc/cpplib.c index 6e2177e3003..697cea8f71f 100644 --- a/gcc/cpplib.c +++ b/gcc/cpplib.c @@ -3112,6 +3112,14 @@ do_include (pfile, keyword, unused1, unused2) int pcfnum; f= -1; /* JF we iz paranoid! */ + if (CPP_PEDANTIC (pfile) && !CPP_BUFFER (pfile)->system_header_p) + { + if (importing) + cpp_pedwarn (pfile, "ANSI C does not allow `#import'"); + if (skip_dirs) + cpp_pedwarn (pfile, "ANSI C does not allow `#include_next'"); + } + if (importing && CPP_OPTIONS (pfile)->warn_import && !CPP_OPTIONS (pfile)->inhibit_warnings && !CPP_BUFFER (pfile)->system_header_p && !pfile->import_warning) @@ -3905,7 +3913,9 @@ do_warning (pfile, keyword, buf, limit) bcopy (buf, copy, length); copy[length] = 0; SKIP_WHITE_SPACE (copy); - cpp_warning (pfile, "#warning %s", copy); + /* Use `pedwarn' not `warning', because #warning isn't in the C Standard; + if -pedantic-errors is given, #warning should cause an error. */ + cpp_pedwarn (pfile, "#warning %s", copy); return 0; } |