mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 14:55:41 +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:
parent
05fcfa3b2d
commit
87785b3e67
2 changed files with 19 additions and 0 deletions
|
@ -2416,5 +2416,22 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
|
||||||
assertEquals(ip.getSourceLineNumber(), 4);
|
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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2541,8 +2541,10 @@ public class Scanner2 implements IScanner, IScannerData {
|
||||||
case '\r':
|
case '\r':
|
||||||
if (escaped && bufferPos[bufferStackPos] < limit && buffer[bufferPos[bufferStackPos] + 1] == '\n') {
|
if (escaped && bufferPos[bufferStackPos] < limit && buffer[bufferPos[bufferStackPos] + 1] == '\n') {
|
||||||
escaped = false;
|
escaped = false;
|
||||||
|
bufferPos[bufferStackPos]++;
|
||||||
break;
|
break;
|
||||||
} else if (!escaped && bufferPos[bufferStackPos] < limit && buffer[bufferPos[bufferStackPos] + 1] == '\n') {
|
} else if (!escaped && bufferPos[bufferStackPos] < limit && buffer[bufferPos[bufferStackPos] + 1] == '\n') {
|
||||||
|
bufferPos[bufferStackPos]++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue