1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 09:25:31 +02:00

restrict is not a C++-keyword, bug 228826

This commit is contained in:
Markus Schorn 2008-09-17 13:31:15 +00:00
parent a552aa1760
commit 09bd5ef8cb
2 changed files with 9 additions and 3 deletions

View file

@ -3341,7 +3341,7 @@ public class AST2CPPTests extends AST2BaseTest {
public void testBug87424() throws Exception {
IASTTranslationUnit tu = parse(
"int * restrict x;", ParserLanguage.CPP, true); //$NON-NLS-1$
"int * __restrict x;", ParserLanguage.CPP, true); //$NON-NLS-1$
CPPNameCollector col = new CPPNameCollector();
tu.accept(col);
@ -3350,7 +3350,7 @@ public class AST2CPPTests extends AST2BaseTest {
assertTrue(t instanceof IGPPPointerType);
assertTrue(((IGPPPointerType) t).isRestrict());
tu = parse("class A {}; int A::* restrict x;", ParserLanguage.CPP, true); //$NON-NLS-1$
tu = parse("class A {}; int A::* __restrict x;", ParserLanguage.CPP, true); //$NON-NLS-1$
col = new CPPNameCollector();
tu.accept(col);
@ -5973,6 +5973,13 @@ public class AST2CPPTests extends AST2BaseTest {
parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP);
}
// void restrict();
public void testRestrictIsNoCPPKeyword_Bug228826() throws Exception {
final String code = getAboveComment();
parseAndCheckBindings(code, ParserLanguage.CPP, false);
parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP, true); // even with gnu extensions
}
// void test1();
// void test2() throw ();
// void test3() throw (int);

View file

@ -33,7 +33,6 @@ public class GPPScannerExtensionConfiguration extends GNUScannerExtensionConfigu
public GPPScannerExtensionConfiguration() {
addMacro("__null", "0"); //$NON-NLS-1$//$NON-NLS-2$
addKeyword(Keywords.cRESTRICT, IToken.t_restrict);
addKeyword(Keywords.c_COMPLEX, IToken.t__Complex);
addKeyword(Keywords.c_IMAGINARY, IToken.t__Imaginary);
}