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

Fixed Bug 56517 - Preprocessor skipping doesn't ignore the contents of string literals.

This commit is contained in:
John Camelon 2004-03-29 20:56:02 +00:00
parent d6b510d200
commit 13b3c99749
4 changed files with 25 additions and 4 deletions

View file

@ -1,3 +1,6 @@
2004-03-29 John Camelon
Added ScannerTestCase::testBug56517().
2004-03-28 John Camelon 2004-03-28 John Camelon
Removed ScannerTestCase::testGerman() until we can figure out how to make it portable. Removed ScannerTestCase::testGerman() until we can figure out how to make it portable.

View file

@ -1579,4 +1579,21 @@ public class ScannerTestCase extends BaseScannerTest
validateEOF(); validateEOF();
} }
public void testBug56517() throws Exception
{
Writer writer = new StringWriter();
writer.write( "#if 0 \n");
writer.write( "char * x = \"#boo\";\n" );
writer.write( "#endif\n");
initializeScanner( writer.toString() );
validateEOF();
// validateToken( IToken.t_char);
// validateToken( IToken.tSTAR);
// validateIdentifier( "x");
// validateToken( IToken.tASSIGN );
// validateString( "#boo");
// validateToken(IToken.tSEMI);
// validateEOF();
}
} }

View file

@ -1,3 +1,6 @@
2004-03-29 John Camelon
Fixed Bug 56517 - Preprocessor skipping doesn't ignore the contents of string literals.
2004-03-28 John Camelon 2004-03-28 John Camelon
Remove warnings. Remove warnings.

View file

@ -1215,9 +1215,8 @@ public class Scanner implements IScanner {
scannerExtension.handlePreprocessorDirective( token, getRestOfPreprocessorLine() ); scannerExtension.handlePreprocessorDirective( token, getRestOfPreprocessorLine() );
else else
{ {
StringBuffer buffer = new StringBuffer( "#"); //$NON-NLS-1$ if( passOnToClient )
buffer.append( token ); handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, token, beginningOffset, false, true );
handleProblem( IProblem.PREPROCESSOR_INVALID_DIRECTIVE, buffer.toString(), beginningOffset, false, true );
} }
return null; return null;
} }
@ -1510,7 +1509,6 @@ public class Scanner implements IScanner {
while (c != NOCHAR) { while (c != NOCHAR) {
if ( ! passOnToClient ) { if ( ! passOnToClient ) {
while (c != NOCHAR && c != '#' ) while (c != NOCHAR && c != '#' )
{ {
c = getChar(); c = getChar();