mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
ASSIGNED - bug 173110: C99 parser contribution
https://bugs.eclipse.org/bugs/show_bug.cgi?id=173110 Initial contribution by Mike Kucera
This commit is contained in:
parent
b84f87ee1a
commit
87cc279731
28 changed files with 209 additions and 11 deletions
|
@ -94,7 +94,14 @@ public class FileBasePluginTest extends TestCase {
|
|||
static Class className;
|
||||
static ICProject cPrj;
|
||||
|
||||
private void initialize(Class aClassName){
|
||||
public FileBasePluginTest() {
|
||||
}
|
||||
|
||||
public FileBasePluginTest(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
private void initialize(Class aClassName){
|
||||
if( CCorePlugin.getDefault() != null && CCorePlugin.getDefault().getCoreModel() != null){
|
||||
//(CCorePlugin.getDefault().getCoreModel().getIndexManager()).reset();
|
||||
monitor = new NullProgressMonitor();
|
||||
|
|
|
@ -77,6 +77,14 @@ public class AST2BaseTest extends BaseTestCase {
|
|||
|
||||
private static final IParserLogService NULL_LOG = new NullLogService();
|
||||
|
||||
public AST2BaseTest() {
|
||||
super();
|
||||
}
|
||||
|
||||
public AST2BaseTest(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
protected IASTTranslationUnit parse( String code, ParserLanguage lang ) throws ParserException {
|
||||
return parse(code, lang, false, true );
|
||||
}
|
||||
|
|
|
@ -21,6 +21,15 @@ import org.eclipse.cdt.core.parser.ParserLanguage;
|
|||
*/
|
||||
public class AST2CPPSpecFailingTest extends AST2SpecBaseTest {
|
||||
|
||||
|
||||
|
||||
public AST2CPPSpecFailingTest() {
|
||||
}
|
||||
|
||||
public AST2CPPSpecFailingTest(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
[--Start Example(CPP 2.3-2):
|
||||
??=define arraycheck(a,b) a??(b??) ??!??! b??(a??)
|
||||
|
|
|
@ -18,6 +18,13 @@ import org.eclipse.cdt.internal.core.parser.ParserException;
|
|||
*/
|
||||
public class AST2CPPSpecTest extends AST2SpecBaseTest {
|
||||
|
||||
public AST2CPPSpecTest() {
|
||||
}
|
||||
|
||||
public AST2CPPSpecTest(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Note: Each example should have the example in a comment before
|
||||
* the tested method with the following format:
|
||||
|
@ -38,6 +45,8 @@ public class AST2CPPSpecTest extends AST2SpecBaseTest {
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
[--Start Example(CPP 2.4-5):
|
||||
int x=x+++++y;
|
||||
|
|
|
@ -107,7 +107,14 @@ import org.eclipse.cdt.internal.core.parser.ParserException;
|
|||
public class AST2CPPTests extends AST2BaseTest {
|
||||
|
||||
|
||||
public void testBug102825() throws Exception {
|
||||
public AST2CPPTests() {
|
||||
}
|
||||
|
||||
public AST2CPPTests(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public void testBug102825() throws Exception {
|
||||
StringBuffer buffer = new StringBuffer("#define CURLOPTTYPE_OBJECTPOINT 10000\n" ); //$NON-NLS-1$
|
||||
buffer.append("#define CINIT(name,type,number) CURLOPT_ ## name = CURLOPTTYPE_ ## type + number\n" ); //$NON-NLS-1$
|
||||
buffer.append("typedef enum {\n" ); //$NON-NLS-1$
|
||||
|
|
|
@ -17,6 +17,13 @@ import org.eclipse.cdt.core.parser.ParserLanguage;
|
|||
*/
|
||||
public class AST2CSpecFailingTest extends AST2SpecBaseTest {
|
||||
|
||||
public AST2CSpecFailingTest() {
|
||||
}
|
||||
|
||||
public AST2CSpecFailingTest(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
[--Start Example(C 6.7.7-6):
|
||||
typedef signed int t;
|
||||
|
|
|
@ -17,6 +17,13 @@ import org.eclipse.cdt.core.parser.ParserLanguage;
|
|||
*/
|
||||
public class AST2CSpecTest extends AST2SpecBaseTest {
|
||||
|
||||
public AST2CSpecTest() {
|
||||
}
|
||||
|
||||
public AST2CSpecTest(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
[--Start Example(C 4-6):
|
||||
#ifdef _ _STDC_IEC_559_ _ // FE_UPWARD defined
|
||||
|
|
|
@ -48,7 +48,14 @@ public class AST2FileBasePluginTest extends TestCase {
|
|||
static Class className;
|
||||
static ICProject cPrj;
|
||||
|
||||
private void initialize(Class aClassName){
|
||||
public AST2FileBasePluginTest() {
|
||||
}
|
||||
|
||||
public AST2FileBasePluginTest(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
private void initialize(Class aClassName){
|
||||
if( CCorePlugin.getDefault() != null && CCorePlugin.getDefault().getCoreModel() != null){
|
||||
//(CCorePlugin.getDefault().getCoreModel().getIndexManager()).reset();
|
||||
monitor = new NullProgressMonitor();
|
||||
|
|
|
@ -55,7 +55,15 @@ import org.eclipse.cdt.internal.core.dom.parser.c.ICInternalBinding;
|
|||
* @author dsteffle
|
||||
*/
|
||||
public class AST2KnRTests extends AST2BaseTest {
|
||||
public void testSimpleKRCTest1() throws Exception {
|
||||
|
||||
public AST2KnRTests() {
|
||||
}
|
||||
|
||||
public AST2KnRTests(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public void testSimpleKRCTest1() throws Exception {
|
||||
StringBuffer buffer = new StringBuffer(); //$NON-NLS-1$
|
||||
buffer.append( "int f(char x);\n" ); //$NON-NLS-1$
|
||||
buffer.append( "int f(x) char x;\n" ); //$NON-NLS-1$
|
||||
|
|
|
@ -46,7 +46,14 @@ import org.eclipse.core.resources.IFile;
|
|||
*/
|
||||
public class AST2SelectionParseBaseTest extends FileBasePluginTest {
|
||||
|
||||
private static final IParserLogService NULL_LOG = new NullLogService();
|
||||
public AST2SelectionParseBaseTest() {
|
||||
}
|
||||
|
||||
public AST2SelectionParseBaseTest(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
private static final IParserLogService NULL_LOG = new NullLogService();
|
||||
|
||||
public AST2SelectionParseBaseTest(String name, Class className) {
|
||||
super(name, className);
|
||||
|
|
|
@ -48,6 +48,13 @@ import org.eclipse.core.resources.IFile;
|
|||
*/
|
||||
public class AST2SelectionParseTest extends AST2SelectionParseBaseTest {
|
||||
|
||||
public AST2SelectionParseTest() {
|
||||
}
|
||||
|
||||
public AST2SelectionParseTest(String name, Class className) {
|
||||
super(name, className);
|
||||
}
|
||||
|
||||
public AST2SelectionParseTest(String name) {
|
||||
super(name, AST2SelectionParseTest.class);
|
||||
}
|
||||
|
|
|
@ -52,6 +52,14 @@ import junit.framework.TestCase;
|
|||
public class AST2SpecBaseTest extends TestCase {
|
||||
private static final IParserLogService NULL_LOG = new NullLogService();
|
||||
|
||||
public AST2SpecBaseTest() {
|
||||
super();
|
||||
}
|
||||
|
||||
public AST2SpecBaseTest(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* checkSemantics is used to specify whether the example should have semantics checked
|
||||
* since several spec examples have syntactically correct code ONLY this flag was added
|
||||
|
|
|
@ -61,6 +61,13 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVisitor;
|
|||
*/
|
||||
public class AST2TemplateTests extends AST2BaseTest {
|
||||
|
||||
public AST2TemplateTests() {
|
||||
}
|
||||
|
||||
public AST2TemplateTests(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public void testBasicClassTemplate() throws Exception {
|
||||
IASTTranslationUnit tu = parse( "template <class T> class A{ T t; };", ParserLanguage.CPP ); //$NON-NLS-1$
|
||||
CPPNameCollector col = new CPPNameCollector();
|
||||
|
|
|
@ -101,6 +101,15 @@ public class AST2Tests extends AST2BaseTest {
|
|||
return suite(AST2Tests.class);
|
||||
}
|
||||
|
||||
public AST2Tests() {
|
||||
super();
|
||||
}
|
||||
|
||||
public AST2Tests(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
||||
public void testBug75189() throws Exception {
|
||||
parseAndCheckBindings( "struct A{};typedef int (*F) (A*);" ); //$NON-NLS-1$
|
||||
}
|
||||
|
|
|
@ -18,6 +18,11 @@ import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
|||
import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||
|
||||
public class AST2UtilOldTests extends AST2BaseTest {
|
||||
public AST2UtilOldTests() {
|
||||
}
|
||||
public AST2UtilOldTests(String name) {
|
||||
super(name);
|
||||
}
|
||||
// Kind PRIMARY_EMPTY : void
|
||||
public void testPrimaryEmpty() throws Exception
|
||||
{
|
||||
|
|
|
@ -27,6 +27,13 @@ import org.eclipse.cdt.core.parser.ParserLanguage;
|
|||
* @author dsteffle
|
||||
*/
|
||||
public class AST2UtilTests extends AST2BaseTest {
|
||||
public AST2UtilTests() {
|
||||
}
|
||||
|
||||
public AST2UtilTests(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public void testSimpleSignature() throws Exception {
|
||||
StringBuffer buff = new StringBuffer();
|
||||
buff.append("int l, m, n=0;\n"); //$NON-NLS-1$
|
||||
|
|
|
@ -21,6 +21,13 @@ import org.eclipse.core.resources.IFile;
|
|||
*/
|
||||
public class CDOMBaseTest extends FileBasePluginTest {
|
||||
|
||||
public CDOMBaseTest() {
|
||||
}
|
||||
|
||||
public CDOMBaseTest(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public CDOMBaseTest(String name, Class className) {
|
||||
super(name, className);
|
||||
}
|
||||
|
|
|
@ -28,6 +28,13 @@ import org.eclipse.core.runtime.jobs.Job;
|
|||
*/
|
||||
public class CodeReaderCacheTest extends CDOMBaseTest {
|
||||
|
||||
public CodeReaderCacheTest() {
|
||||
}
|
||||
|
||||
public CodeReaderCacheTest(String name, Class className) {
|
||||
super(name, className);
|
||||
}
|
||||
|
||||
public CodeReaderCacheTest(String name) {
|
||||
super(name, CodeReaderCacheTest.class);
|
||||
}
|
||||
|
|
|
@ -94,7 +94,13 @@ public class CompleteParser2Tests extends TestCase {
|
|||
|
||||
private static final NullLogService NULL_LOG = new NullLogService();
|
||||
|
||||
static private class CPPNameCollector extends CPPASTVisitor {
|
||||
public CompleteParser2Tests() {
|
||||
}
|
||||
public CompleteParser2Tests(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
static private class CPPNameCollector extends CPPASTVisitor {
|
||||
{
|
||||
shouldVisitNames = true;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,14 @@ public class DOMFileBasePluginTest extends TestCase {
|
|||
static Class className;
|
||||
static ICProject cPrj;
|
||||
|
||||
private void initialize(Class aClassName) {
|
||||
public DOMFileBasePluginTest() {
|
||||
}
|
||||
|
||||
public DOMFileBasePluginTest(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
private void initialize(Class aClassName) {
|
||||
if( CCorePlugin.getDefault() != null && CCorePlugin.getDefault().getCoreModel() != null){
|
||||
//(CCorePlugin.getDefault().getCoreModel().getIndexManager()).reset();
|
||||
monitor = new NullProgressMonitor();
|
||||
|
|
|
@ -21,6 +21,13 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
|
|||
*/
|
||||
public class DOMGCCSelectionParseExtensionsTest extends DOMSelectionParseBaseTest {
|
||||
|
||||
public DOMGCCSelectionParseExtensionsTest() {
|
||||
}
|
||||
|
||||
public DOMGCCSelectionParseExtensionsTest(String name, Class className) {
|
||||
super(name, className);
|
||||
}
|
||||
|
||||
public DOMGCCSelectionParseExtensionsTest(String name) {
|
||||
super(name, DOMGCCSelectionParseExtensionsTest.class);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,14 @@ import org.eclipse.core.runtime.content.IContentType;
|
|||
*/
|
||||
public class DOMLocationInclusionTests extends AST2FileBasePluginTest {
|
||||
|
||||
public void testBug97967() throws Exception {
|
||||
public DOMLocationInclusionTests() {
|
||||
}
|
||||
|
||||
public DOMLocationInclusionTests(String name, Class className) {
|
||||
super(name, className);
|
||||
}
|
||||
|
||||
public void testBug97967() throws Exception {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("#ifndef _INCLUDE_H_\n"); //$NON-NLS-1$
|
||||
buffer.append("#define _INCLUDE_H_\n"); //$NON-NLS-1$
|
||||
|
|
|
@ -31,7 +31,14 @@ import org.eclipse.cdt.internal.core.parser.ParserException;
|
|||
|
||||
public class DOMLocationMacroTests extends AST2BaseTest {
|
||||
|
||||
public void testObjectStyleMacroExpansionSimpleDeclarator() throws Exception
|
||||
public DOMLocationMacroTests() {
|
||||
}
|
||||
|
||||
public DOMLocationMacroTests(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public void testObjectStyleMacroExpansionSimpleDeclarator() throws Exception
|
||||
{
|
||||
StringBuffer buffer = new StringBuffer( "#define ABC D\n" ); //$NON-NLS-1$
|
||||
buffer.append( "int ABC;"); //$NON-NLS-1$
|
||||
|
|
|
@ -63,7 +63,10 @@ import org.eclipse.cdt.internal.core.parser.ParserException;
|
|||
*/
|
||||
public class DOMLocationTests extends AST2BaseTest {
|
||||
|
||||
private static final String _TEXT_ = "<text>"; //$NON-NLS-1$
|
||||
public DOMLocationTests() {
|
||||
}
|
||||
|
||||
private static final String _TEXT_ = "<text>"; //$NON-NLS-1$
|
||||
|
||||
public DOMLocationTests(String name) {
|
||||
setName(name);
|
||||
|
|
|
@ -25,6 +25,13 @@ import org.eclipse.core.resources.IFile;
|
|||
*/
|
||||
public class DOMSelectionParseBaseTest extends DOMFileBasePluginTest {
|
||||
|
||||
public DOMSelectionParseBaseTest() {
|
||||
}
|
||||
|
||||
public DOMSelectionParseBaseTest(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public DOMSelectionParseBaseTest(String name, Class className) {
|
||||
super(name, className);
|
||||
}
|
||||
|
|
|
@ -43,6 +43,13 @@ import org.eclipse.core.resources.IFile;
|
|||
*/
|
||||
public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
||||
|
||||
public DOMSelectionParseTest() {
|
||||
}
|
||||
|
||||
public DOMSelectionParseTest(String name, Class className) {
|
||||
super(name, className);
|
||||
}
|
||||
|
||||
public DOMSelectionParseTest(String name) {
|
||||
super(name, DOMSelectionParseTest.class);
|
||||
}
|
||||
|
|
|
@ -35,6 +35,13 @@ import org.eclipse.cdt.internal.core.parser.ParserException;
|
|||
*/
|
||||
public class GCCCompleteParseExtensionsTest extends AST2BaseTest {
|
||||
|
||||
public GCCCompleteParseExtensionsTest() {
|
||||
}
|
||||
|
||||
public GCCCompleteParseExtensionsTest(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
private IASTTranslationUnit parseGCC(String code) throws ParserException {
|
||||
IASTTranslationUnit tu = parse(code, ParserLanguage.C, true, true);
|
||||
|
||||
|
|
|
@ -31,7 +31,14 @@ import org.eclipse.cdt.core.parser.ParserLanguage;
|
|||
*/
|
||||
public class GCCTests extends AST2BaseTest {
|
||||
|
||||
public void testGCC20000113() throws Exception {
|
||||
public GCCTests() {
|
||||
}
|
||||
|
||||
public GCCTests(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public void testGCC20000113() throws Exception {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append( "struct x { \n" ); //$NON-NLS-1$
|
||||
buffer.append( " unsigned x1:1; \n" ); //$NON-NLS-1$
|
||||
|
|
Loading…
Add table
Reference in a new issue