diff options
author | Brad King <brad.king@kitware.com> | 2015-02-04 16:08:31 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-02-04 16:08:31 (GMT) |
commit | 1cf66488ca969eefcd4299e51122445474285238 (patch) | |
tree | 2b36998e949356a663a83507e74e9d08c5eea67e /src/Detect.cxx | |
parent | 8d8aacd65af229da0cadf81911ffa3ef77db7b57 (diff) | |
download | CastXML-1cf66488ca969eefcd4299e51122445474285238.zip CastXML-1cf66488ca969eefcd4299e51122445474285238.tar.gz CastXML-1cf66488ca969eefcd4299e51122445474285238.tar.bz2 |
Detect: Drop detected predefined macros starting in '__has'
These macros are builtin to Clang so we should not try to use any such
definitions detected from the compiler.
Diffstat (limited to 'src/Detect.cxx')
-rw-r--r-- | src/Detect.cxx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Detect.cxx b/src/Detect.cxx index 4db82f9..3714847 100644 --- a/src/Detect.cxx +++ b/src/Detect.cxx @@ -53,6 +53,22 @@ static bool failedCC(const char* id, } //---------------------------------------------------------------------------- +static void fixPredefines(Options& opts) +{ + // Remove any detected conflicting definition of a Clang builtin macro. + std::string::size_type beg = 0; + while ((beg = opts.Predefines.find("#define __has", beg), + beg != std::string::npos)) { + std::string::size_type end = opts.Predefines.find('\n', beg); + if (end != std::string::npos) { + opts.Predefines.erase(beg, end+1 - beg); + } else { + opts.Predefines.erase(beg); + } + } +} + +//---------------------------------------------------------------------------- static void setTriple(Options& opts) { std::string const& pd = opts.Predefines; @@ -133,6 +149,7 @@ static bool detectCC_GNU(const char* const* argBeg, } } } + fixPredefines(opts); setTriple(opts); return true; } else { @@ -173,6 +190,7 @@ static bool detectCC_MSVC(const char* const* argBeg, } } } + fixPredefines(opts); setTriple(opts); return true; } else { |