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:
parent
13c3948164
commit
4490af21a1
2 changed files with 21 additions and 2 deletions
|
@ -2666,7 +2666,7 @@ public class Scanner2Test extends BaseScanner2Test
|
|||
validateChar( "s" );
|
||||
}
|
||||
|
||||
public void testBug185120() throws Exception {
|
||||
public void testBug185120_1() throws Exception {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("#define TEST_DEFINE 1UL\n");
|
||||
buffer.append("#if TEST_DEFINE != 1UL\n");
|
||||
|
@ -2677,4 +2677,16 @@ public class Scanner2Test extends BaseScanner2Test
|
|||
initializeScanner( buffer.toString() );
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -622,7 +622,14 @@ public class ExpressionEvaluator {
|
|||
if (pos < limit) {
|
||||
c= buffer[pos];
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue