Mercurial > ~dholland > hg > tradcpp > index.cgi
changeset 127:a0a86380456e
fix for #if handling:
Don't eval the control expression of the first #if of a block when
already in a false block; it might not be valid. Reported by
Baptiste Daroussin.
author | David A. Holland |
---|---|
date | Wed, 12 Jun 2013 10:52:56 -0400 |
parents | cb08e397ce7b |
children | 1cda505ddc78 |
files | CHANGES directive.c |
diffstat | 2 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGES Wed Jun 12 10:51:10 2013 -0400 +++ b/CHANGES Wed Jun 12 10:52:56 2013 -0400 @@ -1,3 +1,8 @@ +pending + - don't eval the control expression of the first #if of a block when + already in a false block; it might not be valid. Reported by + Baptiste Daroussin. + release 0.2 (20130611) - auto-recognize more builtin PowerPC and mips macros - pass -Wunused (partly from Baptiste Daroussin)
--- a/directive.c Wed Jun 12 10:51:10 2013 -0400 +++ b/directive.c Wed Jun 12 10:52:56 2013 -0400 @@ -184,7 +184,11 @@ /* trim to fit, so the malloc debugging won't complain */ expr = dorealloc(expr, oldlen + 1, strlen(expr) + 1); - val = eval(&p3, expr); + if (ifstate->curtrue) { + val = eval(&p3, expr); + } else { + val = 0; + } ifstate_push(p, val); dostrfree(expr); }