aboutsummaryrefslogtreecommitdiffstats
path: root/awkgram.c
diff options
context:
space:
mode:
authorjohn haque <j.eh@mchsi.com>2012-04-17 13:00:13 -0500
committerjohn haque <j.eh@mchsi.com>2012-04-17 13:00:13 -0500
commitb1062311a3caab9ec89c0f104bd9b4334174f23c (patch)
tree08a64713888026fb80fd80360343a51aebd8a593 /awkgram.c
parente729adf120f279fd65578a410ca8d2d93a56f0f0 (diff)
parentf0345a29c71a3215adaa0e2fdfefc0c439ea6561 (diff)
downloadegawk-b1062311a3caab9ec89c0f104bd9b4334174f23c.tar.gz
egawk-b1062311a3caab9ec89c0f104bd9b4334174f23c.tar.bz2
egawk-b1062311a3caab9ec89c0f104bd9b4334174f23c.zip
Merge branch 'master' into gawk_mpfr.
Diffstat (limited to 'awkgram.c')
-rw-r--r--awkgram.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/awkgram.c b/awkgram.c
index 8858e772..07de29e4 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -5480,6 +5480,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
@@ -5499,15 +5525,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) {