mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
CORE
Fixed Bug 39554 : _Pragma directive is not supported (ANSI C99) TESTS Moved testBug39554() from ASTFailedTests to QuickParseASTTests.
This commit is contained in:
parent
abd239ff86
commit
df634f2e75
6 changed files with 34 additions and 7 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
2003-11-07 John Camelon
|
||||||
|
Moved testBug39554() from ASTFailedTests to QuickParseASTTests.
|
||||||
|
|
||||||
2003-11-05 John Camelon
|
2003-11-05 John Camelon
|
||||||
Added CompleteParseASTTest::testBug44838().
|
Added CompleteParseASTTest::testBug44838().
|
||||||
Added CompleteParseASTTest::testBug46165().
|
Added CompleteParseASTTest::testBug46165().
|
||||||
|
|
|
@ -14,6 +14,7 @@ import java.io.StringWriter;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration;
|
import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTFunction;
|
import org.eclipse.cdt.core.parser.ast.IASTFunction;
|
||||||
|
@ -36,10 +37,6 @@ public class ASTFailedTests extends BaseASTTest
|
||||||
assertCodeFailsParse("FUNCTION_MACRO( 1, a )\n int i;");
|
assertCodeFailsParse("FUNCTION_MACRO( 1, a )\n int i;");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBug39554() throws Exception
|
|
||||||
{
|
|
||||||
assertCodeFailsParse("_Pragma(\"foobar\")");
|
|
||||||
}
|
|
||||||
|
|
||||||
//Here C99-specific section ends
|
//Here C99-specific section ends
|
||||||
//Here GCC-specific section starts
|
//Here GCC-specific section starts
|
||||||
|
|
|
@ -4,7 +4,6 @@ import java.util.EmptyStackException;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.parser.ScannerException;
|
|
||||||
import org.eclipse.cdt.internal.core.parser.BranchTracker;
|
import org.eclipse.cdt.internal.core.parser.BranchTracker;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -804,6 +804,12 @@ public class QuickParseASTTests extends BaseASTTest
|
||||||
parse(code.toString());
|
parse(code.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void testBug39554() throws Exception
|
||||||
|
{
|
||||||
|
parse("_Pragma(\"foobar\")", true, true, ParserLanguage.C );
|
||||||
|
}
|
||||||
|
|
||||||
public void testBug36702() throws Exception
|
public void testBug36702() throws Exception
|
||||||
{
|
{
|
||||||
Writer code = new StringWriter();
|
Writer code = new StringWriter();
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
2003-11-07 John Camelon
|
||||||
|
Fixed Bug 39554 : _Pragma directive is not supported (ANSI C99)
|
||||||
|
|
||||||
2003-11-06 John Camelon
|
2003-11-06 John Camelon
|
||||||
Removed one last remainder of core.model.Util in parser to unbreak 2.0 build.
|
Removed one last remainder of core.model.Util in parser to unbreak 2.0 build.
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ import org.eclipse.cdt.core.parser.ast.IASTInclusion;
|
||||||
|
|
||||||
public class Scanner implements IScanner {
|
public class Scanner implements IScanner {
|
||||||
|
|
||||||
|
|
||||||
protected final IParserLogService log;
|
protected final IParserLogService log;
|
||||||
private final static String SCRATCH = "<scratch>";
|
private final static String SCRATCH = "<scratch>";
|
||||||
private Reader backupReader;
|
private Reader backupReader;
|
||||||
|
@ -409,6 +410,7 @@ public class Scanner implements IScanner {
|
||||||
private static final String PASTING = "<pasting>";
|
private static final String PASTING = "<pasting>";
|
||||||
|
|
||||||
private static final String DEFINED = "defined";
|
private static final String DEFINED = "defined";
|
||||||
|
private static final String _PRAGMA = "_Pragma";
|
||||||
private static final String POUND_DEFINE = "#define ";
|
private static final String POUND_DEFINE = "#define ";
|
||||||
|
|
||||||
private ContextStack contextStack = null;
|
private ContextStack contextStack = null;
|
||||||
|
@ -792,7 +794,7 @@ public class Scanner implements IScanner {
|
||||||
|
|
||||||
} else if (
|
} else if (
|
||||||
((c >= 'a') && (c <= 'z'))
|
((c >= 'a') && (c <= 'z'))
|
||||||
|| ((c >= 'A') && (c <= 'Z')) | (c == '_')) {
|
|| ((c >= 'A') && (c <= 'Z')) || (c == '_')) {
|
||||||
|
|
||||||
int baseOffset = lastContext.getOffset() - lastContext.undoStackSize() - 1;
|
int baseOffset = lastContext.getOffset() - lastContext.undoStackSize() - 1;
|
||||||
|
|
||||||
|
@ -817,6 +819,13 @@ public class Scanner implements IScanner {
|
||||||
if (ident.equals(DEFINED))
|
if (ident.equals(DEFINED))
|
||||||
return newToken(IToken.tINTEGER, handleDefinedMacro());
|
return newToken(IToken.tINTEGER, handleDefinedMacro());
|
||||||
|
|
||||||
|
if( ident.equals(_PRAGMA) && language == ParserLanguage.C )
|
||||||
|
{
|
||||||
|
handlePragmaOperator();
|
||||||
|
c = getChar();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Object mapping = definitions.get(ident);
|
Object mapping = definitions.get(ident);
|
||||||
|
|
||||||
if (mapping != null) {
|
if (mapping != null) {
|
||||||
|
@ -1580,6 +1589,16 @@ public class Scanner implements IScanner {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
protected void handlePragmaOperator() throws ScannerException
|
||||||
|
{
|
||||||
|
// until we know what to do with pragmas, do the equivalent as
|
||||||
|
// to what we do for #pragma blah blah blah (ignore it)
|
||||||
|
getRestOfPreprocessorLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* @param c
|
* @param c
|
||||||
* @param wideLiteral
|
* @param wideLiteral
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue