Kaydet (Commit) 50d248aa authored tarafından Luboš Luňák's avatar Luboš Luňák

work around the C++11 __float128 problem with libstdc++ headers and clang

Change-Id: Ia1b443d22b3b7f6f93f1ad8c5fa760b0f1da3b83
üst 44159c6c
......@@ -73,7 +73,7 @@ CLANGOBJS=
define clangbuildsrc
$(3): $(2) $(SRCDIR)/compilerplugins/Makefile-clang.mk $(CLANGOUTDIR)/clang-timestamp
@echo [build CXX] $(subst $(SRCDIR)/,,$(2))
$(QUIET)$(CXX) $(CLANGCXXFLAGS) $(CLANGWERROR) $(CLANGDEFS) $(CLANGINCLUDES) -I$(BUILDDIR)/config_host $(2) -fPIC -std=c++11 -c -o $(3) -MMD -MT $(3) -MP -MF $(CLANGOUTDIR)/$(1).d
$(QUIET)$(CXX) $(CLANGCXXFLAGS) $(CLANGWERROR) $(CLANGDEFS) $(CLANGINCLUDES) -I$(BUILDDIR)/config_host $(2) -fPIC $(CXXFLAGS_CXX11) -c -o $(3) -MMD -MT $(3) -MP -MF $(CLANGOUTDIR)/$(1).d
-include $(CLANGOUTDIR)/$(1).d
......
......@@ -5647,8 +5647,31 @@ return !(i != 0 && j != 0);
// (__float128)
]])
],[ AC_MSG_RESULT(yes) ],
[ AC_MSG_RESULT(no)
HAVE_CXX11=
[
AC_MSG_RESULT(no)
# The only reason why libstdc++ headers fail with Clang in C++11 mode is because
# they use the __float128 type that Clang doesn't know (libstdc++ checks whether
# __float128 is available during its build, but it's usually built using GCC,
# and so c++config.h hardcodes __float128 being supported). As the only place
# where __float128 is actually used is in a template specialization,
# -D__float128=void will avoid the problem there while still causing a problem
# if somebody actually uses the type.
AC_MSG_CHECKING([whether -D__float128=void workaround helps])
CXXFLAGS="$CXXFLAGS -D__float128=void"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <vector>
// some Clang fail when compiling against GCC 4.7 headers with -std=gnu++0x
// (__float128)
]])
],
[
AC_MSG_RESULT(yes)
CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -D__float128=void"
],
[
AC_MSG_RESULT(no)
HAVE_CXX11=
])
])
AC_LANG_POP([C++])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment