1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 10:16:03 +02:00

158192: port patch for __declspec support to CDT 4.0 HEAD

This commit is contained in:
Andrew Ferguson 2007-01-26 17:51:36 +00:00
parent def35fab6f
commit adbdf19470
14 changed files with 184 additions and 6 deletions

View file

@ -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.ICPPNamespace;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType; 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.ICPPUsingDeclaration;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
import org.eclipse.cdt.core.parser.CodeReader; import org.eclipse.cdt.core.parser.CodeReader;
import org.eclipse.cdt.core.parser.IScanner; import org.eclipse.cdt.core.parser.IScanner;
import org.eclipse.cdt.core.parser.NullLogService; 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 A( a, b ) a ## b \n"); //$NON-NLS-1$
writer.write("#define FOOBAR 1 \n"); //$NON-NLS-1$ writer.write("#define FOOBAR 1 \n"); //$NON-NLS-1$
writer.write("int i = A( FOO, BAR ); \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);
} }
} }

View file

@ -7,6 +7,7 @@
* *
* Contributors: * Contributors:
* IBM Rational Software - Initial API and implementation * IBM Rational Software - Initial API and implementation
* Ed Swartz (Nokia)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.parser; 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 TYPEOF = "typeof"; //$NON-NLS-1$
public static final String __ALIGNOF__ = "__alignof__"; //$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 __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 [] cpTYPEOF = TYPEOF.toCharArray();
public static final char [] cp__ALIGNOF__ = __ALIGNOF__.toCharArray(); public static final char [] cp__ALIGNOF__ = __ALIGNOF__.toCharArray();
public static final char [] cp__ATTRIBUTE__ = __ATTRIBUTE__.toCharArray(); public static final char [] cp__ATTRIBUTE__ = __ATTRIBUTE__.toCharArray();
public static final char [] cp__DECLSPEC = __DECLSPEC.toCharArray();
} }

View file

@ -7,6 +7,7 @@
* *
* Contributors: * Contributors:
* IBM Rational Software - Initial API and implementation * IBM Rational Software - Initial API and implementation
* Ed Swartz (Nokia)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.parser; 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 tMAX = tLAST + 3;
public static final int tMIN = tLAST + 4; public static final int tMIN = tLAST + 4;
public static final int t__attribute__ = tLAST + 5; public static final int t__attribute__ = tLAST + 5;
public static final int t__declspec = tLAST + 6;
} }

View file

@ -8,6 +8,7 @@
* Contributors: * Contributors:
* IBM Rational Software - Initial API and implementation * IBM Rational Software - Initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Ed Swartz (Nokia)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser; package org.eclipse.cdt.internal.core.dom.parser;
@ -91,13 +92,15 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
protected final boolean supportGCCOtherBuiltinSymbols; protected final boolean supportGCCOtherBuiltinSymbols;
protected final boolean supportAttributeSpecifiers; protected final boolean supportAttributeSpecifiers;
protected final boolean supportDeclspecSpecifiers;
protected AbstractGNUSourceCodeParser(IScanner scanner, protected AbstractGNUSourceCodeParser(IScanner scanner,
IParserLogService logService, ParserMode parserMode, IParserLogService logService, ParserMode parserMode,
boolean supportStatementsInExpressions, boolean supportStatementsInExpressions,
boolean supportTypeOfUnaries, boolean supportAlignOfUnaries, boolean supportTypeOfUnaries, boolean supportAlignOfUnaries,
boolean supportKnRC, boolean supportGCCOtherBuiltinSymbols, boolean supportKnRC, boolean supportGCCOtherBuiltinSymbols,
boolean supportAttributeSpecifiers) { boolean supportAttributeSpecifiers, boolean supportDeclspecSpecifiers) {
this.scanner = scanner; this.scanner = scanner;
this.log = wrapLogService(logService); this.log = wrapLogService(logService);
this.mode = parserMode; this.mode = parserMode;
@ -107,6 +110,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
this.supportKnRC = supportKnRC; this.supportKnRC = supportKnRC;
this.supportGCCOtherBuiltinSymbols = supportGCCOtherBuiltinSymbols; this.supportGCCOtherBuiltinSymbols = supportGCCOtherBuiltinSymbols;
this.supportAttributeSpecifiers = supportAttributeSpecifiers; this.supportAttributeSpecifiers = supportAttributeSpecifiers;
this.supportDeclspecSpecifiers = supportDeclspecSpecifiers;
} }
protected boolean parsePassed = true; protected boolean parsePassed = true;
@ -2269,6 +2273,27 @@ 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;
}
}
}
}
}
/** /**
* In case a cast expression is followed by +/- or & we should avoid it: * In case a cast expression is followed by +/- or & we should avoid it:
* (a)+1 vs. (int)+1; * (a)+1 vs. (int)+1;

View file

@ -7,6 +7,7 @@
* *
* Contributors: * Contributors:
* IBM Rational Software - Initial API and implementation * IBM Rational Software - Initial API and implementation
* Ed Swartz (Nokia)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c; package org.eclipse.cdt.internal.core.dom.parser.c;
@ -65,4 +66,10 @@ public class ANSICParserExtensionConfiguration implements
return false; return false;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.c.ICParserExtensionConfiguration#supportDeclspecSpecifiers()
*/
public boolean supportDeclspecSpecifiers() {
return false;
}
} }

View file

@ -7,9 +7,12 @@
* *
* Contributors: * Contributors:
* IBM Rational Software - Initial API and implementation * IBM Rational Software - Initial API and implementation
* Ed Swartz (Nokia)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c; package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.core.runtime.Platform;
/** /**
* @author jcamelon * @author jcamelon
*/ */
@ -65,4 +68,13 @@ public class GCCParserExtensionConfiguration implements
return true; 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;
}
} }

View file

@ -8,6 +8,7 @@
* Contributors: * Contributors:
* IBM Rational Software - Initial API and implementation * IBM Rational Software - Initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Ed Swartz (Nokia)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c; package org.eclipse.cdt.internal.core.dom.parser.c;
@ -147,7 +148,8 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
.supportTypeofUnaryExpressions(), config .supportTypeofUnaryExpressions(), config
.supportAlignOfUnaryExpression(), config .supportAlignOfUnaryExpression(), config
.supportKnRC(), config.supportGCCOtherBuiltinSymbols(), .supportKnRC(), config.supportGCCOtherBuiltinSymbols(),
config.supportAttributeSpecifiers()); config.supportAttributeSpecifiers(),
config.supportDeclspecSpecifiers());
supportGCCStyleDesignators = config.supportGCCStyleDesignators(); supportGCCStyleDesignators = config.supportGCCStyleDesignators();
this.index= index; this.index= index;
} }
@ -1589,6 +1591,12 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
else else
throwBacktrack(LA(1).getOffset(), LA(1).getLength()); throwBacktrack(LA(1).getOffset(), LA(1).getLength());
break; break;
case IGCCToken.t__declspec: // __declspec precedes the identifier
if (identifier == null && supportDeclspecSpecifiers)
__declspec();
else
throwBacktrack(LA(1).getOffset(), LA(1).getLength());
break;
default: default:
if (supportTypeOfUnaries && LT(1) == IGCCToken.t_typeof) { if (supportTypeOfUnaries && LT(1) == IGCCToken.t_typeof) {
typeofExpression = unaryTypeofExpression(); typeofExpression = unaryTypeofExpression();
@ -1741,6 +1749,8 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
if (LT(1) == IGCCToken.t__attribute__ && supportAttributeSpecifiers) // if __attribute__ occurs after struct/union/class and before the identifier if (LT(1) == IGCCToken.t__attribute__ && supportAttributeSpecifiers) // if __attribute__ occurs after struct/union/class and before the identifier
__attribute__(); __attribute__();
if (LT(1) == IGCCToken.t__declspec && supportDeclspecSpecifiers) // if __declspec occurs after struct/union/class and before the identifier
__declspec();
IToken nameToken = null; IToken nameToken = null;
// class name // class name
@ -1750,6 +1760,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 ; if (LT(1) == IGCCToken.t__attribute__ && supportAttributeSpecifiers) // if __attribute__ occurs after struct/union/class identifier and before the { or ;
__attribute__(); __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) { if (LT(1) != IToken.tLBRACE) {
IToken errorPoint = LA(1); IToken errorPoint = LA(1);
@ -1897,6 +1909,8 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
// if __attribute__ is after the pointer ops and before the declarator ex: void * __attribute__((__cdecl__)) foo(); // 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 if (LT(1) == IGCCToken.t__attribute__ && supportAttributeSpecifiers) // if __attribute__ is after the parameters
__attribute__(); __attribute__();
if (LT(1) == IGCCToken.t__declspec && supportDeclspecSpecifiers) // if __declspec is after the parameters
__declspec();
if (!pointerOps.isEmpty()) { if (!pointerOps.isEmpty()) {
finalOffset = calculateEndOffset((IASTPointerOperator) pointerOps finalOffset = calculateEndOffset((IASTPointerOperator) pointerOps
@ -2065,6 +2079,12 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
else else
throwBacktrack(LA(1).getOffset(), LA(1).getLength()); throwBacktrack(LA(1).getOffset(), LA(1).getLength());
break; break;
case IGCCToken.t__declspec:
if(supportDeclspecSpecifiers)
__declspec();
else
throwBacktrack(LA(1).getOffset(), LA(1).getLength());
break;
default: default:
break; break;
} }
@ -2075,7 +2095,10 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
if (LT(1) == IGCCToken.t__attribute__ && supportAttributeSpecifiers) // if __attribute__ is after the parameters if (LT(1) == IGCCToken.t__attribute__ && supportAttributeSpecifiers) // if __attribute__ is after the parameters
__attribute__(); __attribute__();
if (LT(1) == IGCCToken.t__declspec && supportDeclspecSpecifiers) // if __attribute__ is after the parameters
__declspec();
IASTDeclarator d = null; IASTDeclarator d = null;
if (numKnRCParms > 0) { if (numKnRCParms > 0) {
ICASTKnRFunctionDeclarator functionDecltor = createKnRFunctionDeclarator(); ICASTKnRFunctionDeclarator functionDecltor = createKnRFunctionDeclarator();

View file

@ -7,6 +7,7 @@
* *
* Contributors: * Contributors:
* IBM Rational Software - Initial API and implementation * IBM Rational Software - Initial API and implementation
* Ed Swartz (Nokia)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c; package org.eclipse.cdt.internal.core.dom.parser.c;
@ -35,4 +36,10 @@ public interface ICParserExtensionConfiguration {
*/ */
public boolean supportAttributeSpecifiers(); public boolean supportAttributeSpecifiers();
/**
* Win32 compiler extensions also supported by GCC on Win32
* @return
*/
public boolean supportDeclspecSpecifiers();
} }

View file

@ -7,6 +7,7 @@
* *
* Contributors: * Contributors:
* IBM Rational Software - Initial API and implementation * IBM Rational Software - Initial API and implementation
* Ed Swartz (Nokia)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -100,4 +101,10 @@ public class ANSICPPParserExtensionConfiguration implements
return false; return false;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPParserExtensionConfiguration#supportDeclspecSpecifiers()
*/
public boolean supportDeclspecSpecifiers() {
return false;
}
} }

View file

@ -9,6 +9,7 @@
* IBM Corporation - initial API and implementation * IBM Corporation - initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Bryan Wilkinson (QNX) - https://bugs.eclipse.org/bugs/show_bug.cgi?id=151207 * Bryan Wilkinson (QNX) - https://bugs.eclipse.org/bugs/show_bug.cgi?id=151207
* Ed Swartz (Nokia)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -1990,7 +1991,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
super(scanner, log, mode, config.supportStatementsInExpressions(), super(scanner, log, mode, config.supportStatementsInExpressions(),
config.supportTypeofUnaryExpressions(), config config.supportTypeofUnaryExpressions(), config
.supportAlignOfUnaryExpression(), config.supportKnRC(), .supportAlignOfUnaryExpression(), config.supportKnRC(),
config.supportGCCOtherBuiltinSymbols(), config.supportAttributeSpecifiers()); config.supportGCCOtherBuiltinSymbols(), config.supportAttributeSpecifiers(),
config.supportDeclspecSpecifiers());
allowCPPRestrict = config.allowRestrictPointerOperators(); allowCPPRestrict = config.allowRestrictPointerOperators();
supportExtendedTemplateSyntax = config.supportExtendedTemplateSyntax(); supportExtendedTemplateSyntax = config.supportExtendedTemplateSyntax();
supportMinAndMaxOperators = config.supportMinAndMaxOperators(); supportMinAndMaxOperators = config.supportMinAndMaxOperators();
@ -3489,6 +3491,13 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
else else
throwBacktrack(LA(1).getOffset(), LA(1).getLength()); throwBacktrack(LA(1).getOffset(), LA(1).getLength());
break; 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: default:
if (supportTypeOfUnaries && LT(1) == IGCCToken.t_typeof) { if (supportTypeOfUnaries && LT(1) == IGCCToken.t_typeof) {
typeofExpression = unaryTypeofExpression(); typeofExpression = unaryTypeofExpression();
@ -3870,6 +3879,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
// if __attribute__ is after the pointer ops and before the declarator ex: void * __attribute__((__cdecl__)) foo(); // 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 if (LT(1) == IGCCToken.t__attribute__ && supportAttributeSpecifiers) // if __attribute__ is after the parameters
__attribute__(); __attribute__();
if (LT(1) == IGCCToken.t__declspec && supportDeclspecSpecifiers) // if __declspec occurs after struct/union/class and before the identifier
__declspec();
if (!pointerOps.isEmpty()) if (!pointerOps.isEmpty())
finalOffset = calculateEndOffset((IASTNode) pointerOps finalOffset = calculateEndOffset((IASTNode) pointerOps
@ -4297,7 +4308,9 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
if (LT(1) == IGCCToken.t__attribute__ && supportAttributeSpecifiers) // if __attribute__ occurs after struct/union/class and before the identifier if (LT(1) == IGCCToken.t__attribute__ && supportAttributeSpecifiers) // if __attribute__ occurs after struct/union/class and before the identifier
__attribute__(); __attribute__();
if (LT(1) == IGCCToken.t__declspec && supportDeclspecSpecifiers) // if __declspec occurs after struct/union/class and before the identifier
__declspec();
// class name // class name
if (LT(1) == IToken.tIDENTIFIER) if (LT(1) == IToken.tIDENTIFIER)
name = createName(name()); name = createName(name());
@ -4306,6 +4319,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 ; if (LT(1) == IGCCToken.t__attribute__ && supportAttributeSpecifiers) // if __attribute__ occurs after struct/union/class identifier and before the { or ;
__attribute__(); __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) { if (LT(1) != IToken.tCOLON && LT(1) != IToken.tLBRACE) {
IToken errorPoint = LA(1); IToken errorPoint = LA(1);

View file

@ -7,9 +7,12 @@
* *
* Contributors: * Contributors:
* IBM Rational Software - Initial API and implementation * IBM Rational Software - Initial API and implementation
* Ed Swartz (Nokia)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.core.runtime.Platform;
/** /**
* @author jcamelon * @author jcamelon
*/ */
@ -100,4 +103,11 @@ public class GPPParserExtensionConfiguration implements
return true; 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);
}
} }

View file

@ -7,6 +7,7 @@
* *
* Contributors: * Contributors:
* IBM Rational Software - Initial API and implementation * IBM Rational Software - Initial API and implementation
* Ed Swartz (Nokia)
*******************************************************************************/ *******************************************************************************/
/* /*
@ -32,5 +33,6 @@ public interface ICPPParserExtensionConfiguration {
public boolean supportKnRC(); public boolean supportKnRC();
public boolean supportGCCOtherBuiltinSymbols(); public boolean supportGCCOtherBuiltinSymbols();
public boolean supportAttributeSpecifiers(); public boolean supportAttributeSpecifiers();
public boolean supportDeclspecSpecifiers();
} }

View file

@ -7,6 +7,7 @@
* *
* Contributors: * Contributors:
* IBM - Initial API and implementation * IBM - Initial API and implementation
* Ed Swartz (Nokia)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.parser.scanner2; 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.cp__ALIGNOF__, IGCCToken.t___alignof__ );
result.put( GCCKeywords.cpTYPEOF, IGCCToken.t_typeof ); result.put( GCCKeywords.cpTYPEOF, IGCCToken.t_typeof );
result.put( GCCKeywords.cp__ATTRIBUTE__, IGCCToken.t__attribute__ ); result.put( GCCKeywords.cp__ATTRIBUTE__, IGCCToken.t__attribute__ );
result.put( GCCKeywords.cp__DECLSPEC, IGCCToken.t__declspec );
return result; return result;
} }

View file

@ -7,6 +7,7 @@
* *
* Contributors: * Contributors:
* IBM - Initial API and implementation * IBM - Initial API and implementation
* Ed Swartz (Nokia)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.parser.scanner2; 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.cRESTRICT, IToken.t_restrict );
additionalCPPKeywords.put( Keywords.c_COMPLEX, IToken.t__Complex ); additionalCPPKeywords.put( Keywords.c_COMPLEX, IToken.t__Complex );
additionalCPPKeywords.put( Keywords.c_IMAGINARY, IToken.t__Imaginary ); additionalCPPKeywords.put( Keywords.c_IMAGINARY, IToken.t__Imaginary );
additionalCPPKeywords.put( GCCKeywords.cp__DECLSPEC, IGCCToken.t__declspec );
return additionalCPPKeywords; return additionalCPPKeywords;
} }