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

Fix and Testcase for 185120, handling of constants with suffix 'ul'.

This commit is contained in:
Markus Schorn 2007-08-23 12:35:17 +00:00
parent d6ce933a26
commit 13c3948164
2 changed files with 19 additions and 1 deletions

View file

@ -2665,4 +2665,16 @@ public class Scanner2Test extends BaseScanner2Test
validateToken( IToken.tRPAREN ); validateToken( IToken.tRPAREN );
validateChar( "s" ); validateChar( "s" );
} }
public void testBug185120() throws Exception {
StringBuffer buffer = new StringBuffer();
buffer.append("#define TEST_DEFINE 1UL\n");
buffer.append("#if TEST_DEFINE != 1UL\n");
buffer.append("-\n");
buffer.append("#else\n");
buffer.append("+\n");
buffer.append("#endif\n");
initializeScanner( buffer.toString() );
validateToken( IToken.tPLUS );
}
} }

View file

@ -618,7 +618,13 @@ public class ExpressionEvaluator {
// end of number // end of number
if (c == 'L' || c == 'l' || c == 'U' || c == 'u') { if (c == 'L' || c == 'l' || c == 'U' || c == 'u') {
// eat the long/unsigned // eat the long/unsigned
++bufferPos[bufferStackPos]; int pos= ++bufferPos[bufferStackPos];
if (pos < limit) {
c= buffer[pos];
if (c == 'L' || c == 'l' || c == 'U' || c == 'u') {
++bufferPos[bufferStackPos];
}
}
} }
// done // done