summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-07-15 15:25:08 (GMT)
committerBrad King <brad.king@kitware.com>2019-07-15 15:25:08 (GMT)
commit606697e3e141526e167eb1c96118faf311b3363d (patch)
tree4fc599579d05b40f1172643551d7678f8bca7fa7
parent188d9159ae2ce110a1651c894e801622b017cece (diff)
parentae69145cf7f10d4da8d18d1efbdefcfa0f7cc003 (diff)
downloadCastXML-606697e3e141526e167eb1c96118faf311b3363d.zip
CastXML-606697e3e141526e167eb1c96118faf311b3363d.tar.gz
CastXML-606697e3e141526e167eb1c96118faf311b3363d.tar.bz2
Merge branch 'ppc64' into release-0.2
* ppc64: Detect: Drop detected predefined macros conflicting with Clang's Detect: Fix GNU builtin include directory detection on ppc64
-rw-r--r--src/Detect.cxx22
-rw-r--r--test/cc-gnu.c4
2 files changed, 21 insertions, 5 deletions
diff --git a/src/Detect.cxx b/src/Detect.cxx
index 2ef5ae8..d1ad8ec 100644
--- a/src/Detect.cxx
+++ b/src/Detect.cxx
@@ -55,12 +55,10 @@ static bool failedCC(const char* id, std::vector<const char*> const& args,
return false;
}
-static void fixPredefines(Options& opts)
+static void fixPredefines(std::string& pd, std::string const& rm)
{
- // Remove any detected conflicting definition of a Clang builtin macro.
- std::string& pd = opts.Predefines;
std::string::size_type beg = 0;
- while ((beg = pd.find("#define __has", beg), beg != std::string::npos)) {
+ while ((beg = pd.find(rm, beg), beg != std::string::npos)) {
std::string::size_type end = pd.find('\n', beg);
if (end != std::string::npos) {
pd.erase(beg, end + 1 - beg);
@@ -70,6 +68,16 @@ static void fixPredefines(Options& opts)
}
}
+static void fixPredefines(Options& opts)
+{
+ // Remove any detected conflicting definition of a Clang builtin macro.
+ fixPredefines(opts.Predefines, "#define __bool ");
+ fixPredefines(opts.Predefines, "#define __builtin_vsx_");
+ fixPredefines(opts.Predefines, "#define __has_");
+ fixPredefines(opts.Predefines, "#define __pixel ");
+ fixPredefines(opts.Predefines, "#define __vector ");
+}
+
static void setTriple(Options& opts)
{
std::string const& pd = opts.Predefines;
@@ -135,7 +143,11 @@ static bool detectCC_GNU(const char* const* argBeg, const char* const* argEnd,
fwImplicitSuffix));
}
// Replace the compiler builtin include directory with ours.
- if (!fw && llvm::sys::fs::exists(inc + "/emmintrin.h")) {
+ if (!fw &&
+ // FIXME: Intrinsics headers are platform-specific.
+ // Is there a better way to detect this directory?
+ (llvm::sys::fs::exists(inc + "/emmintrin.h") ||
+ llvm::sys::fs::exists(inc + "/altivec.h"))) {
inc = getClangBuiltinIncludeDir();
}
opts.Includes.push_back(Options::Include(inc, fw));
diff --git a/test/cc-gnu.c b/test/cc-gnu.c
index 750efea..e74ccf7 100644
--- a/test/cc-gnu.c
+++ b/test/cc-gnu.c
@@ -31,6 +31,10 @@ int main(int argc, const char* argv[])
"#define __has_include(x) x\n"
"#define __has_include_next(x) x\n"
"#define __GNUC_MINOR__ 1\n"
+ "#define __bool __bool\n"
+ "#define __builtin_vsx_foo __builtin_vsx_foo\n"
+ "#define __pixel __pixel\n"
+ "#define __vector __vector\n"
"#define __has_last(x) x"
);
fprintf(stderr,