1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00
Fixed Bug 39554 : _Pragma directive is not supported (ANSI C99) 

TESTS
	Moved testBug39554() from ASTFailedTests to QuickParseASTTests.
This commit is contained in:
John Camelon 2003-11-07 19:49:36 +00:00
parent abd239ff86
commit df634f2e75
6 changed files with 34 additions and 7 deletions

View file

@ -1,3 +1,6 @@
2003-11-07 John Camelon
Moved testBug39554() from ASTFailedTests to QuickParseASTTests.
2003-11-05 John Camelon
Added CompleteParseASTTest::testBug44838().
Added CompleteParseASTTest::testBug46165().

View file

@ -14,6 +14,7 @@ import java.io.StringWriter;
import java.io.Writer;
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.IASTClassSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTFunction;
@ -35,11 +36,7 @@ public class ASTFailedTests extends BaseASTTest
{
assertCodeFailsParse("FUNCTION_MACRO( 1, a )\n int i;");
}
public void testBug39554() throws Exception
{
assertCodeFailsParse("_Pragma(\"foobar\")");
}
//Here C99-specific section ends
//Here GCC-specific section starts

View file

@ -4,7 +4,6 @@ import java.util.EmptyStackException;
import junit.framework.TestCase;
import org.eclipse.cdt.core.parser.ScannerException;
import org.eclipse.cdt.internal.core.parser.BranchTracker;
/**

View file

@ -804,6 +804,12 @@ public class QuickParseASTTests extends BaseASTTest
parse(code.toString());
}
public void testBug39554() throws Exception
{
parse("_Pragma(\"foobar\")", true, true, ParserLanguage.C );
}
public void testBug36702() throws Exception
{
Writer code = new StringWriter();

View file

@ -1,3 +1,6 @@
2003-11-07 John Camelon
Fixed Bug 39554 : _Pragma directive is not supported (ANSI C99)
2003-11-06 John Camelon
Removed one last remainder of core.model.Util in parser to unbreak 2.0 build.

View file

@ -56,6 +56,7 @@ import org.eclipse.cdt.core.parser.ast.IASTInclusion;
public class Scanner implements IScanner {
protected final IParserLogService log;
private final static String SCRATCH = "<scratch>";
private Reader backupReader;
@ -409,6 +410,7 @@ public class Scanner implements IScanner {
private static final String PASTING = "<pasting>";
private static final String DEFINED = "defined";
private static final String _PRAGMA = "_Pragma";
private static final String POUND_DEFINE = "#define ";
private ContextStack contextStack = null;
@ -792,7 +794,7 @@ public class Scanner implements IScanner {
} else if (
((c >= 'a') && (c <= 'z'))
|| ((c >= 'A') && (c <= 'Z')) | (c == '_')) {
|| ((c >= 'A') && (c <= 'Z')) || (c == '_')) {
int baseOffset = lastContext.getOffset() - lastContext.undoStackSize() - 1;
@ -817,6 +819,13 @@ public class Scanner implements IScanner {
if (ident.equals(DEFINED))
return newToken(IToken.tINTEGER, handleDefinedMacro());
if( ident.equals(_PRAGMA) && language == ParserLanguage.C )
{
handlePragmaOperator();
c = getChar();
continue;
}
Object mapping = definitions.get(ident);
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 wideLiteral
*/