From fa23bb7cc073f70587b82c6d21be37765bbb5749 Mon Sep 17 00:00:00 2001 From: Axel Naumann <Axel.Naumann@cern.ch> Date: Mon, 6 May 2013 17:22:16 +0200 Subject: [PATCH] Automatically and centrally detect C++11-mode based on how CIFactory.cpp is compiled; turn on cling's LangOpt.CPlusPlus11 accordingly. No need to rely on ROOT's config flag anymore. --- core/meta/src/TCling.cxx | 3 --- core/utils/src/rootcling.cxx | 3 --- interpreter/cling/lib/Interpreter/CIFactory.cpp | 12 ++++++++++++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/core/meta/src/TCling.cxx b/core/meta/src/TCling.cxx index ad40eafd805..0ce5a3e4223 100644 --- a/core/meta/src/TCling.cxx +++ b/core/meta/src/TCling.cxx @@ -788,9 +788,6 @@ TCling::TCling(const char *name, const char *title) , "-cxx-isystem", sysIncludePath.c_str() , "-I", sysIncludePath1.c_str() , "-I", sysIncludePath2.c_str() -#endif -#ifdef R__USE_CXX11 - , "-std=c++11" #endif }; //"-Xclang", "-fmodules"}; diff --git a/core/utils/src/rootcling.cxx b/core/utils/src/rootcling.cxx index 11307c2932c..cdd8d53eb93 100644 --- a/core/utils/src/rootcling.cxx +++ b/core/utils/src/rootcling.cxx @@ -4496,9 +4496,6 @@ int main(int argc, char **argv) clingArgs.push_back("-I"); clingArgs.push_back(std::string(R__GCC_TOOLCHAIN) + "/include/c++/4.6.2/x86_64-unknown-linux-gnu"); #endif -#ifdef R__USE_CXX11 - clingArgs.push_back("-std=c++11"); -#endif std::vector<const char*> clingArgsC; for (size_t iclingArgs = 0, nclingArgs = clingArgs.size(); diff --git a/interpreter/cling/lib/Interpreter/CIFactory.cpp b/interpreter/cling/lib/Interpreter/CIFactory.cpp index fc056b50e78..5ed73d5fe44 100644 --- a/interpreter/cling/lib/Interpreter/CIFactory.cpp +++ b/interpreter/cling/lib/Interpreter/CIFactory.cpp @@ -295,6 +295,18 @@ namespace cling { Opts.CXXExceptions = 1; Opts.Deprecated = 1; //Opts.Modules = 1; + + // C++11 is turned on if cling is built with C++11: it's an interperter; + // cross-language compilation doesn't make sense. + // Extracted from Boost/config/compiler. + // SunProCC has no C++11. + // VisualC's support is not obvious to extract from Boost... +#if /*GCC*/ (defined(__GNUC__) && defined(__GXX_EXPERIMENTAL_CXX0X__)) \ + || /*clang*/ (defined(__has_feature) && __has_feature(cxx_decltype)) \ + || /*ICC*/ ((!(defined(_WIN32) || defined(_WIN64)) && defined(__STDC_HOSTED__) && (__STDC_HOSTED__ && (__INTEL_COMPILER <= 1200))) || defined(__GXX_EXPERIMENTAL_CPP0X__)) + Opts.CPlusPlus11 = 1; +#endif + } void CIFactory::SetClingTargetLangOpts(LangOptions& Opts, -- GitLab