1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Handles 'true' and 'false' in expression evaluator, bug 246369.

This commit is contained in:
Markus Schorn 2008-09-08 08:06:20 +00:00
parent 6184a53e92
commit 8d99a621b3
2 changed files with 24 additions and 0 deletions

View file

@ -131,4 +131,22 @@ public class PreprocessorBugsTests extends PreprocessorTestsBase {
validateEOF();
validateProblemCount(2);
}
// #if true
// yes
// #else
// no
// #endif
// #if false
// no
// #else
// yes
// #endif
public void testTrueInConditionalExpression_Bug246369() throws Exception {
initializeScanner();
validateIdentifier("yes");
validateIdentifier("yes");
validateEOF();
validateProblemCount(0);
}
}

View file

@ -238,6 +238,12 @@ class ExpressionEvaluator {
long val= getValue(fTokens);
consume();
return val;
case IToken.t_true:
consume();
return 1;
case IToken.t_false:
consume();
return 0;
case CPreprocessor.tDEFINED:
return handleDefined();
case IToken.tLPAREN: