X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=binutils%2Frclex.c;h=d6a0f91c7d16cd9ae0312687dd0c9532529954f1;hb=21af24c8371a3e040f6f548ddfafb20114442c28;hp=4fae3da51275cbc36ace1320ca537322278513d7;hpb=e36ea2deae43832a148ed5ef19ca125704b7a7b4;p=deliverable%2Fbinutils-gdb.git diff --git a/binutils/rclex.c b/binutils/rclex.c index 4fae3da512..d6a0f91c7d 100644 --- a/binutils/rclex.c +++ b/binutils/rclex.c @@ -1,7 +1,6 @@ /* rclex.c -- lexer for Windows rc files parser */ -/* Copyright 1997, 1998, 1999, 2001, 2002, 2003, 2005, 2006, 2007 - Free Software Foundation, Inc. +/* Copyright (C) 1997-2020 Free Software Foundation, Inc. Written by Kai Tietz, Onevision. @@ -41,7 +40,7 @@ static int rcdata_mode; -/* Whether we are supressing lines from cpp (including windows.h or +/* Whether we are suppressing lines from cpp (including windows.h or headers from your C sources may bring in externs and typedefs). When active, we return IGNORED_TOKEN, which lets us ignore these outside of resource constructs. Thus, it isn't required to protect @@ -148,7 +147,7 @@ cpp_line (void) ++s; while (ISSPACE (*s)) ++s; - + /* Check for #pragma code_page ( DEFAULT | ). */ len = strlen (s); mlen = strlen ("pragma"); @@ -390,9 +389,9 @@ handle_quotes (rc_uint_type *len) } else { - rcparse_warning ("unexpected character after '\"'"); ++t; - assert (ISSPACE (*t)); + if (! ISSPACE (*t)) + rcparse_warning ("unexpected character after '\"'"); while (ISSPACE (*t)) { if ((*t) == '\n') @@ -679,7 +678,7 @@ static void rclex_string (void) { int c; - + while ((c = rclex_peekch ()) != -1) { if (c == '\n') @@ -693,6 +692,18 @@ rclex_string (void) } else if (rclex_readch () == '"') { + /* PR 6714 + Skip any whitespace after the end of the double quotes. */ + do + { + c = rclex_peekch (); + if (ISSPACE (c)) + rclex_readch (); + else + c = -1; + } + while (c != -1); + if (rclex_peekch () == '"') rclex_readch (); else @@ -770,7 +781,7 @@ yylex (void) /* Clear token. */ rclex_tok_pos = 0; rclex_tok[0] = 0; - + if ((ch = rclex_readch ()) == -1) return -1; if (ch == '\n') @@ -786,15 +797,15 @@ yylex (void) cpp_line (); ch = IGNORED_TOKEN; break; - + case '{': ch = IGNORE_CPP (BEG); break; - + case '}': ch = IGNORE_CPP (END); break; - + case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': yylval.i.val = read_digit (ch);