1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 01:36:01 +02:00

Fixed infinite loop (sorry).

This commit is contained in:
John Camelon 2005-04-06 17:16:51 +00:00
parent b3308552a6
commit e4d8025f1e
2 changed files with 34 additions and 1 deletions

View file

@ -306,6 +306,39 @@ public class DOMLocationInclusionTests extends FileBasePluginTest {
macroDefinitions[5],
"blarg.c", c_file_code.indexOf("#define POST_SECOND"), "#define POST_SECOND".length()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
}
public void testBug87894() throws Exception {
StringBuffer fakeBuffer = new StringBuffer( "// windows_fake.h:\n" ); //$NON-NLS-1$
fakeBuffer.append( "#ifdef RC_INVOKED\n" ); //$NON-NLS-1$
fakeBuffer.append( "#define WIN32_LEAN_AND_MEAN\n" ); //$NON-NLS-1$
fakeBuffer.append( "#endif\n" ); //$NON-NLS-1$
fakeBuffer.append( "\n" ); //$NON-NLS-1$
fakeBuffer.append( "#ifndef WIN32_LEAN_AND_MEAN\n" ); //$NON-NLS-1$
fakeBuffer.append( "#include \"rpc_fake.h\"\n" ); //$NON-NLS-1$
fakeBuffer.append( "#endif)\n" ); //$NON-NLS-1$
String windows_fake_h_code = fakeBuffer.toString();
importFile( "windows_fake.h", windows_fake_h_code ); //$NON-NLS-1$
StringBuffer rpcBuffer = new StringBuffer();
rpcBuffer.append( "// rpc_fake.h:\n" ); //$NON-NLS-1$
rpcBuffer.append( "#define RC_INVOKED\n" ); //$NON-NLS-1$
rpcBuffer.append( "\n" ); //$NON-NLS-1$
rpcBuffer.append( "#ifndef RPC_NO_WINDOWS_H\n" ); //$NON-NLS-1$
rpcBuffer.append( "#include \"windows_fake.h\"\n" ); //$NON-NLS-1$
rpcBuffer.append( "#endif\n" ); //$NON-NLS-1$
String rpc_fake_h_code = rpcBuffer.toString();
importFile( "rpc_fake.h", rpc_fake_h_code ); //$NON-NLS-1$
String test_c_code = "// test.c:\n#include \"windows_fake.h\"\n // endOffset is 64 but should be more like 266"; //$NON-NLS-1$
IFile f = importFile( "test.c", test_c_code ); //$NON-NLS-1$
for (ParserLanguage p = ParserLanguage.C; p != null; p = (p == ParserLanguage.C) ? ParserLanguage.CPP
: null) {
IASTTranslationUnit tu = parse(f, p); //$NON-NLS-1$
}
}
public static Test suite() {

View file

@ -2202,7 +2202,7 @@ public class LocationMap implements ILocationResolver, IScannerPreprocessorLog {
foundContext = tempContext;
break;
}
foundContext = findInclusion(context, path);
foundContext = findInclusion(tempContext, path);
}
}