[Libreoffice-commits] core.git: config_host/config_global.h.in configure.ac registry/source sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Aug 31 18:15:08 UTC 2018
config_host/config_global.h.in | 3 +++
configure.ac | 19 +++++++++++++++++++
registry/source/regimpl.cxx | 3 ++-
sw/source/filter/html/svxcss1.cxx | 3 ++-
sw/source/filter/xml/xmltbli.cxx | 3 ++-
5 files changed, 28 insertions(+), 3 deletions(-)
New commits:
commit d9998186d37c58751f45dd7cb97d6c72f901a346
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Aug 31 16:13:18 2018 +0200
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Aug 31 20:14:40 2018 +0200
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 at redhat.com>
diff --git a/config_host/config_global.h.in b/config_host/config_global.h.in
index 2a681264992b..d40630ab99c3 100644
--- a/config_host/config_global.h.in
+++ b/config_host/config_global.h.in
@@ -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
diff --git a/configure.ac b/configure.ac
index 4c968365faaf..3c9e5dc5e908 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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
diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx
index d8a58141fce7..a7647b9d512f 100644
--- a/registry/source/regimpl.cxx
+++ b/registry/source/regimpl.cxx
@@ -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
diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx
index 676792e75069..f153c4999b82 100644
--- a/sw/source/filter/html/svxcss1.cxx
+++ b/sw/source/filter/html/svxcss1.cxx
@@ -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
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 851cee176955..22e2c35b9a22 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -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
More information about the Libreoffice-commits
mailing list