diff options
14 files changed, 185 insertions, 6 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/CompleteParser2Tests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/CompleteParser2Tests.java index e8251111b98..2a7b42ca990 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/CompleteParser2Tests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/CompleteParser2Tests.java @@ -61,6 +61,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod; import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace; import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable; import org.eclipse.cdt.core.parser.CodeReader; import org.eclipse.cdt.core.parser.IScanner; import org.eclipse.cdt.core.parser.NullLogService; @@ -2575,6 +2576,66 @@ public class CompleteParser2Tests extends TestCase { writer.write("#define A( a, b ) a ## b \n"); //$NON-NLS-1$ writer.write("#define FOOBAR 1 \n"); //$NON-NLS-1$ writer.write("int i = A( FOO, BAR ); \n"); //$NON-NLS-1$ - parse( writer.toString() ); + parse( writer.toString(), true, ParserLanguage.CPP ); + } + + public void test158192_declspec_on_class() throws Exception { + Writer writer = new StringWriter(); + writer.write("class __declspec(foobar) Foo1 {};\n"); + writer.write("union __declspec(foobar) Foo2 {};\n"); + writer.write("struct __declspec(foobar) Foo3 {};\n"); + IASTTranslationUnit tu = parse( writer.toString(), true, ParserLanguage.CPP, true ); + + CPPNameCollector col = new CPPNameCollector(); + tu.accept( col ); + + assertEquals( 3, col.size()); + ICompositeType fooClass = (ICompositeType) col.getName(0).resolveBinding(); + ICompositeType fooUnion = (ICompositeType) col.getName(1).resolveBinding(); + ICompositeType fooStruct = (ICompositeType) col.getName(2).resolveBinding(); + + assertEquals(ICPPClassType.k_class, fooClass.getKey()); + assertEquals(ICompositeType.k_union, fooUnion.getKey()); + assertEquals(ICompositeType.k_struct, fooStruct.getKey()); + + assertInstances(col, fooClass, 1); + assertInstances(col, fooUnion, 1); + assertInstances(col, fooStruct, 1); + } + + public void test158192_declspec_on_variable() throws Exception { + Writer writer = new StringWriter(); + writer.write("__declspec(foobar) class Foo {} bar;\n"); + IASTTranslationUnit tu = parse( writer.toString(), true, ParserLanguage.CPP, true); + + CPPNameCollector col = new CPPNameCollector(); + tu.accept( col ); + + assertEquals( 2, col.size()); + ICompositeType fooClass = (ICompositeType) col.getName(0).resolveBinding(); + ICPPVariable bar = (ICPPVariable) col.getName(1).resolveBinding(); + + assertInstances(col, fooClass, 1); + assertInstances(col, bar, 1); + } + + // MSVC does not allow declspec in this position, GCC does so we test for this + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=158192 + public void test158192_declspec_in_declarator() throws Exception { + Writer writer = new StringWriter(); + + writer.write("int * __declspec(foo) bar = 0;\n"); + IASTTranslationUnit tu = parse( writer.toString(), true, ParserLanguage.CPP, true); + + IASTProblem [] problems = CPPVisitor.getProblems(tu); + assertFalse("__declspec rejected inside declarator", problems.length>0 ); + + CPPNameCollector col = new CPPNameCollector(); + tu.accept( col ); + + assertEquals( 1, col.size()); + ICPPVariable bar = (ICPPVariable) col.getName(0).resolveBinding(); + + assertInstances(col, bar, 1); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/GCCKeywords.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/GCCKeywords.java index 3787c6ca668..ebaf670b71b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/GCCKeywords.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/GCCKeywords.java @@ -7,6 +7,7 @@ * * Contributors: * IBM Rational Software - Initial API and implementation + * Ed Swartz (Nokia) *******************************************************************************/ package org.eclipse.cdt.core.parser; @@ -20,9 +21,11 @@ public class GCCKeywords { public static final String TYPEOF = "typeof"; //$NON-NLS-1$ public static final String __ALIGNOF__ = "__alignof__"; //$NON-NLS-1$ public static final String __ATTRIBUTE__ = "__attribute__"; //$NON-NLS-1$ + public static final String __DECLSPEC = "__declspec"; //$NON-NLS-1$ public static final char [] cpTYPEOF = TYPEOF.toCharArray(); public static final char [] cp__ALIGNOF__ = __ALIGNOF__.toCharArray(); public static final char [] cp__ATTRIBUTE__ = __ATTRIBUTE__.toCharArray(); + public static final char [] cp__DECLSPEC = __DECLSPEC.toCharArray(); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IGCCToken.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IGCCToken.java index a105c73ab9e..5088891a6b7 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IGCCToken.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IGCCToken.java @@ -7,6 +7,7 @@ * * Contributors: * IBM Rational Software - Initial API and implementation + * Ed Swartz (Nokia) *******************************************************************************/ package org.eclipse.cdt.core.parser; @@ -22,5 +23,6 @@ public interface IGCCToken extends IToken { public static final int tMAX = tLAST + 3; public static final int tMIN = tLAST + 4; public static final int t__attribute__ = tLAST + 5; + public static final int t__declspec = tLAST + 6; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java index 28dc8c8f008..dfb32493c09 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java @@ -7,6 +7,7 @@ * * Contributors: * IBM Rational Software - Initial API and implementation + * Ed Swartz (Nokia) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser; @@ -89,13 +90,15 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser { protected final boolean supportGCCOtherBuiltinSymbols; protected final boolean supportAttributeSpecifiers; + + protected final boolean supportDeclspecSpecifiers; protected AbstractGNUSourceCodeParser(IScanner scanner, IParserLogService logService, ParserMode parserMode, boolean supportStatementsInExpressions, boolean supportTypeOfUnaries, boolean supportAlignOfUnaries, boolean supportKnRC, boolean supportGCCOtherBuiltinSymbols, - boolean supportAttributeSpecifiers) { + boolean supportAttributeSpecifiers, boolean supportDeclspecSpecifiers) { this.scanner = scanner; this.log = logService; this.mode = parserMode; @@ -105,6 +108,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser { this.supportKnRC = supportKnRC; this.supportGCCOtherBuiltinSymbols = supportGCCOtherBuiltinSymbols; this.supportAttributeSpecifiers = supportAttributeSpecifiers; + this.supportDeclspecSpecifiers = supportDeclspecSpecifiers; } protected boolean parsePassed = true; @@ -2252,4 +2256,25 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser { } } } + + protected void __declspec() throws BacktrackException, EndOfFileException { + IToken token = LA(1); + + if (token.getType() == IGCCToken.t__declspec) { + consume(); + + token = LA(1); + + if (token.getType() == IToken.tLPAREN) { + consume(); + while(true) { + token = LA(1); + consume(); + if (token.getType() == IToken.tRPAREN) { + break; + } + } + } + } + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/ANSICParserExtensionConfiguration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/ANSICParserExtensionConfiguration.java index bd23f2a7d5b..15441b2015d 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/ANSICParserExtensionConfiguration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/ANSICParserExtensionConfiguration.java @@ -7,6 +7,7 @@ * * Contributors: * IBM Rational Software - Initial API and implementation + * Ed Swartz (Nokia) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.c; @@ -65,4 +66,10 @@ public class ANSICParserExtensionConfiguration implements return false; } + /* (non-Javadoc) + * @see org.eclipse.cdt.internal.core.dom.parser.c.ICParserExtensionConfiguration#supportDeclspecSpecifiers() + */ + public boolean supportDeclspecSpecifiers() { + return false; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GCCParserExtensionConfiguration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GCCParserExtensionConfiguration.java index 3e2b05d4d4b..307a702fdd5 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GCCParserExtensionConfiguration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GCCParserExtensionConfiguration.java @@ -7,9 +7,12 @@ * * Contributors: * IBM Rational Software - Initial API and implementation + * Ed Swartz (Nokia) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.c; +import org.eclipse.core.runtime.Platform; + /** * @author jcamelon */ @@ -65,4 +68,13 @@ public class GCCParserExtensionConfiguration implements return true; } + /* (non-Javadoc) + * @see org.eclipse.cdt.internal.core.dom.parser.c.ICParserExtensionConfiguration#supportDeclspecSpecifiers() + */ + public boolean supportDeclspecSpecifiers() { + // XXX Yes, this is a hack -- should use the target platform + if (Platform.getOS().equals(Platform.OS_WIN32)) + return true; + return false; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java index 846d360f49c..0aca544a972 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java @@ -7,6 +7,7 @@ * * Contributors: * IBM Rational Software - Initial API and implementation + * Ed Swartz (Nokia) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.c; @@ -136,7 +137,8 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser { .supportTypeofUnaryExpressions(), config .supportAlignOfUnaryExpression(), config .supportKnRC(), config.supportGCCOtherBuiltinSymbols(), - config.supportAttributeSpecifiers()); + config.supportAttributeSpecifiers(), + config.supportDeclspecSpecifiers()); supportGCCStyleDesignators = config.supportGCCStyleDesignators(); } @@ -1605,6 +1607,12 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser { else throwBacktrack(LA(1).getOffset(), LA(1).getLength()); break; + case IGCCToken.t__declspec: // __declspec precedes the identifier + if (identifier == null && supportDeclspecSpecifiers) + __declspec(); + else + throwBacktrack(LA(1).getOffset(), LA(1).getLength()); + break; default: if (supportTypeOfUnaries && LT(1) == IGCCToken.t_typeof) { typeofExpression = unaryTypeofExpression(); @@ -1757,6 +1765,8 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser { if (LT(1) == IGCCToken.t__attribute__ && supportAttributeSpecifiers) // if __attribute__ occurs after struct/union/class and before the identifier __attribute__(); + if (LT(1) == IGCCToken.t__declspec && supportDeclspecSpecifiers) // if __declspec occurs after struct/union/class and before the identifier + __declspec(); IToken nameToken = null; // class name @@ -1766,6 +1776,8 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser { if (LT(1) == IGCCToken.t__attribute__ && supportAttributeSpecifiers) // if __attribute__ occurs after struct/union/class identifier and before the { or ; __attribute__(); + if (LT(1) == IGCCToken.t__declspec && supportDeclspecSpecifiers) // if __declspec occurs after struct/union/class and before the identifier + __declspec(); if (LT(1) != IToken.tLBRACE) { IToken errorPoint = LA(1); @@ -1913,6 +1925,8 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser { // if __attribute__ is after the pointer ops and before the declarator ex: void * __attribute__((__cdecl__)) foo(); if (LT(1) == IGCCToken.t__attribute__ && supportAttributeSpecifiers) // if __attribute__ is after the parameters __attribute__(); + if (LT(1) == IGCCToken.t__declspec && supportDeclspecSpecifiers) // if __declspec is after the parameters + __declspec(); if (!pointerOps.isEmpty()) { finalOffset = calculateEndOffset((IASTPointerOperator) pointerOps @@ -2081,6 +2095,13 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser { else throwBacktrack(LA(1).getOffset(), LA(1).getLength()); break; + case IGCCToken.t__declspec: + if(supportDeclspecSpecifiers) + __declspec(); + else + throwBacktrack(LA(1).getOffset(), LA(1).getLength()); + break; + default: break; } @@ -2091,7 +2112,10 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser { if (LT(1) == IGCCToken.t__attribute__ && supportAttributeSpecifiers) // if __attribute__ is after the parameters __attribute__(); - + + if (LT(1) == IGCCToken.t__declspec && supportDeclspecSpecifiers) // if __attribute__ is after the parameters + __declspec(); + IASTDeclarator d = null; if (numKnRCParms > 0) { ICASTKnRFunctionDeclarator functionDecltor = createKnRFunctionDeclarator(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/ICParserExtensionConfiguration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/ICParserExtensionConfiguration.java index bd65c29ea8e..03b29f55249 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/ICParserExtensionConfiguration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/ICParserExtensionConfiguration.java @@ -7,6 +7,7 @@ * * Contributors: * IBM Rational Software - Initial API and implementation + * Ed Swartz (Nokia) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.c; @@ -35,4 +36,10 @@ public interface ICParserExtensionConfiguration { */ public boolean supportAttributeSpecifiers(); + /** + * Win32 compiler extensions also supported by GCC on Win32 + * @return + */ + public boolean supportDeclspecSpecifiers(); + } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ANSICPPParserExtensionConfiguration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ANSICPPParserExtensionConfiguration.java index 27e871d89f7..effdae80de3 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ANSICPPParserExtensionConfiguration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ANSICPPParserExtensionConfiguration.java @@ -7,6 +7,7 @@ * * Contributors: * IBM Rational Software - Initial API and implementation + * Ed Swartz (Nokia) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp; @@ -100,4 +101,10 @@ public class ANSICPPParserExtensionConfiguration implements return false; } + /* (non-Javadoc) + * @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPParserExtensionConfiguration#supportDeclspecSpecifiers() + */ + public boolean supportDeclspecSpecifiers() { + return false; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java index ca8954d7e48..0448a9d1a93 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Ed Swartz (Nokia) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp; @@ -1975,7 +1976,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser { super(scanner, log, mode, config.supportStatementsInExpressions(), config.supportTypeofUnaryExpressions(), config .supportAlignOfUnaryExpression(), config.supportKnRC(), - config.supportGCCOtherBuiltinSymbols(), config.supportAttributeSpecifiers()); + config.supportGCCOtherBuiltinSymbols(), config.supportAttributeSpecifiers(), + config.supportDeclspecSpecifiers()); allowCPPRestrict = config.allowRestrictPointerOperators(); supportExtendedTemplateSyntax = config.supportExtendedTemplateSyntax(); supportMinAndMaxOperators = config.supportMinAndMaxOperators(); @@ -3473,6 +3475,13 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser { else throwBacktrack(LA(1).getOffset(), LA(1).getLength()); break; + case IGCCToken.t__declspec: // if __declspec appears before identifier + if (duple == null && supportDeclspecSpecifiers) + __declspec(); + else + throwBacktrack(LA(1).getOffset(), LA(1).getLength()); + break; + default: if (supportTypeOfUnaries && LT(1) == IGCCToken.t_typeof) { typeofExpression = unaryTypeofExpression(); @@ -3854,6 +3863,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser { // if __attribute__ is after the pointer ops and before the declarator ex: void * __attribute__((__cdecl__)) foo(); if (LT(1) == IGCCToken.t__attribute__ && supportAttributeSpecifiers) // if __attribute__ is after the parameters __attribute__(); + if (LT(1) == IGCCToken.t__declspec && supportDeclspecSpecifiers) // if __declspec occurs after struct/union/class and before the identifier + __declspec(); if (!pointerOps.isEmpty()) finalOffset = calculateEndOffset((IASTNode) pointerOps @@ -4281,7 +4292,9 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser { if (LT(1) == IGCCToken.t__attribute__ && supportAttributeSpecifiers) // if __attribute__ occurs after struct/union/class and before the identifier __attribute__(); - + if (LT(1) == IGCCToken.t__declspec && supportDeclspecSpecifiers) // if __declspec occurs after struct/union/class and before the identifier + __declspec(); + // class name if (LT(1) == IToken.tIDENTIFIER) name = createName(name()); @@ -4290,6 +4303,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser { if (LT(1) == IGCCToken.t__attribute__ && supportAttributeSpecifiers) // if __attribute__ occurs after struct/union/class identifier and before the { or ; __attribute__(); + if (LT(1) == IGCCToken.t__declspec && supportDeclspecSpecifiers) // if __declspec occurs after struct/union/class and before the identifier + __declspec(); if (LT(1) != IToken.tCOLON && LT(1) != IToken.tLBRACE) { IToken errorPoint = LA(1); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GPPParserExtensionConfiguration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GPPParserExtensionConfiguration.java index 8999d678288..08efd20dca9 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GPPParserExtensionConfiguration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GPPParserExtensionConfiguration.java @@ -7,9 +7,12 @@ * * Contributors: * IBM Rational Software - Initial API and implementation + * Ed Swartz (Nokia) *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp; +import org.eclipse.core.runtime.Platform; + /** * @author jcamelon */ @@ -100,4 +103,11 @@ public class GPPParserExtensionConfiguration implements return true; } + /* (non-Javadoc) + * @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPParserExtensionConfiguration#supportDeclspecSpecifiers() + */ + public boolean supportDeclspecSpecifiers() { + // XXX: a hack, should use the target's platform + return Platform.getOS().equals(Platform.OS_WIN32); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ICPPParserExtensionConfiguration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ICPPParserExtensionConfiguration.java index 87701cb1eb1..b73a8f2540a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ICPPParserExtensionConfiguration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ICPPParserExtensionConfiguration.java @@ -7,6 +7,7 @@ * * Contributors: * IBM Rational Software - Initial API and implementation + * Ed Swartz (Nokia) *******************************************************************************/ /* @@ -32,5 +33,6 @@ public interface ICPPParserExtensionConfiguration { public boolean supportKnRC(); public boolean supportGCCOtherBuiltinSymbols(); public boolean supportAttributeSpecifiers(); + public boolean supportDeclspecSpecifiers(); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/GCCScannerExtensionConfiguration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/GCCScannerExtensionConfiguration.java index acec78b262b..3a946e1540c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/GCCScannerExtensionConfiguration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/GCCScannerExtensionConfiguration.java @@ -7,6 +7,7 @@ * * Contributors: * IBM - Initial API and implementation + * Ed Swartz (Nokia) *******************************************************************************/ package org.eclipse.cdt.internal.core.parser.scanner2; @@ -69,6 +70,7 @@ public class GCCScannerExtensionConfiguration extends GNUScannerExtensionConfigu result.put( GCCKeywords.cp__ALIGNOF__, IGCCToken.t___alignof__ ); result.put( GCCKeywords.cpTYPEOF, IGCCToken.t_typeof ); result.put( GCCKeywords.cp__ATTRIBUTE__, IGCCToken.t__attribute__ ); + result.put( GCCKeywords.cp__DECLSPEC, IGCCToken.t__declspec ); return result; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/GPPScannerExtensionConfiguration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/GPPScannerExtensionConfiguration.java index 7d59b5229f0..5c799a02e4f 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/GPPScannerExtensionConfiguration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/GPPScannerExtensionConfiguration.java @@ -7,6 +7,7 @@ * * Contributors: * IBM - Initial API and implementation + * Ed Swartz (Nokia) *******************************************************************************/ package org.eclipse.cdt.internal.core.parser.scanner2; @@ -40,6 +41,7 @@ public class GPPScannerExtensionConfiguration extends GNUScannerExtensionConfigu additionalCPPKeywords.put( Keywords.cRESTRICT, IToken.t_restrict ); additionalCPPKeywords.put( Keywords.c_COMPLEX, IToken.t__Complex ); additionalCPPKeywords.put( Keywords.c_IMAGINARY, IToken.t__Imaginary ); + additionalCPPKeywords.put( GCCKeywords.cp__DECLSPEC, IGCCToken.t__declspec ); return additionalCPPKeywords; } |