1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-03 14:25:37 +02:00

Fixed Bug 70928 [Parser] Indexer complains about __cdecl

This commit is contained in:
John Camelon 2004-08-10 19:52:20 +00:00
parent ceae352fbd
commit 791e958905
3 changed files with 14 additions and 17 deletions

View file

@ -151,20 +151,6 @@ public class FailedCompleteParseASTTest extends CompleteParseBaseTest
}
// Iterator i = parse("typedef unsigned char byte; \n").getDeclarations();;//$NON-NLS-1$
// IASTTypedefDeclaration td = (IASTTypedefDeclaration) i.next();
// assertFalse(i.hasNext());
}
public void testPredefinedSymbol_bug70928() throws Exception {
// GNU builtin storage class type __cdecl preceded by a custom return type
try {
parse("typedef int size_t; \n size_t __cdecl foo(); \n");//$NON-NLS-1$
fail();
} catch ( ParserException e ){
assertTrue( e.getMessage().equals( "FAILURE" ) ); //$NON-NLS-1$
}
// Iterator i = parse("typedef int size_t; \n int __cdecl foo(); \n").getDeclarations();//$NON-NLS-1$
// IASTTypedefDeclaration td = (IASTTypedefDeclaration) i.next();
// IASTFunction fd = (IASTFunction) i.next();
// assertFalse(i.hasNext());
}

View file

@ -2075,4 +2075,13 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
assertTrue( i.next() instanceof IASTAbstractTypeSpecifierDeclaration );
assertFalse( i.hasNext() );
}
public void testPredefinedSymbol_bug70928() throws Exception {
// GNU builtin storage class type __cdecl preceded by a custom return type
Iterator i = parse("typedef int size_t; \n int __cdecl foo(); \n").getDeclarations();//$NON-NLS-1$
IASTTypedefDeclaration td = (IASTTypedefDeclaration) i.next();
IASTFunction fd = (IASTFunction) i.next();
assertFalse(i.hasNext());
}
}

View file

@ -1887,9 +1887,8 @@ public class Scanner2 implements IScanner, IScannerData {
if( buffer[ bufferPos[bufferStackPos] + 1] != '#' ){
--bufferPos[bufferStackPos];
return false;
} else {
++bufferPos[ bufferStackPos ];
}
}
++bufferPos[ bufferStackPos ];
}
break;
}
@ -2472,6 +2471,8 @@ public class Scanner2 implements IScanner, IScannerData {
= new ObjectStyleMacro("__const".toCharArray(), "const".toCharArray()); //$NON-NLS-1$ //$NON-NLS-2$
private static final ObjectStyleMacro __signed__
= new ObjectStyleMacro("__signed__".toCharArray(), "signed".toCharArray()); //$NON-NLS-1$ //$NON-NLS-2$
private static final ObjectStyleMacro __cdecl = new
ObjectStyleMacro( "__cdecl".toCharArray(), emptyCharArray ); //$NON-NLS-1$
private static final FunctionStyleMacro __attribute__
= new FunctionStyleMacro(
@ -2501,6 +2502,7 @@ public class Scanner2 implements IScanner, IScannerData {
// gcc extensions
definitions.put(__inline__.name, __inline__);
definitions.put(__cdecl.name, __cdecl );
definitions.put( __const__.name, __const__ );
definitions.put( __const.name, __const );
definitions.put(__extension__.name, __extension__);