From 0468bc75661e1abf8d4736b6064e30caba72104d Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Tue, 21 Feb 1995 05:37:13 -0500 Subject: (check_newline): Give warning if unrecognized data on #line. (yylex): Give error for unterminated string constant. From-SVN: r8976 --- gcc/c-lex.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'gcc/c-lex.c') 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. */ -- cgit v1.1