diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-09-10 18:22:32 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-09-11 15:50:50 +0200 |
commit | fcf015832466f4d902e8aeb1466309a1bc230475 (patch) | |
tree | 517808b6262230e30175d1d7a40ddbb822df1c7f | |
parent | 2f1a28cf8fcfdfc369cf91936062c4f942ec03dd (diff) |
(Rudimentary) C++11 support is a hard requirement now
Change-Id: I43ed776d52336b822aa6152f0f2a29e39303bb75
-rw-r--r-- | config_host.mk.in | 1 | ||||
-rw-r--r-- | config_host/config_global.h.in | 2 | ||||
-rw-r--r-- | configure.ac | 195 | ||||
-rw-r--r-- | helpcompiler/inc/HelpCompiler.hxx | 5 | ||||
-rw-r--r-- | include/osl/diagnose.hxx | 5 | ||||
-rw-r--r-- | solenv/gbuild/platform/macosx.mk | 2 | ||||
-rw-r--r-- | solenv/gbuild/platform/mingw.mk | 6 | ||||
-rw-r--r-- | solenv/gbuild/platform/solaris.mk | 9 | ||||
-rw-r--r-- | solenv/gbuild/platform/unxgcc.mk | 9 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/databases.hxx | 5 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/db.hxx | 4 |
11 files changed, 92 insertions, 151 deletions
diff --git a/config_host.mk.in b/config_host.mk.in index c3aa2e4d7eea..40865e78e23d 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -241,7 +241,6 @@ export GTK_PRINT_CFLAGS=$(gb_SPACE)@GTK_PRINT_CFLAGS@ export GTK_PRINT_LIBS=$(gb_SPACE)@GTK_PRINT_LIBS@ export GUIBASE=@GUIBASE@ export HARDLINKDELIVER=@HARDLINKDELIVER@ -export HAVE_CXX11=@HAVE_CXX11@ export HAVE_GCC_AVX=@HAVE_GCC_AVX@ export HAVE_GCC_BUILTIN_ATOMIC=@HAVE_GCC_BUILTIN_ATOMIC@ export HAVE_GCC_FINLINE_LIMIT=@HAVE_GCC_FINLINE_LIMIT@ diff --git a/config_host/config_global.h.in b/config_host/config_global.h.in index 88b7a1f7a4ff..929e5a0b5b8c 100644 --- a/config_host/config_global.h.in +++ b/config_host/config_global.h.in @@ -12,8 +12,6 @@ Any change in this header will cause a rebuild of almost everything. #ifndef CONFIG_GLOBAL_H #define CONFIG_GLOBAL_H -/* Prefer using a feature-specific check such as HAVE_CXX11_DELETE to the generic HAVE_CXX11. */ -#define HAVE_CXX11 0 #define HAVE_CXX11_DELETE 0 #define HAVE_CXX11_OVERRIDE 0 #define HAVE_CXX11_FINAL 0 diff --git a/configure.ac b/configure.ac index 48e24908a22a..84d697b422ed 100644 --- a/configure.ac +++ b/configure.ac @@ -6109,14 +6109,13 @@ dnl C++11 dnl =================================================================== CXXFLAGS_CXX11= -HAVE_CXX11= if test "$COM" = MSC; then AC_MSG_CHECKING([whether $CXX supports C++11]) AC_MSG_RESULT(yes) # MSVC supports (a subset of) CXX11 without any switch - HAVE_CXX11=TRUE CXXFLAGS_CXX11= elif test "$GCC" = "yes"; then + HAVE_CXX11= CXXFLAGS_CXX11= AC_MSG_CHECKING([whether $CXX supports C++11]) for flag in -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x ; do @@ -6134,7 +6133,7 @@ elif test "$GCC" = "yes"; then if test "$HAVE_CXX11" = TRUE; then AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)]) else - AC_MSG_RESULT(no) + AC_MSG_ERROR(no) fi fi @@ -6143,7 +6142,7 @@ dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced dnl an additional member _M_size into C++11 std::list towards 4.7.0 and dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it dnl again towards 4.7.2: -if test $CPP_LIBRARY = GLIBCXX -a "$HAVE_CXX11" = TRUE; then +if test $CPP_LIBRARY = GLIBCXX; then AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage]) AC_LANG_PUSH([C++]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ @@ -6159,18 +6158,16 @@ if test $CPP_LIBRARY = GLIBCXX -a "$HAVE_CXX11" = TRUE; then abi broken #endif ]])], [AC_MSG_RESULT(no, ok)], - [AC_MSG_RESULT(yes, disabling C++11) - HAVE_CXX11=]) + [AC_MSG_ERROR(yes)]) AC_LANG_POP([C++]) fi -if test "$HAVE_CXX11" = TRUE; then - AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757]) - save_CXXFLAGS=$CXXFLAGS - CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11" - AC_LANG_PUSH([C++]) +AC_MSG_CHECKING([whether $CXX supports C++11 without Language Defect 757]) +save_CXXFLAGS=$CXXFLAGS +CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11" +AC_LANG_PUSH([C++]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stddef.h> template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S]; @@ -6195,21 +6192,17 @@ size_t i = sizeof(sal_n_array_size(thinga)); size_t j = sizeof(sal_n_array_size(thingb)); return !(i != 0 && j != 0); ]]) - ], [ AC_MSG_RESULT(yes) ], - [ AC_MSG_RESULT(no) - HAVE_CXX11= - ]) - AC_LANG_POP([C++]) - CXXFLAGS=$save_CXXFLAGS -fi + ], [ AC_MSG_RESULT(yes) ], + [ AC_MSG_ERROR(no)]) +AC_LANG_POP([C++]) +CXXFLAGS=$save_CXXFLAGS -if test "$HAVE_CXX11" = TRUE; then - AC_MSG_CHECKING([whether $CXX supports C++11 without __float128 compile error]) - save_CXXFLAGS=$CXXFLAGS - CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11" - AC_LANG_PUSH([C++]) +AC_MSG_CHECKING([whether $CXX supports C++11 without __float128 compile error]) +save_CXXFLAGS=$CXXFLAGS +CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11" +AC_LANG_PUSH([C++]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <vector> // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x // (__float128) @@ -6231,35 +6224,23 @@ if test "$HAVE_CXX11" = TRUE; then // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x // (__float128) ]]) - ], - [ - AC_MSG_RESULT(yes) - CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -D__float128=void" - ], - [ - AC_MSG_RESULT(no) - HAVE_CXX11= - ]) + ], + [ + AC_MSG_RESULT(yes) + CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -D__float128=void" + ], + [ + AC_MSG_ERROR(no) ]) +]) - AC_LANG_POP([C++]) - CXXFLAGS=$save_CXXFLAGS -fi - -if test "$HAVE_CXX11" = "TRUE"; then - AC_DEFINE(HAVE_CXX11) -elif test -n "$CXXFLAGS_CXX11"; then - AC_MSG_NOTICE([Disabling C++11 support]) - CXXFLAGS_CXX11= -elif test "$CPP_LIBRARY" = LIBCPP -a $_os = Darwin; then - AC_MSG_ERROR([Selected libc++ but C++11 support broken]) -fi +AC_LANG_POP([C++]) +CXXFLAGS=$save_CXXFLAGS AC_SUBST(CXXFLAGS_CXX11) -AC_SUBST(HAVE_CXX11) AC_MSG_CHECKING([for std::shared_ptr]) -if test "$HAVE_CXX11" = "TRUE" -a "$GCC" = "yes"; then +if test "$GCC" = "yes"; then save_CXXFLAGS=$CXXFLAGS CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11" AC_LANG_PUSH([C++]) @@ -6283,38 +6264,35 @@ dnl ================================== dnl Check for C++11 "= delete" support dnl ================================== -if test "$HAVE_CXX11" = "TRUE"; then - AC_MSG_CHECKING([whether $CXX supports C++11 = delete syntax]) - save_CXXFLAGS=$CXXFLAGS - CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11" - AC_LANG_PUSH([C++]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +AC_MSG_CHECKING([whether $CXX supports C++11 = delete syntax]) +save_CXXFLAGS=$CXXFLAGS +CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11" +AC_LANG_PUSH([C++]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ struct A { void test() = delete; }; ]])],[HAVE_CXX11_DELETE=TRUE],[]) - AC_LANG_POP([C++]) - CXXFLAGS=$save_CXXFLAGS - if test "$HAVE_CXX11_DELETE" = "TRUE"; then - AC_MSG_RESULT([yes]) - AC_DEFINE([HAVE_CXX11_DELETE]) - else - AC_MSG_RESULT([no]) - fi +AC_LANG_POP([C++]) +CXXFLAGS=$save_CXXFLAGS +if test "$HAVE_CXX11_DELETE" = "TRUE"; then + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_CXX11_DELETE]) +else + AC_MSG_RESULT([no]) fi dnl ================================== dnl Check for C++11 "override" support dnl ================================== -if test "$HAVE_CXX11" = "TRUE"; then - AC_MSG_CHECKING([whether $CXX supports C++11 "override" syntax]) - save_CXXFLAGS=$CXXFLAGS - CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11" - AC_LANG_PUSH([C++]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +AC_MSG_CHECKING([whether $CXX supports C++11 "override" syntax]) +save_CXXFLAGS=$CXXFLAGS +CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11" +AC_LANG_PUSH([C++]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ struct A { virtual void test(); @@ -6326,26 +6304,24 @@ struct B : A }; ]])],[HAVE_CXX11_OVERRIDE=TRUE],[]) - AC_LANG_POP([C++]) - CXXFLAGS=$save_CXXFLAGS - if test "$HAVE_CXX11_OVERRIDE" = "TRUE"; then - AC_MSG_RESULT([yes]) - AC_DEFINE([HAVE_CXX11_OVERRIDE]) - else - AC_MSG_RESULT([no]) - fi +AC_LANG_POP([C++]) +CXXFLAGS=$save_CXXFLAGS +if test "$HAVE_CXX11_OVERRIDE" = "TRUE"; then + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_CXX11_OVERRIDE]) +else + AC_MSG_RESULT([no]) fi dnl ================================== dnl Check for C++11 "final" support dnl ================================== -if test "$HAVE_CXX11" = "TRUE"; then - AC_MSG_CHECKING([whether $CXX supports C++11 "final" syntax]) - save_CXXFLAGS=$CXXFLAGS - CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11" - AC_LANG_PUSH([C++]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +AC_MSG_CHECKING([whether $CXX supports C++11 "final" syntax]) +save_CXXFLAGS=$CXXFLAGS +CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11" +AC_LANG_PUSH([C++]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ // First check that this correct program that uses "final" compiles struct A final { @@ -6362,7 +6338,7 @@ struct C : B }; ]])],[have_final=yes],[]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ // Then check that the "final" works as expected, // that this program fails to compile struct A final @@ -6374,7 +6350,7 @@ struct B : A }; ]])],[],[final_class_works=yes]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ // Also this should fail to compile struct B { @@ -6391,40 +6367,37 @@ struct D : C void test(); }; ]])],[],[final_method_works=yes]) - AC_LANG_POP([C++]) +AC_LANG_POP([C++]) - CXXFLAGS=$save_CXXFLAGS +CXXFLAGS=$save_CXXFLAGS - if test "$have_final" = yes -a "$final_class_works" = yes -a "$final_method_works" = yes; then - AC_MSG_RESULT([yes]) - AC_DEFINE([HAVE_CXX11_FINAL]) - else - AC_MSG_RESULT([no]) - fi +if test "$have_final" = yes -a "$final_class_works" = yes -a "$final_method_works" = yes; then + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_CXX11_FINAL]) +else + AC_MSG_RESULT([no]) fi dnl =================================================================== dnl Check for C++11 perfect forwarding support dnl =================================================================== -if test "$HAVE_CXX11" = "TRUE"; then - AC_MSG_CHECKING([whether $CXX supports C++11 perfect forwarding]) - save_CXXFLAGS=$CXXFLAGS - CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11" - AC_LANG_PUSH([C++]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include <utility> - template<typename T, typename... Args> T * f(Args &&... v) { - return new T(std::forward<Args>(v)...); - } - ]], [[ - f<int>(0); - ]])], [perfect_forwarding=yes], [perfect_forwarding=no]) - AC_LANG_POP([C++]) - CXXFLAGS=$save_CXXFLAGS - AC_MSG_RESULT([$perfect_forwarding]) - if test "$perfect_forwarding" = yes; then - AC_DEFINE([HAVE_CXX11_PERFECT_FORWARDING]) - fi +AC_MSG_CHECKING([whether $CXX supports C++11 perfect forwarding]) +save_CXXFLAGS=$CXXFLAGS +CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11" +AC_LANG_PUSH([C++]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #include <utility> + template<typename T, typename... Args> T * f(Args &&... v) { + return new T(std::forward<Args>(v)...); + } + ]], [[ + f<int>(0); + ]])], [perfect_forwarding=yes], [perfect_forwarding=no]) +AC_LANG_POP([C++]) +CXXFLAGS=$save_CXXFLAGS +AC_MSG_RESULT([$perfect_forwarding]) +if test "$perfect_forwarding" = yes; then + AC_DEFINE([HAVE_CXX11_PERFECT_FORWARDING]) fi HAVE_GCC_PRAGMA_OPERATOR= diff --git a/helpcompiler/inc/HelpCompiler.hxx b/helpcompiler/inc/HelpCompiler.hxx index 206130ed6081..b66248e99ce4 100644 --- a/helpcompiler/inc/HelpCompiler.hxx +++ b/helpcompiler/inc/HelpCompiler.hxx @@ -20,12 +20,9 @@ #ifndef INCLUDED_HELPCOMPILER_INC_HELPCOMPILER_HXX #define INCLUDED_HELPCOMPILER_INC_HELPCOMPILER_HXX -#include <config_global.h> +#include <sal/config.h> #include <string> -#if !HAVE_CXX11 -#define BOOST_NO_0X_HDR_TYPEINDEX -#endif #include <boost/unordered_map.hpp> #include <vector> #include <list> diff --git a/include/osl/diagnose.hxx b/include/osl/diagnose.hxx index 04eb986282a7..e93573a49425 100644 --- a/include/osl/diagnose.hxx +++ b/include/osl/diagnose.hxx @@ -26,11 +26,6 @@ #include <functional> #include <typeinfo> -#include <config_global.h> - -#if !HAVE_CXX11 -#define BOOST_NO_0X_HDR_TYPEINDEX -#endif #include <boost/unordered_set.hpp> #include <osl/diagnose.h> #include <osl/interlck.h> diff --git a/solenv/gbuild/platform/macosx.mk b/solenv/gbuild/platform/macosx.mk index fa7be036280f..3d407300cc60 100644 --- a/solenv/gbuild/platform/macosx.mk +++ b/solenv/gbuild/platform/macosx.mk @@ -56,7 +56,7 @@ gb_CXXFLAGS := \ -Wno-non-virtual-dtor \ -fno-strict-aliasing \ -fsigned-char \ - $(if $(filter TRUE,$(HAVE_CXX11)),$(CXXFLAGS_CXX11)) + $(CXXFLAGS_CXX11) #-Wshadow \ break in compiler headers already #-fsigned-char \ might be removed? diff --git a/solenv/gbuild/platform/mingw.mk b/solenv/gbuild/platform/mingw.mk index edfdee58b7e7..97196162c29c 100644 --- a/solenv/gbuild/platform/mingw.mk +++ b/solenv/gbuild/platform/mingw.mk @@ -47,17 +47,13 @@ gb_CXXFLAGS := \ -Wshadow \ -Wuninitialized \ -fno-strict-aliasing \ - + -std=gnu++0x \ ifneq ($(SYSBASE),) gb_CXXFLAGS += --sysroot=$(SYSBASE) gb_CFLAGS += --sysroot=$(SYSBASE) endif -ifeq ($(HAVE_CXX11),TRUE) -gb_CXXFLAGS += -std=gnu++0x -endif - # At least sal defines its own __main, which would cause DLLs linking against # sal to pick up sal's __main instead of the one from MinGW's dllcrt2.o: gb_LinkTarget_LDFLAGS := \ diff --git a/solenv/gbuild/platform/solaris.mk b/solenv/gbuild/platform/solaris.mk index a781a6c88a48..94deeef76f41 100644 --- a/solenv/gbuild/platform/solaris.mk +++ b/solenv/gbuild/platform/solaris.mk @@ -62,6 +62,7 @@ gb_CXXFLAGS := \ -Wshadow \ -Woverloaded-virtual \ -Wno-non-virtual-dtor \ + -std=c++0x \ # enable debug STL ifeq ($(gb_ENABLE_DBGUTIL),$(true)) @@ -83,22 +84,16 @@ gb_CXXFLAGS += -fno-strict-aliasing endif endif -ifeq ($(HAVE_CXX11),TRUE) -#Currently, as well as for its own merits, c++11/c++0x mode allows use to use -#a template for SAL_N_ELEMENTS to detect at compiler time its misuse -gb_CXXFLAGS += -std=c++0x - #We have so many std::auto_ptr uses that we need to be able to disable #warnings for those so that -Werror continues to be useful, seeing as moving #to unique_ptr isn't an option when we must support different compilers - +# #When we are using 4.6.0 we can use gcc pragmas to selectively silence auto_ptr #warnings in isolation, but for <= 4.5.X we need to globally disable #deprecation ifeq ($(HAVE_GCC_PRAGMA_OPERATOR),) gb_CXXFLAGS += -Wno-deprecated-declarations endif -endif ifneq ($(strip $(SYSBASE)),) gb_CXXFLAGS += --sysroot=$(SYSBASE) diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk index 94526abcdeb4..df68e948891b 100644 --- a/solenv/gbuild/platform/unxgcc.mk +++ b/solenv/gbuild/platform/unxgcc.mk @@ -43,6 +43,7 @@ gb_CXXFLAGS := \ -fPIC \ -Wshadow \ -Woverloaded-virtual \ + $(CXXFLAGS_CXX11) \ ifeq ($(COM_GCC_IS_CLANG),) gb_GccLess460 := $(shell expr $(GCC_VERSION) \< 406) @@ -79,22 +80,16 @@ gb_COMPILERDEFS += \ endif -ifeq ($(HAVE_CXX11),TRUE) -#Currently, as well as for its own merits, c++11/c++0x mode allows use to use -#a template for SAL_N_ELEMENTS to detect at compiler time its misuse -gb_CXXFLAGS += $(CXXFLAGS_CXX11) - #We have so many std::auto_ptr uses that we need to be able to disable #warnings for those so that -Werror continues to be useful, seeing as moving #to unique_ptr isn't an option when we must support different compilers - +# #When we are using 4.6.0 we can use gcc pragmas to selectively silence auto_ptr #warnings in isolation, but for <= 4.5.X we need to globally disable #deprecation ifeq ($(HAVE_GCC_PRAGMA_OPERATOR),) gb_CXXFLAGS += -Wno-deprecated-declarations endif -endif ifneq ($(strip $(SYSBASE)),) gb_CXXFLAGS += --sysroot=$(SYSBASE) diff --git a/xmlhelp/source/cxxhelp/provider/databases.hxx b/xmlhelp/source/cxxhelp/provider/databases.hxx index d161c60262df..366a914cbc6d 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.hxx +++ b/xmlhelp/source/cxxhelp/provider/databases.hxx @@ -20,13 +20,10 @@ #ifndef INCLUDED_XMLHELP_SOURCE_CXXHELP_PROVIDER_DATABASES_HXX #define INCLUDED_XMLHELP_SOURCE_CXXHELP_PROVIDER_DATABASES_HXX -#include <config_global.h> +#include <sal/config.h> #include <set> #include <vector> -#if !HAVE_CXX11 -#define BOOST_NO_0X_HDR_TYPEINDEX -#endif #include <boost/unordered_map.hpp> #include <boost/unordered_set.hpp> #include <osl/mutex.hxx> diff --git a/xmlhelp/source/cxxhelp/provider/db.hxx b/xmlhelp/source/cxxhelp/provider/db.hxx index 6abcdcdcd939..5d5823c00dea 100644 --- a/xmlhelp/source/cxxhelp/provider/db.hxx +++ b/xmlhelp/source/cxxhelp/provider/db.hxx @@ -21,10 +21,6 @@ #include <com/sun/star/ucb/XSimpleFileAccess3.hpp> -#include <config_global.h> -#if !HAVE_CXX11 -#define BOOST_NO_0X_HDR_TYPEINDEX -#endif #include <boost/unordered_map.hpp> #include <rtl/string.hxx> |