aboutsummaryrefslogtreecommitdiff
path: root/gcc/cccp.c
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1993-01-05 18:45:34 -0800
committerJim Wilson <wilson@gcc.gnu.org>1993-01-05 18:45:34 -0800
commitbdc680a24c73e8418f11aa1baa744927f98499bc (patch)
tree8560a618ea3c71f23d9fd84172360fc07d7e3b55 /gcc/cccp.c
parentfa42713123b2379c61cdf1894c5c40c1e2f3381f (diff)
downloadgcc-bdc680a24c73e8418f11aa1baa744927f98499bc.zip
gcc-bdc680a24c73e8418f11aa1baa744927f98499bc.tar.gz
gcc-bdc680a24c73e8418f11aa1baa744927f98499bc.tar.bz2
(do_line): Add pedantic warnings for out of range line
numbers, and non-space characters after the filename. From-SVN: r3104
Diffstat (limited to 'gcc/cccp.c')
-rw-r--r--gcc/cccp.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/cccp.c b/gcc/cccp.c
index adfdb81..3731a1e 100644
--- a/gcc/cccp.c
+++ b/gcc/cccp.c
@@ -5693,6 +5693,10 @@ do_line (buf, limit, op, keyword)
we must store a line number now that is one less. */
new_lineno = atoi (bp) - 1;
+ /* NEW_LINENO is one less than the actual line number here. */
+ if (pedantic && new_lineno < 0)
+ pedwarn ("line number out of range in `#line' command");
+
/* skip over the line number. */
while (isdigit (*bp))
bp++;
@@ -5726,6 +5730,8 @@ do_line (buf, limit, op, keyword)
bp++;
SKIP_WHITE_SPACE (bp);
if (*bp) {
+ if (pedantic)
+ pedwarn ("garbage at end of `#line' command");
if (*bp == '1')
file_change = enter_file;
else if (*bp == '2')