diff options
author | Mike Kucera | 2010-03-16 18:35:48 +0000 |
---|---|---|
committer | Mike Kucera | 2010-03-16 18:35:48 +0000 |
commit | d3386e3dd276f7e9ecd9132beb2149fb3b731f02 (patch) | |
tree | 54e07ee1fc57ecb9a12a9f2fb2293cea23589dd5 /xlc/org.eclipse.cdt.core.lrparser.xlc.tests | |
parent | 6fd9d653583adf3f0c109f0e2ac4c13b67149386 (diff) | |
download | org.eclipse.cdt-d3386e3dd276f7e9ecd9132beb2149fb3b731f02.tar.gz org.eclipse.cdt-d3386e3dd276f7e9ecd9132beb2149fb3b731f02.tar.xz org.eclipse.cdt-d3386e3dd276f7e9ecd9132beb2149fb3b731f02.zip |
Bug 303065 - support new constructs by the upcoming v11.1 XL C/C++ compiler
Diffstat (limited to 'xlc/org.eclipse.cdt.core.lrparser.xlc.tests')
-rw-r--r-- | xlc/org.eclipse.cdt.core.lrparser.xlc.tests/src/org/eclipse/cdt/core/parser/xlc/tests/XlcExtensionsTest.java | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/xlc/org.eclipse.cdt.core.lrparser.xlc.tests/src/org/eclipse/cdt/core/parser/xlc/tests/XlcExtensionsTest.java b/xlc/org.eclipse.cdt.core.lrparser.xlc.tests/src/org/eclipse/cdt/core/parser/xlc/tests/XlcExtensionsTest.java index acebb2011ad..940abd59aa7 100644 --- a/xlc/org.eclipse.cdt.core.lrparser.xlc.tests/src/org/eclipse/cdt/core/parser/xlc/tests/XlcExtensionsTest.java +++ b/xlc/org.eclipse.cdt.core.lrparser.xlc.tests/src/org/eclipse/cdt/core/parser/xlc/tests/XlcExtensionsTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 IBM Corporation and others. + * Copyright (c) 2009, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -275,4 +275,48 @@ public class XlcExtensionsTest extends XlcTestBase { parse(code, getCPPLanguage(), true); // xlc supports this in C++ } + public void testStaticAssertions() { + String code = + " const unsigned int EIGHT= 8; \n"+ + " __static_assert(sizeof(long) >= EIGHT, \"no 64-bit support\"); \n" + + + " namespace ns { \n"+ + " __static_assert(sizeof(long) >= 4, \"no 32-bit support\"); \n" + + " } \n" + + + " template <typename T> class basic_string { \n" + + " __static_assert(T::value, \"bla\"); \n" + + " }; \n" + + + " void do_something() { \n" + + " struct VMPage { \n" + + " }; \n" + + " __static_assert(sizeof(VMPage) == 1, \"bla\"); \n" + + " }"; + + parse(code, getCPPLanguage(), true); // xlc supports this in C++ + } + + public void testV11Attributes() { + String code = + "#define __inline__ __inline__ __attribute__((gnu_inline)) \n" + + + "static int w() __attribute__ ((weakref (\"y\")));\n" + + /* is equivalent to... */ + "static int x() __attribute__ ((weak, weakref, alias (\"y\")));\n" + + /* and to... */ + "static int y() __attribute__ ((weakref));\n" + + "static int z() __attribute__ ((alias (\"y\"))); \n" + + + "int foo() __attribute__((gnu_inline)); \n" + + "static inline __attribute__((gnu_inline)) int ins (int *a){ \n" + + " (*a)++; \n" + + "} \n" + + "inline __attribute__((gnu_inline)) int inc (int *a){ \n" + + " (*a)++; \n" + + "} "; + + parse(code, getCLanguage(), true); + parse(code, getCPPLanguage(), true); + } } |