From 5a6673a049ba46480d44fbe640875fbcc073be4f Mon Sep 17 00:00:00 2001 From: Markus Schorn Date: Tue, 29 Jul 2008 08:29:27 +0000 Subject: [PATCH] Support for __builtin_types_compatible_p, bug 241570. --- .../eclipse/cdt/core/parser/tests/ast2/AST2Tests.java | 11 +++++++++++ .../dom/parser/GNUScannerExtensionConfiguration.java | 1 + 2 files changed, 12 insertions(+) diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java index 8fee9d8a9bd..bc5dd6c56ac 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java @@ -5262,4 +5262,15 @@ public class AST2Tests extends AST2BaseTest { bh.assertNonProblem("a3=", 2); } } + + // void test() { + // char* p; + // if (__builtin_types_compatible_p(typeof(p), char[]))) { + // } + // } + public void testBuiltinTypesCompatible_bug241570() throws Exception { + for (ParserLanguage lang : ParserLanguage.values()) { + parseAndCheckBindings(getAboveComment(), lang, true); + } + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/GNUScannerExtensionConfiguration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/GNUScannerExtensionConfiguration.java index 8166319eabb..30b7335ee0e 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/GNUScannerExtensionConfiguration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/GNUScannerExtensionConfiguration.java @@ -38,6 +38,7 @@ public abstract class GNUScannerExtensionConfiguration extends AbstractScannerEx addMacro("__builtin_va_arg(ap,type)", "*(type *)ap"); addMacro("__builtin_constant_p(exp)", "0"); + addMacro("__builtin_types_compatible_p(x,y)", "__builtin_types_compatible_p(sizeof(x),sizeof(y)"); addPreprocessorKeyword(Keywords.cINCLUDE_NEXT, IPreprocessorDirective.ppInclude_next); addPreprocessorKeyword(Keywords.cIMPORT, IPreprocessorDirective.ppImport);