1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-11 02:05:39 +02:00

Follow up for 185120, gcc-extension allows constants with suffix 'ull'.

This commit is contained in:
Markus Schorn 2007-08-23 13:31:06 +00:00
parent 13c3948164
commit 4490af21a1
2 changed files with 21 additions and 2 deletions

View file

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

View file

@ -622,7 +622,14 @@ public class ExpressionEvaluator {
if (pos < limit) { if (pos < limit) {
c= buffer[pos]; c= buffer[pos];
if (c == 'L' || c == 'l' || c == 'U' || c == 'u') { if (c == 'L' || c == 'l' || c == 'U' || c == 'u') {
++bufferPos[bufferStackPos]; pos= ++bufferPos[bufferStackPos];
// gcc-extension: allow ULL for unsigned long long literals
if (pos < limit) {
c= buffer[pos];
if (c == 'L' || c == 'l' || c == 'U' || c == 'u') {
pos= ++bufferPos[bufferStackPos];
}
}
} }
} }
} }