# HG changeset patch # User David A. Holland # Date 1371048776 14400 # Node ID a0a86380456ea41199266debcf1726ec44e8ffc5 # Parent cb08e397ce7b21bf6126c165f5c3dc1cd7c8ed86 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. diff -r cb08e397ce7b -r a0a86380456e CHANGES --- 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) diff -r cb08e397ce7b -r a0a86380456e directive.c --- 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); }