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 2003-06-30 John Camelon
Added DOMTests::testAssignmentExpression() Added DOMTests::testAssignmentExpression()
Added PreprocessorConditionalTest to ParserTestSuite. Added PreprocessorConditionalTest to ParserTestSuite.

View file

@ -2195,4 +2195,8 @@ public class DOMTests extends BaseDOMTest {
parse("unsigned char a[sizeof (struct sss)];"); 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.io.StringWriter;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import junit.framework.AssertionFailedError; import junit.framework.AssertionFailedError;
import junit.framework.Test; import junit.framework.Test;
@ -89,7 +88,7 @@ public class TortureTest extends FractionalAutomatedTest {
} }
} catch (FileNotFoundException e){ } catch (FileNotFoundException e){
testSources.put(resourcePath + "/default", "cpp"); testSources.put(resourcePath, "cpp");
} }
if (!isEnabled) testSources.clear(); if (!isEnabled) testSources.clear();
@ -126,19 +125,84 @@ public class TortureTest extends FractionalAutomatedTest {
fail(output); fail(output);
} }
static protected boolean isExpectedToPass (String testCode, File file)
static protected boolean isExpectedToPass (String testCode) {
{ 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 // 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("{ dg-error") >= 0) return false;
if (testCode.indexOf("// ERROR") >= 0) return false; if (testCode.indexOf("// 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("{ xfail") >= 0) return false; if (testCode.indexOf("{ xfail") >= 0) return false;
if (testCode.indexOf("{ dg-preprocess") >= 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; return true;
} }
@ -164,7 +228,7 @@ public class TortureTest extends FractionalAutomatedTest {
String testCode = code.toString(); String testCode = code.toString();
if (isExpectedToPass(testCode)) { if (isExpectedToPass(testCode, file)) {
ParseThread thread = new ParseThread(); ParseThread thread = new ParseThread();
thread.quickParse = quickParse; 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 2003-06-30 John Camelon
Further restructuring of Parser for ISourceElementRequestor. Further restructuring of Parser for ISourceElementRequestor.
Added interfaces/implementation for Simple Declarations. Added interfaces/implementation for Simple Declarations.

View file

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