1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Patch for Victor Mozgin.

Fixed PR 39501 : Parser problems with throw clauses.
Improved filtering of expected failures/inconclusives in TortureTest.
This commit is contained in:
John Camelon 2003-07-03 18:44:40 +00:00
parent 04b6ea96de
commit 77ed10f94c
5 changed files with 118 additions and 35 deletions

View file

@ -1,3 +1,7 @@
2003-07-02 Victor Mozgin
Added DOMTests::testBug39501().
Improved filtering of expected failures/inconclusives in TortureTest.
2003-06-30 John Camelon
Added DOMTests::testAssignmentExpression()
Added PreprocessorConditionalTest to ParserTestSuite.

View file

@ -2195,4 +2195,8 @@ public class DOMTests extends BaseDOMTest {
parse("unsigned char a[sizeof (struct sss)];");
}
public void testBug39501() throws Exception
{
parse("struct A { A() throw (int); };");
}
}

View file

@ -18,7 +18,6 @@ import java.io.StringReader;
import java.io.StringWriter;
import java.util.NoSuchElementException;
import java.util.StringTokenizer;
import junit.framework.AssertionFailedError;
import junit.framework.Test;
@ -89,7 +88,7 @@ public class TortureTest extends FractionalAutomatedTest {
}
} catch (FileNotFoundException e){
testSources.put(resourcePath + "/default", "cpp");
testSources.put(resourcePath, "cpp");
}
if (!isEnabled) testSources.clear();
@ -128,17 +127,82 @@ public class TortureTest extends FractionalAutomatedTest {
}
static protected boolean isExpectedToPass (String testCode)
static protected boolean isExpectedToPass (String testCode, File file)
{
String fileName = file.getName();
// Filter out gcc-specific tests that are not easy to detect automatically
if ( fileName.equals("init-2.c")
|| fileName.equals("init-3.c")
|| fileName.equals("struct-ini-4.c")) {
// gcc-specific (and deprecated) designated initializers
// struct { int e1, e2; } v = { e2: 0 };
return false;
}
if ( fileName.equals("stmtexpr3.C")) {
// statements in expressions
// B() : a(({ 1; })) {}
return false;
}
if ( fileName.equals("widechar-1.c")) {
// concatenation of incompatible literals
// char *s = L"a" "b";
return false;
}
if ( fileName.equals("bf-common.h")
|| fileName.equals("class-tests-1.h")
|| fileName.equals("unclaimed-category-1.h")) {
// ObjectiveC header file
return false;
}
// Process some DejaGNU instructions
if (testCode.indexOf("{ dg-do run") >= 0) return true;
if (testCode.indexOf("{ dg-do link") >= 0) return true;
if (testCode.indexOf("{ dg-error") >= 0) return false;
if (testCode.indexOf("// ERROR") >= 0) return false;
if (testCode.indexOf("- ERROR") >= 0) return false;
if (testCode.indexOf("// XFAIL") >= 0) return false;
if (testCode.indexOf("- XFAIL") >= 0) return false;
if (testCode.indexOf("{ xfail") >= 0) return false;
if (testCode.indexOf("{ dg-preprocess") >= 0) return false;
if (testCode.indexOf("{ dg-do preprocess") >= 0) return false;
// gcc extensions
if (testCode.indexOf("__attribute") >= 0) return false;
if (testCode.indexOf("__extension") >= 0) return false;
if (testCode.indexOf("__restrict") >= 0) return false;
if (testCode.indexOf("__const") >= 0) return false;
if (testCode.indexOf("__declspec") >= 0) return false;
if (testCode.indexOf("__alignof") >= 0) return false;
if (testCode.indexOf("__label") >= 0) return false;
if (testCode.indexOf("__real") >= 0) return false;
if (testCode.indexOf("__imag") >= 0) return false;
if (testCode.indexOf("extern template") >= 0) return false;
if (testCode.indexOf("inline template") >= 0) return false;
if (testCode.indexOf("static template") >= 0) return false;
if (testCode.indexOf("typeof") >= 0) return false;
if (testCode.indexOf(" asm") >= 0) return false;
if (testCode.indexOf(") return") >= 0) return false;
if (testCode.indexOf("#ident") >= 0) return false;
// These are expected errors (not marked in the code)
if (testCode.indexOf("#include_next") >= 0) return false;
// Long long literals are part of ANSI C99
// if (containsLongLongLiterals(testCode)) return false;
if (testCode.indexOf("{ dg-do run") >= 0) return true;
if (testCode.indexOf("{ dg-do link") >= 0) return true;
return true;
}
@ -164,7 +228,7 @@ public class TortureTest extends FractionalAutomatedTest {
String testCode = code.toString();
if (isExpectedToPass(testCode)) {
if (isExpectedToPass(testCode, file)) {
ParseThread thread = new ParseThread();
thread.quickParse = quickParse;

View file

@ -1,3 +1,6 @@
2003-07-02 Victor Mozgin
Fixed PR 39501 : Parser problems with throw clauses.
2003-06-30 John Camelon
Further restructuring of Parser for ISourceElementRequestor.
Added interfaces/implementation for Simple Declarations.

View file

@ -2260,11 +2260,22 @@ public class Parser implements IParser
consume();
done = true;
break;
case IToken.tIDENTIFIER :
case IToken.tCOMMA :
consume();
break;
default :
String image = LA(1).getImage();
try {
duple = typeId();
exceptionSpecIds.add( duple );
try
{
} catch (Backtrack e) {
failParse();
Util.debugLog( "Unexpected Token =" + image );
consume(); // eat this token anyway
continue;
}
try {
callback
.declaratorThrowExceptionName(
declarator);
@ -2273,13 +2284,6 @@ public class Parser implements IParser
{
}
break;
case IToken.tCOMMA :
consume();
break;
default :
Util.debugLog( "Unexpected Token =" + LA(1).getImage() );
failParse();
continue;
}
}
if( exceptionSpecIds != null )
@ -2303,10 +2307,11 @@ public class Parser implements IParser
}
}
if ( ( afterCVModifier != LA(1) || LT(1) == IToken.tSEMI ) && cvModifier != null )
if ( afterCVModifier != LA(1) || LT(1) == IToken.tSEMI )
{
// There were C++-specific clauses after const/volatile modifier
// Then it is a marker for the method
if ( cvModifier != null ) {
try
{
callback.declaratorCVModifier(
@ -2321,6 +2326,9 @@ public class Parser implements IParser
d.setConst( true );
if( cvModifier.getType() == IToken.t_volatile )
d.setVolatile( true );
}
afterCVModifier = mark();
// In this case (method) we can't expect K&R parameter declarations,
// but we'll check anyway, for errorhandling
@ -2328,7 +2336,7 @@ public class Parser implements IParser
else
{
// let's try this modifier as part of K&R parameter declaration
backup(beforeCVModifier);
if (cvModifier != null) backup(beforeCVModifier);
}
if (LT(1) != IToken.tSEMI)