mojoshader_preprocessor.c
changeset 625 bfb4016d9404
parent 624 99d1cf8a18a3
child 626 95d97e613112
--- a/mojoshader_preprocessor.c	Sat Feb 14 23:00:34 2009 -0500
+++ b/mojoshader_preprocessor.c	Sun Feb 15 01:53:08 2009 -0500
@@ -789,6 +789,7 @@
     conditional->type = type;
     conditional->linenum = state->line - 1;
     conditional->skipping = skipping;
+    conditional->chosen = !skipping;
     conditional->next = prev;
     state->conditional_stack = conditional;
     return conditional;
@@ -820,9 +821,10 @@
         fail(ctx, "#else after #else");
     else
     {
-        // !!! FIXME: doesn't work for #elif
         cond->type = TOKEN_PP_ELSE;
-        cond->skipping = !cond->skipping;
+        cond->skipping = cond->chosen;
+        if (!cond->chosen)
+            cond->chosen = 1;
     } // else
 } // handle_pp_else