diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1997-04-13 14:30:13 -0400 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1997-04-13 14:30:13 -0400 |
commit | cfb3ee16db4fc9138f2df3524c32c580bb505460 (patch) | |
tree | 5fea26b882fbfca80ad8463d09355f8519f060e7 /gcc/cccp.c | |
parent | 31418d3513edce4366a45f622701fbc858c3dad8 (diff) | |
download | gcc-cfb3ee16db4fc9138f2df3524c32c580bb505460.zip gcc-cfb3ee16db4fc9138f2df3524c32c580bb505460.tar.gz gcc-cfb3ee16db4fc9138f2df3524c32c580bb505460.tar.bz2 |
(do_include): Diagnose #import and #include_next if pedantic and if not in a system header.
(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.
From-SVN: r13887
Diffstat (limited to 'gcc/cccp.c')
-rw-r--r-- | gcc/cccp.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -4220,6 +4220,14 @@ do_include (buf, limit, op, keyword) char *pcfbuflimit; int pcfnum; + if (pedantic && !instack[indepth].system_header_p) + { + if (importing) + pedwarn ("ANSI C does not allow `#import'"); + if (skip_dirs) + pedwarn ("ANSI C does not allow `#include_next'"); + } + if (importing && warn_import && !inhibit_warnings && !instack[indepth].system_header_p && !import_warning) { import_warning = 1; @@ -6752,7 +6760,9 @@ do_warning (buf, limit, op, keyword) bcopy ((char *) buf, (char *) copy, length); copy[length] = 0; SKIP_WHITE_SPACE (copy); - warning ("#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. */ + pedwarn ("#warning %s", copy); return 0; } |