PKGBUILDs/extra/libreoffice-still/disable-latest-c++.diff

150 lines
6.2 KiB
Diff
Raw Normal View History

2020-07-04 18:51:53 +00:00
From a9f77e87f3e6ca3333bbb16dec5456f3bf2903b8 Mon Sep 17 00:00:00 2001
From: Stephan Bergmann <sbergman@redhat.com>
Date: Sun, 20 Oct 2019 14:42:56 +0200
Subject: We do not need a C++ GNU dialect
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
1cf7ab61a71d4b7295942ff5c855896e60c15081 "use -std=gnu++0x rather than
-std=c++0x" appears to have started this, but the only rationale it gives is
that it keeps things in sync with GCC's default behavior when no -std= is given.
But it apparently works fine to build with a -std=c++... standard dialect.
This allows to get rid of the check introduced with
50cd28e5728b6a64c1e605567540739ea6ef42ca "Ensure configuration that defines
math_errhandling in <cmath>".
(It kept bothering me to say "I observe this-and-this with -std=c++2a" when what
configure.ac made me actually use was -std=gnu++2a. And truthfully saying
"-std=gnu++2a" would have been a distraction, as what is relevant for such an
observation is most likely the "2a" and not the "gnu" part.)
Change-Id: I7c213a702ffb7df6f4c2c4a421008e30e2712a51
Reviewed-on: https://gerrit.libreoffice.org/81176
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
---
configure.ac | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
(limited to 'configure.ac')
diff --git a/configure.ac b/configure.ac
index 422efbdc7b46..9c8d512be07b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6432,7 +6432,7 @@ CXXFLAGS_CXX11=
if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
CXXFLAGS_CXX11='-std:c++17 -Zc:__cplusplus'
elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
- my_flags='-std=gnu++2a -std=c++2a -std=gnu++17 -std=gnu++1z -std=c++17 -std=c++1z'
+ my_flags='-std=c++2a -std=c++17 -std=c++1z'
for flag in $my_flags; do
if test "$COM" = MSC; then
flag="-Xclang $flag"
@@ -6475,7 +6475,6 @@ elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <algorithm>
- #include <cmath>
#include <functional>
#include <vector>
@@ -6495,13 +6494,6 @@ elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
std::sort(v.begin(), v.end(), fn);
}
-
- // At least with glibc-headers-2.28-26.fc29.x86_64, when building for Linux x86 32-bit
- // (via -m32) and passed-in CXXFLAGS setting -O1 (or higher; overriding -Os as set in
- // solenv/gbuild/platform/LINUX_INTEL_GCC.mk), std=gnu* would cause math_errhandling to
- // get undef'ed in /usr/include/bits/mathinline.h, while std=c* keeps it defined (as
- // needed by sc/source/core/tool/math.cxx):
- int g() { return math_errhandling; }
]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
AC_LANG_POP([C++])
CXXFLAGS=$save_CXXFLAGS
--
cgit v1.2.1
From f0b74640137f07ed74027f98fbf6d1c0d98939bf Mon Sep 17 00:00:00 2001
From: Stephan Bergmann <sbergman@redhat.com>
Date: Mon, 20 Apr 2020 11:40:24 +0200
Subject: Add --with-latest-c++ to explicitly opt in for
-std=c++20/-std:c++latest
Adaptation of this change to this branch. The point is to avoid
compiling as C++2a as the code for externals has not been patched
properly for that here. Here is the original commit message even if I
assume it is a bit misleading in this branch:
cd472d1d8489f30797f47d3f6dafede28c1feb90 "Compile as C++2a, where available" had
started to unconditionally check for support of -std=c++2a (and later also
-std=c++20) for Clang and GCC, but that can cause occasional issues especially
for Linux distros, see e.g. 55c724b93dfd4c9a1afb10d60fbc2d7a9a66cf61 "replace
boost::bimap in sdext pdfimport" or
<https://bugzilla.redhat.com/show_bug.cgi?id=1818723>
"/usr/include/boost/format/alt_sstream_impl.hpp incompatible with -std=c++20
(std::allocator::allocate hint argument)" (where
677c8de4fa79cd9b278b142013ba7f1c9e4e41c3 "external/boost: Adapt to
std::allocator parts removed in C++20" is not picked up due to
--with-system-boost).
So better require an explicit opt-in via a new --with-latest-c++. And while at
it, also make that enable -std:c++latest for MSVC.
Change-Id: I2d1f03144fad9a7884562e56b1b76cab5eb8f080
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92555
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93204
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93692
Tested-by: Tor Lillqvist <tml@collabora.com>
---
configure.ac | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 78080305f3d6..8364138bdc96 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2143,6 +2143,12 @@ libo_FUZZ_ARG_WITH(lxml,
report widget classes and ids.]),
,)
+libo_FUZZ_ARG_WITH(latest-c++,
+ AS_HELP_STRING([--with-latest-c++],
+ [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
+ published standard.]),,
+ [$with_latest_c__=no])
+
dnl ===================================================================
dnl Branding
dnl ===================================================================
@@ -6456,9 +6462,17 @@ dnl ===================================================================
AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
CXXFLAGS_CXX11=
if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
- CXXFLAGS_CXX11='-std:c++17 -Zc:__cplusplus'
+ if test "$with_latest_c__" = yes; then
+ CXXFLAGS_CXX11=-std:c++latest
+ else
+ CXXFLAGS_CXX11=-std:c++17
+ fi
+ CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -Zc:__cplusplus"
elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
- my_flags='-std=c++2a -std=c++17 -std=c++1z'
+ my_flags='-std=c++17 -std=c++1z'
+ if test "$with_latest_c__" = yes; then
+ my_flags="-std=gnu++2a -std=c++2a $my_flags"
+ fi
for flag in $my_flags; do
if test "$COM" = MSC; then
flag="-Xclang $flag"
--
cgit v1.2.1