diff options
author | jmallett <jmallett@FreeBSD.org> | 2002-04-20 01:49:10 +0000 |
---|---|---|
committer | jmallett <jmallett@FreeBSD.org> | 2002-04-20 01:49:10 +0000 |
commit | ecccdb870361f2e0e62aea65bc8fa21a5171ea06 (patch) | |
tree | 9d6147d43f9f794cfc750ecb3f50fb216c889a70 /usr.bin/m4/expr.c | |
parent | 2e75617aafa86c07bed18ac6c9afca1d637e0523 (diff) | |
download | FreeBSD-src-ecccdb870361f2e0e62aea65bc8fa21a5171ea06.zip FreeBSD-src-ecccdb870361f2e0e62aea65bc8fa21a5171ea06.tar.gz |
Crank WARNS.
Cast sizeof() to (int), as it's being compared against an int, not a size_t.
If i is changed to a size_t, it means the logic must be slightly changed later
in the flow, where --i is checked to be >= 0. I am not sure I want to make a
logic change to account for clearing up a warning, when an aesthetic one will
keep from modifying the logic.
Other harmless casts, that I think I've made in the right directions.
Make gpbc() an inline function, rather than an obfuscated macro, make its
scratch space local, rather than global. The previous macro used a dirty
hack (logical AND in place of a conditional) which would lead GCC to throw
a fit (rightly so) as the logical check, as well as the incrementation of
a variable, were not used for anything.
const'ify a few places where gcc3 yells. xstrdup() some global consts in
places where we xstrdup() when not using consts, but tried to assign them
to non-consts before.
Don't use execv(2) if we don't have the kind of arguments it wants.
Reviewed by: asmodai obrien tjr
Submitted by: tjr (a gcc3 build log)
Diffstat (limited to 'usr.bin/m4/expr.c')
-rw-r--r-- | usr.bin/m4/expr.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/usr.bin/m4/expr.c b/usr.bin/m4/expr.c index 249d5d5..962070f 100644 --- a/usr.bin/m4/expr.c +++ b/usr.bin/m4/expr.c @@ -245,21 +245,19 @@ not() static int eqrel() { - int vl, vr, eqrel; + int vl, vr, eqrelval; vl = shift(); - while ((eqrel = geteqrel()) != -1) { + while ((eqrelval = geteqrel()) != -1) { vr = shift(); - switch (eqrel) { - + switch (eqrelval) { case EQL: vl = (vl == vr); break; case NEQ: vl = (vl != vr); break; - case LEQ: vl = (vl <= vr); break; @@ -446,7 +444,7 @@ constant() ungetch(); return num(); } - for (i = 0; i < sizeof(int); i++) { + for (i = 0; i < (int)sizeof(int); i++) { if ((c = getch()) == '\'') { ungetch(); break; |