diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1995-02-21 05:37:13 -0500 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1995-02-21 05:37:13 -0500 |
commit | 0468bc75661e1abf8d4736b6064e30caba72104d (patch) | |
tree | 73a081b8d2b4642e3964a69180777e5dee9fa2de | |
parent | 187366548bbfd52a2f3ba6999d439a6388fa535d (diff) | |
download | gcc-0468bc75661e1abf8d4736b6064e30caba72104d.zip gcc-0468bc75661e1abf8d4736b6064e30caba72104d.tar.gz gcc-0468bc75661e1abf8d4736b6064e30caba72104d.tar.bz2 |
(check_newline): Give warning if unrecognized data on #line.
(yylex): Give error for unterminated string constant.
From-SVN: r8976
-rw-r--r-- | gcc/c-lex.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/gcc/c-lex.c b/gcc/c-lex.c index e4d8bf9..8f8c64a 100644 --- a/gcc/c-lex.c +++ b/gcc/c-lex.c @@ -1,5 +1,5 @@ /* Lexical analyzer for C and Objective C. - Copyright (C) 1987, 1988, 1989, 1992, 1994 Free Software Foundation, Inc. + Copyright (C) 1987, 88, 89, 92, 94, 1995 Free Software Foundation, Inc. This file is part of GNU CC. @@ -644,7 +644,20 @@ linenum: if (token == CONSTANT && TREE_CODE (yylval.ttype) == INTEGER_CST && TREE_INT_CST_LOW (yylval.ttype) == 3) - in_system_header = 1; + in_system_header = 1, used_up = 1; + + if (used_up) + { + /* Is this the last nonwhite stuff on the line? */ + c = getc (finput); + while (c == ' ' || c == '\t') + c = getc (finput); + if (c == '\n') + return c; + ungetc (c, finput); + } + + warning ("unrecognized text at end of #line"); } else error ("invalid #-line"); @@ -1798,6 +1811,9 @@ yylex () } *p = 0; + if (c < 0) + error ("Unterminated string constant"); + /* We have read the entire constant. Construct a STRING_CST for the result. */ |