1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-03 22:35:43 +02:00

Patch for Devin Steffler

Fixed 77276 - Preprocessor problem - Multi line #if are not accepted
	Fixed 77097 - Preprocessor problem - Multi line #defines are not accepted
This commit is contained in:
John Camelon 2004-11-19 16:05:43 +00:00
parent 05fcfa3b2d
commit 87785b3e67
2 changed files with 19 additions and 0 deletions

View file

@ -2416,5 +2416,22 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
assertEquals(ip.getSourceLineNumber(), 4);
}
}
public void testBug77097() throws Exception {
Writer writer = new StringWriter();
writer.write("#define SOME_MACRO() { \\\r\n"); //$NON-NLS-1$
writer.write("printf(\"Hello World\"); \\\r\n"); //$NON-NLS-1$
writer.write("printf(\"Good morning\"); \\\r\n"); //$NON-NLS-1$
parse(writer.toString());
}
public void testBug77276() throws Exception {
Writer writer = new StringWriter();
writer.write("#if (!defined(OS_LIBMODE_R) && !defined(OS_LIBMODE_RP) && \\\r\n"); //$NON-NLS-1$
writer.write("!defined(OS_LIBMODE_T))\r\n"); //$NON-NLS-1$
writer.write("#define OS_LIBMODE_DP\r\n"); //$NON-NLS-1$
writer.write("#endif\r\n"); //$NON-NLS-1$
parse(writer.toString());
}
}

View file

@ -2541,8 +2541,10 @@ public class Scanner2 implements IScanner, IScannerData {
case '\r':
if (escaped && bufferPos[bufferStackPos] < limit && buffer[bufferPos[bufferStackPos] + 1] == '\n') {
escaped = false;
bufferPos[bufferStackPos]++;
break;
} else if (!escaped && bufferPos[bufferStackPos] < limit && buffer[bufferPos[bufferStackPos] + 1] == '\n') {
bufferPos[bufferStackPos]++;
return;
}
break;