From 8fd543444c6157056c671f2f9b373dedfcec51ab Mon Sep 17 00:00:00 2001 From: kenner Date: Tue, 21 Feb 1995 10:37:13 +0000 Subject: [PATCH] (check_newline): Give warning if unrecognized data on #line. (yylex): Give error for unterminated string constant. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@8976 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-lex.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/gcc/c-lex.c b/gcc/c-lex.c index e4d8bf913c6..8f8c64a6731 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. */ -- 2.11.4.GIT