mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
This commit is contained in:
parent
cc0e391d69
commit
18de33d8a9
2 changed files with 19 additions and 4 deletions
|
@ -1616,4 +1616,12 @@ public class ScannerTestCase extends BaseScannerTest
|
|||
initializeScanner( writer.toString(), ParserMode.QUICK_PARSE, callback );
|
||||
fullyTokenize();
|
||||
}
|
||||
|
||||
public void testBug62009() throws Exception
|
||||
{
|
||||
Callback callback = new Callback( ParserMode.QUICK_PARSE );
|
||||
initializeScanner( "#define def(x) (x#)\ndef(orange)\n", ParserMode.QUICK_PARSE, callback ); //$NON-NLS-1$
|
||||
fullyTokenize();
|
||||
assertFalse( callback.problems.isEmpty() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2654,9 +2654,10 @@ public class Scanner implements IScanner {
|
|||
|
||||
protected List tokenizeReplacementString( int beginning, String key, String replacementString, List parameterIdentifiers )
|
||||
{
|
||||
List macroReplacementTokens = new ArrayList();
|
||||
|
||||
if( replacementString.trim().equals( "" ) ) //$NON-NLS-1$
|
||||
return macroReplacementTokens;
|
||||
return Collections.EMPTY_LIST;
|
||||
List macroReplacementTokens = new ArrayList();
|
||||
IScanner helperScanner=null;
|
||||
try {
|
||||
helperScanner = new Scanner(
|
||||
|
@ -2702,7 +2703,7 @@ public class Scanner implements IScanner {
|
|||
strbuff.append( replacementString );
|
||||
handleProblem( IProblem.PREPROCESSOR_MACRO_PASTING_ERROR, strbuff.toString(),
|
||||
beginning, false, true );
|
||||
return null;
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3097,7 +3098,13 @@ public class Scanner implements IScanner {
|
|||
strbuff.startString();
|
||||
strbuff.append(cache);
|
||||
}
|
||||
t = (SimpleToken) tokens.get( ++i );
|
||||
++i;
|
||||
if( tokens.size() == i ){
|
||||
handleProblem( IProblem.PREPROCESSOR_MACRO_USAGE_ERROR, expansion.getName(), getCurrentOffset(), false, true );
|
||||
return;
|
||||
}
|
||||
|
||||
t = (SimpleToken) tokens.get( i );
|
||||
int index = parameterNames.indexOf(t.getImage());
|
||||
if( index == -1 ){
|
||||
handleProblem( IProblem.PREPROCESSOR_MACRO_USAGE_ERROR, expansion.getName(), getCurrentOffset(), false, true );
|
||||
|
|
Loading…
Add table
Reference in a new issue