Pointer differences are generally not integers, so use %td here.
This commit is contained in:
parent
dfa4e075c4
commit
eb085c765d
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: unifdef.c,v 1.20 2011/09/16 15:39:30 joerg Exp $ */
|
||||
/* $NetBSD: unifdef.c,v 1.21 2012/02/29 23:35:10 joerg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1985, 1993
|
||||
|
@ -77,7 +77,7 @@ static const char copyright[] =
|
|||
#endif
|
||||
#ifdef __IDSTRING
|
||||
__IDSTRING(Berkeley, "@(#)unifdef.c 8.1 (Berkeley) 6/6/93");
|
||||
__IDSTRING(NetBSD, "$NetBSD: unifdef.c,v 1.20 2011/09/16 15:39:30 joerg Exp $");
|
||||
__IDSTRING(NetBSD, "$NetBSD: unifdef.c,v 1.21 2012/02/29 23:35:10 joerg Exp $");
|
||||
__IDSTRING(dotat, "$dotat: things/unifdef.c,v 1.161 2003/07/01 15:32:48 fanf2 Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
@ -241,7 +241,7 @@ static bool keepthis; /* don't delete constant #if */
|
|||
static int exitstat; /* program exit status */
|
||||
|
||||
static void addsym(bool, bool, char *);
|
||||
static void debug(const char *, ...);
|
||||
static void debug(const char *, ...) __printflike(1, 2);
|
||||
__dead static void done(void);
|
||||
__dead static void error(const char *);
|
||||
static int findsym(const char *);
|
||||
|
@ -736,26 +736,26 @@ eval_unary(const struct ops *ops, int *valp, const char **cpp)
|
|||
|
||||
cp = skipcomment(*cpp);
|
||||
if (*cp == '!') {
|
||||
debug("eval%d !", ops - eval_ops);
|
||||
debug("eval%td !", ops - eval_ops);
|
||||
cp++;
|
||||
if (eval_unary(ops, valp, &cp) == LT_IF)
|
||||
return (LT_IF);
|
||||
*valp = !*valp;
|
||||
} else if (*cp == '(') {
|
||||
cp++;
|
||||
debug("eval%d (", ops - eval_ops);
|
||||
debug("eval%td (", ops - eval_ops);
|
||||
if (eval_table(eval_ops, valp, &cp) == LT_IF)
|
||||
return (LT_IF);
|
||||
cp = skipcomment(cp);
|
||||
if (*cp++ != ')')
|
||||
return (LT_IF);
|
||||
} else if (isdigit((unsigned char)*cp)) {
|
||||
debug("eval%d number", ops - eval_ops);
|
||||
debug("eval%td number", ops - eval_ops);
|
||||
*valp = strtol(cp, &ep, 0);
|
||||
cp = skipsym(cp);
|
||||
} else if (strncmp(cp, "defined", 7) == 0 && endsym(cp[7])) {
|
||||
cp = skipcomment(cp+7);
|
||||
debug("eval%d defined", ops - eval_ops);
|
||||
debug("eval%td defined", ops - eval_ops);
|
||||
if (*cp++ != '(')
|
||||
return (LT_IF);
|
||||
cp = skipcomment(cp);
|
||||
|
@ -769,7 +769,7 @@ eval_unary(const struct ops *ops, int *valp, const char **cpp)
|
|||
return (LT_IF);
|
||||
keepthis = false;
|
||||
} else if (!endsym(*cp)) {
|
||||
debug("eval%d symbol", ops - eval_ops);
|
||||
debug("eval%td symbol", ops - eval_ops);
|
||||
sym = findsym(cp);
|
||||
if (sym < 0 || symlist)
|
||||
return (LT_IF);
|
||||
|
@ -783,12 +783,12 @@ eval_unary(const struct ops *ops, int *valp, const char **cpp)
|
|||
cp = skipsym(cp);
|
||||
keepthis = false;
|
||||
} else {
|
||||
debug("eval%d bad expr", ops - eval_ops);
|
||||
debug("eval%td bad expr", ops - eval_ops);
|
||||
return (LT_IF);
|
||||
}
|
||||
|
||||
*cpp = cp;
|
||||
debug("eval%d = %d", ops - eval_ops, *valp);
|
||||
debug("eval%td = %d", ops - eval_ops, *valp);
|
||||
return (*valp ? LT_TRUE : LT_FALSE);
|
||||
}
|
||||
|
||||
|
@ -802,7 +802,7 @@ eval_table(const struct ops *ops, int *valp, const char **cpp)
|
|||
const char *cp;
|
||||
int val;
|
||||
|
||||
debug("eval%d", ops - eval_ops);
|
||||
debug("eval%td", ops - eval_ops);
|
||||
cp = *cpp;
|
||||
if (ops->inner(ops+1, valp, &cp) == LT_IF)
|
||||
return (LT_IF);
|
||||
|
@ -814,14 +814,14 @@ eval_table(const struct ops *ops, int *valp, const char **cpp)
|
|||
if (op->str == NULL)
|
||||
break;
|
||||
cp += strlen(op->str);
|
||||
debug("eval%d %s", ops - eval_ops, op->str);
|
||||
debug("eval%td %s", ops - eval_ops, op->str);
|
||||
if (ops->inner(ops+1, &val, &cp) == LT_IF)
|
||||
return (LT_IF);
|
||||
*valp = op->fn(*valp, val);
|
||||
}
|
||||
|
||||
*cpp = cp;
|
||||
debug("eval%d = %d", ops - eval_ops, *valp);
|
||||
debug("eval%td = %d", ops - eval_ops, *valp);
|
||||
return (*valp ? LT_TRUE : LT_FALSE);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue