Closed ClementDreptin closed 7 months ago
Hi,
I noticed the 2 following bugs in the preprocessor:
#elifdef runs even if the previous #ifdef was true.
#elifdef
#ifdef
#define A #define B init() { #ifdef A println("A"); #elifdef B println("B"); #else println("else"); #endif }
Expected output:
init() { println( "A" ); }
Actual output:
init() { println( "A" ); println( "B" ); }
#elifdef makes the #else run even if the previous first #ifdef was true (the #else doesn't run when it's just a #ifdef without a #elifdef).
#else
#define A init() { #ifdef A println("A"); #elifdef B println("B"); #else println("else"); #endif }
init() { println( "A" ); println( "else" ); }
I tried to dig through the code to find where the problem could come from, to no avail, sorry...
Adding an actual preprocessor to GSC is one of the coolest things about this project in my opinion, so I hope this bug report can make it even better!
Great report!
i will take a look this weekend, seems like im probably missing some logic on blocks push/pop
Hi,
I noticed the 2 following bugs in the preprocessor:
#elifdef
runs even if the previous#ifdef
was true.Expected output:
Actual output:
#elifdef
makes the#else
run even if the previous first#ifdef
was true (the#else
doesn't run when it's just a#ifdef
without a#elifdef
).Expected output:
Actual output:
I tried to dig through the code to find where the problem could come from, to no avail, sorry...
Adding an actual preprocessor to GSC is one of the coolest things about this project in my opinion, so I hope this bug report can make it even better!