diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-12-28 12:06:15 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-12-28 12:06:15 +0000 |
commit | a5ed82b5f226456bc5dd86b4ee36e4175b4abe2a (patch) | |
tree | ab36dca677ec3929d67d394268b64230a291eea5 | |
parent | 22d8673e3527a23ef829d2afa56364a5493054c9 (diff) | |
download | uClibc-alpine-a5ed82b5f226456bc5dd86b4ee36e4175b4abe2a.tar.bz2 uClibc-alpine-a5ed82b5f226456bc5dd86b4ee36e4175b4abe2a.tar.xz |
fix another corner case in unifdef
-rw-r--r-- | extra/scripts/unifdef.c | 4 | ||||
-rw-r--r-- | extra/scripts/unifdef.test | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/extra/scripts/unifdef.c b/extra/scripts/unifdef.c index 87402c0ce..0eb0d0900 100644 --- a/extra/scripts/unifdef.c +++ b/extra/scripts/unifdef.c @@ -601,7 +601,7 @@ getline(void) linestate = LS_DIRTY; } /* skipcomment should have changed the state */ -// Hmm, happens sometimes on valid files +// Hmm hppens sometimes on valid files // if (linestate == LS_HASH) { // debug("bug at line %d", __LINE__); // abort(); /* bug */ @@ -795,6 +795,7 @@ eval_table(const struct ops *ops, int *valp, const char **cpp) cp += strlen(op->str); debug("eval%d '%s'", ops - eval_ops, op->str); right_side = ops->inner(ops+1, &val, &cp); + *cpp = cp; /* If short_circuit_val is 0 or 1, we can ignore * right side if left size is known, and its value @@ -820,7 +821,6 @@ eval_table(const struct ops *ops, int *valp, const char **cpp) left_side = right_side; } - *cpp = cp; debug("eval%d = %d LT_IF:%d", ops - eval_ops, *valp, (left_side == LT_IF)); if (left_side == LT_IF) return (LT_IF); diff --git a/extra/scripts/unifdef.test b/extra/scripts/unifdef.test index 7cd4f148e..5ba4e48df 100644 --- a/extra/scripts/unifdef.test +++ b/extra/scripts/unifdef.test @@ -24,6 +24,12 @@ hello world #if (1 > 0) && defined A hello world #endif +#if defined A && (defined FOO || defined BAR) +hello world +#endif +#if (defined FOO || defined BAR) && defined A +hello world +#endif *** Everything should be visible here, but #if/#endif removed: #if defined B || !defined A |