diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecFailingTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecFailingTest.java index b96f0b4a302..493e557918a 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecFailingTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecFailingTest.java @@ -30,26 +30,6 @@ public class AST2CPPSpecFailingTest extends AST2SpecBaseTest { super(name); } - /** - [--Start Example(CPP 2.3-2): - ??=define arraycheck(a,b) a??(b??) ??!??! b??(a??) - // becomes - #define arraycheck(a,b) a[b] || b[a] - --End Example] - */ - public void test2_3s2() { // TODO exists bug 64993 - StringBuffer buffer = new StringBuffer(); - buffer.append("??=define arraycheck(a,b) a??(b??) ??!??! b??(a??)\n"); //$NON-NLS-1$ - buffer.append("// becomes\n"); //$NON-NLS-1$ - buffer.append("#define arraycheck(a,b) a[b] || b[a]\n"); //$NON-NLS-1$ - - try { - parseCandCPP(buffer.toString(), true, 0); - assertTrue(false); - } catch (Exception e) { - } - } - /** [--Start Example(CPP 6.4-3): int foo() { diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecTest.java index a23d8688bc6..cef6b11ad28 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecTest.java @@ -69,6 +69,22 @@ public class AST2CPPSpecTest extends AST2SpecBaseTest { parseCandCPP(buffer.toString(), true, 0); } + /** + [--Start Example(CPP 2.3-2): + ??=define arraycheck(a,b) a??(b??) ??!??! b??(a??) + // becomes + #define arraycheck(a,b) a[b] || b[a] + --End Example] + */ + public void test2_3s2() throws Exception { // TODO exists bug 64993 + StringBuffer buffer = new StringBuffer(); + buffer.append("??=define arraycheck(a,b) a??(b??) ??!??! b??(a??)\n"); //$NON-NLS-1$ + buffer.append("// becomes\n"); //$NON-NLS-1$ + buffer.append("#define arraycheck(a,b) a[b] || b[a]\n"); //$NON-NLS-1$ + + parseCandCPP(buffer.toString(), true, 0); + } + /** [--Start Example(CPP 3.1-3): int a; // defines a diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CSpecFailingTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CSpecFailingTest.java index acfda4afafd..a655facfd2c 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CSpecFailingTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CSpecFailingTest.java @@ -53,52 +53,4 @@ public class AST2CSpecFailingTest extends AST2SpecBaseTest { assertTrue(false); } catch (Exception e) {} } - - /** - [--Start Example(C 6.10.3.5-5): - #define x 3 - #define f(a) f(x * (a)) - #undef x - #define x 2 - #define g f - #define z z[0] - #define h g(~ - #define m(a) a(w) - #define w 0,1 - #define t(a) a - #define p() int - #define q(x) x - #define r(x,y) x ## y - #define str(x) # x - int foo() { - p() i[q()] = { q(1), r(2,3), r(4,), r(,5), r(,) }; - char c[2][6] = { str(hello), str() }; - } - --End Example] - */ - public void test6_10_3_5s5() throws Exception { - StringBuffer buffer = new StringBuffer(); - buffer.append("#define x 3\n"); //$NON-NLS-1$ - buffer.append("#define f(a) f(x * (a))\n"); //$NON-NLS-1$ - buffer.append("#undef x\n"); //$NON-NLS-1$ - buffer.append("#define x 2\n"); //$NON-NLS-1$ - buffer.append("#define g f\n"); //$NON-NLS-1$ - buffer.append("#define z z[0]\n"); //$NON-NLS-1$ - buffer.append("#define h g(~\n"); //$NON-NLS-1$ - buffer.append("#define m(a) a(w)\n"); //$NON-NLS-1$ - buffer.append("#define w 0,1\n"); //$NON-NLS-1$ - buffer.append("#define t(a) a\n"); //$NON-NLS-1$ - buffer.append("#define p() int\n"); //$NON-NLS-1$ - buffer.append("#define q(x) x\n"); //$NON-NLS-1$ - buffer.append("#define r(x,y) x ## y\n"); //$NON-NLS-1$ - buffer.append("#define str(x) # x\n"); //$NON-NLS-1$ - buffer.append("int foo() {\n"); //$NON-NLS-1$ - buffer.append("p() i[q()] = { q(1), r(2,3), r(4,), r(,5), r(,) };\n"); //$NON-NLS-1$ - buffer.append("char c[2][6] = { str(hello), str() };\n"); //$NON-NLS-1$ - buffer.append("}\n"); //$NON-NLS-1$ - try { - parseCandCPP(buffer.toString(), true, 0); - assertTrue(false); - } catch (Exception e) {} - } -} +} \ No newline at end of file diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CSpecTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CSpecTest.java index 14412b9daa6..f6c2e0a0d00 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CSpecTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CSpecTest.java @@ -1911,6 +1911,51 @@ public class AST2CSpecTest extends AST2SpecBaseTest { parseCandCPP(buffer.toString(), true, 0); } + /** + [--Start Example(C 6.10.3.5-5): + #define x 3 + #define f(a) f(x * (a)) + #undef x + #define x 2 + #define g f + #define z z[0] + #define h g(~ + #define m(a) a(w) + #define w 0,1 + #define t(a) a + #define p() int + #define q(x) x + #define r(x,y) x ## y + #define str(x) # x + int foo() { + p() i[q()] = { q(1), r(2,3), r(4,), r(,5), r(,) }; + char c[2][6] = { str(hello), str() }; + } + --End Example] + */ + public void test6_10_3_5s5() throws Exception { + StringBuffer buffer = new StringBuffer(); + buffer.append("#define x 3\n"); //$NON-NLS-1$ + buffer.append("#define f(a) f(x * (a))\n"); //$NON-NLS-1$ + buffer.append("#undef x\n"); //$NON-NLS-1$ + buffer.append("#define x 2\n"); //$NON-NLS-1$ + buffer.append("#define g f\n"); //$NON-NLS-1$ + buffer.append("#define z z[0]\n"); //$NON-NLS-1$ + buffer.append("#define h g(~\n"); //$NON-NLS-1$ + buffer.append("#define m(a) a(w)\n"); //$NON-NLS-1$ + buffer.append("#define w 0,1\n"); //$NON-NLS-1$ + buffer.append("#define t(a) a\n"); //$NON-NLS-1$ + buffer.append("#define p() int\n"); //$NON-NLS-1$ + buffer.append("#define q(x) x\n"); //$NON-NLS-1$ + buffer.append("#define r(x,y) x ## y\n"); //$NON-NLS-1$ + buffer.append("#define str(x) # x\n"); //$NON-NLS-1$ + buffer.append("int foo() {\n"); //$NON-NLS-1$ + buffer.append("p() i[q()] = { q(1), r(2,3), r(4,), r(,5), r(,) };\n"); //$NON-NLS-1$ + buffer.append("char c[2][6] = { str(hello), str() };\n"); //$NON-NLS-1$ + buffer.append("}\n"); //$NON-NLS-1$ + parseCandCPP(buffer.toString(), true, 0); + } + /** [--Start Example(C 6.10.3.5-6): #define str(s) # s