diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2012-03-22 22:10:13 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2012-03-22 22:10:13 +0200 |
commit | c7f51459f7da3e0c693f8a950726869d99e5bcf2 (patch) | |
tree | 2e4b54cc695adc5b4fdaec56e237250c030a5419 /awkgram.c | |
parent | 1e495ca269aa2653bf804088ebe532b67110a3ef (diff) | |
parent | b467a6d3d604723e0c152dceb09e998c059bfa40 (diff) | |
download | egawk-c7f51459f7da3e0c693f8a950726869d99e5bcf2.tar.gz egawk-c7f51459f7da3e0c693f8a950726869d99e5bcf2.tar.bz2 egawk-c7f51459f7da3e0c693f8a950726869d99e5bcf2.zip |
Merge branch 'gawk-4.0-stable'
Diffstat (limited to 'awkgram.c')
-rw-r--r-- | awkgram.c | 36 |
1 files changed, 27 insertions, 9 deletions
@@ -5450,6 +5450,32 @@ allow_newline(void) } } +/* newline_eof --- return newline or EOF as needed and adjust variables */ + +/* + * This routine used to be a macro, however GCC 4.6.2 warned about + * the result of a computation not being used. Converting to a function + * removes the warnings. + */ + +static int newline_eof() +{ + /* NB: a newline at end does not start a source line. */ + if (lasttok != NEWLINE) { + pushback(); + if (do_lint && ! eof_warned) { + lintwarn(_("source file does not end in newline")); + eof_warned = TRUE; + } + sourceline++; + return NEWLINE; + } + + sourceline--; + eof_warned = FALSE; + return LEX_EOF; +} + /* yylex --- Read the input and turn it into tokens. */ static int @@ -5468,15 +5494,7 @@ yylex(void) #define GET_INSTRUCTION(op) bcalloc(op, 1, sourceline) - /* NB: a newline at end does not start a source line. */ - -#define NEWLINE_EOF \ - (lasttok != NEWLINE ? \ - (pushback(), do_lint && ! eof_warned && \ - (lintwarn(_("source file does not end in newline")), \ - eof_warned = TRUE), sourceline++, NEWLINE) : \ - (sourceline--, eof_warned = FALSE, LEX_EOF)) - +#define NEWLINE_EOF newline_eof() yylval = (INSTRUCTION *) NULL; if (lasttok == SUBSCRIPT) { |