diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2012-02-15 21:24:51 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2012-02-15 21:24:51 +0200 |
commit | 7ec7b66a3c3a4d3596537a119d0f97135ab16ea4 (patch) | |
tree | 3fc2175c3933b4e522d01c64a20738c8f91c9ec3 /awkgram.c | |
parent | 8a2eed59fd54d901721376426b34c0c128bf0cfb (diff) | |
download | egawk-7ec7b66a3c3a4d3596537a119d0f97135ab16ea4.tar.gz egawk-7ec7b66a3c3a4d3596537a119d0f97135ab16ea4.tar.bz2 egawk-7ec7b66a3c3a4d3596537a119d0f97135ab16ea4.zip |
Fix warnings from gcc -Wall, GCC 4.6.2.
Diffstat (limited to 'awkgram.c')
-rw-r--r-- | awkgram.c | 36 |
1 files changed, 27 insertions, 9 deletions
@@ -5470,6 +5470,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 @@ -5487,15 +5513,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) { |