Fix build of m4 with WARNS=6.

Change the parser; rename `exp' to `exponent' not to collide with exp(3).
This commit is contained in:
Ed Schouten 2011-10-16 08:09:17 +00:00
parent aa404b67bb
commit 1e2070ab5b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=226422
3 changed files with 11 additions and 12 deletions

View File

@ -9,6 +9,4 @@ CFLAGS+=-DEXTENDED
SRCS= eval.c expr.c look.c main.c misc.c gnum4.c trace.c
WARNS?= 0
.include <bsd.prog.mk>

View File

@ -71,8 +71,8 @@ __FBSDID("$FreeBSD$");
* nerel : shift { ("<" | ">" | "<=" | ">=") shift }
* shift : primary { ("<<" | ">>") primary }
* primary : term { ("+" | "-") term }
* term : exp { ("*" | "/" | "%") exp }
* exp : unary { "**" unary }
* term : exponent { ("*" | "/" | "%") exponent }
* exponent: unary { "**" unary }
* unary : factor
* | ("+" | "-" | "~" | "!") unary
* factor : constant
@ -115,12 +115,11 @@ static int nerel(int mayeval);
static int shift(int mayeval);
static int primary(int mayeval);
static int term(int mayeval);
static int exp(int mayeval);
static int exponent(int mayeval);
static int unary(int mayeval);
static int factor(int mayeval);
static int constant(int mayeval);
static int num(int mayeval);
static int geteqrel(int mayeval);
static int skipws(void);
static void experr(const char *);
@ -388,16 +387,16 @@ primary(int mayeval)
}
/*
* term : exp { ("*" | "/" | "%") exp }
* term : exponent { ("*" | "/" | "%") exponent }
*/
static int
term(int mayeval)
{
int c, vl, vr;
vl = exp(mayeval);
vl = exponent(mayeval);
while ((c = skipws()) == '*' || c == '/' || c == '%') {
vr = exp(mayeval);
vr = exponent(mayeval);
switch (c) {
case '*':
@ -426,10 +425,10 @@ term(int mayeval)
}
/*
* exp : unary { "**" exp }
* exponent : unary { "**" exponent }
*/
static int
exp(int mayeval)
exponent(int mayeval)
{
int c, vl, vr, n;
@ -562,7 +561,7 @@ constant(int mayeval)
* num : digit | num digit
*/
static int
num(int mayeval)
num(int mayeval __unused)
{
int rval, c, base;
int ndig;

View File

@ -34,9 +34,11 @@
*/
#ifndef lint
#if 0
static char copyright[] =
"@(#) Copyright (c) 1989, 1993\n\
The Regents of the University of California. All rights reserved.\n";
#endif
#endif /* not lint */
#ifndef lint