GCC only supports inline variables since GCC 7

(see also discussion at <https://gerrit.libreoffice.org/#/c/59204/11> "new
loplugin:conststringfield" about its changes to registry/source/regimpl.cxx)

Change-Id: Id2743adbfeb4d7c42105a65ba8400d7051da2f03
Reviewed-on: https://gerrit.libreoffice.org/59873
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann
2018-08-31 20:14:40 +02:00
parent b5f081e1ac
commit d9998186d3
5 changed files with 28 additions and 3 deletions
+3
View File
@@ -26,6 +26,9 @@ Any change in this header will cause a rebuild of almost everything.
/* Guaranteed copy elision (C++17), __cpp_guaranteed_copy_elision (C++2a): */
#define HAVE_CPP_GUARANTEED_COPY_ELISION 0
/* Inline variables (C++17), __cpp_inline_variables (C++2a): */
#define HAVE_CPP_INLINE_VARIABLES 0
/* Fix for <http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1579> "Return by converting
move constructor": */
#define HAVE_CXX_CWG1579_FIX 0
+19
View File
@@ -6429,6 +6429,25 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
CXXFLAGS=$save_CXXFLAGS
AC_LANG_POP([C++])
AC_MSG_CHECKING([whether $CXX supports inline variables])
AC_LANG_PUSH([C++])
save_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#if !defined __cpp_inline_variables
// This tests for one specific aspect of inline variables that is actually used by by
// ORegistry::ROOT (registry/source/regimpl.cxx):
struct S { constexpr S() {} };
struct T { static constexpr S s{}; };
S const * f() { return &T::s; }
#endif
]])], [
AC_DEFINE([HAVE_CPP_INLINE_VARIABLES],[1])
AC_MSG_RESULT([yes])
], [AC_MSG_RESULT([no])])
CXXFLAGS=$save_CXXFLAGS
AC_LANG_POP([C++])
AC_MSG_CHECKING([whether $CXX has a fix for CWG1579])
AC_LANG_PUSH([C++])
save_CXXFLAGS=$CXXFLAGS
+2 -1
View File
@@ -41,6 +41,7 @@
#include "reflcnst.hxx"
#include "keyimpl.hxx"
#include <config_global.h>
#include <osl/thread.h>
#include <rtl/alloc.h>
#include <rtl/ustring.hxx>
@@ -420,7 +421,7 @@ void dumpType(typereg::Reader const & reader, OString const & indent) {
}
#if __cplusplus <= 201402
#if !HAVE_CPP_INLINE_VARIABLES
constexpr OUStringLiteral ORegistry::ROOT;
#endif
+2 -1
View File
@@ -20,6 +20,7 @@
#include <memory>
#include <stdlib.h>
#include <config_global.h>
#include <svx/svxids.hrc>
#include <i18nlangtag/languagetag.hxx>
#include <svtools/ctrltool.hxx>
@@ -357,7 +358,7 @@ void SvxCSS1BorderInfo::SetBorderLine( SvxBoxItemLine nLine, SvxBoxItem &rBoxIte
rBoxItem.SetLine( &aBorderLine, nLine );
}
#if __cplusplus <= 201402
#if !HAVE_CPP_INLINE_VARIABLES
constexpr sal_uInt16 SvxCSS1PropertyInfo::UNSET_BORDER_DISTANCE;
#endif
+2 -1
View File
@@ -23,6 +23,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/text/XTextTable.hpp>
#include <com/sun/star/table/XCellRange.hpp>
#include <config_global.h>
#include <o3tl/numeric.hxx>
#include <o3tl/make_unique.hxx>
#include <o3tl/safeint.hxx>
@@ -1226,7 +1227,7 @@ public:
}
};
#if __cplusplus <= 201402 || (defined __GNUC__ && __GNUC__ <= 6 && !defined __clang__)
#if !HAVE_CPP_INLINE_VARIABLES
constexpr sal_Int32 SwXMLTableContext::MAX_WIDTH;
#endif