[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master e46db7c 21/28: Work around std::allocator::si
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master e46db7c 21/28: Work around std::allocator::size_type problem in clang 11 libc++ |
Date: |
Wed, 12 May 2021 18:14:45 -0400 (EDT) |
branch: master
commit e46db7cbbea49c80cfd626666c916f43dd62d4dd
Author: Vadim Zeitlin <vadim@tt-solutions.com>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Work around std::allocator::size_type problem in clang 11 libc++
This (and only this) version of libc++ has apparently mistakenly removed
std::allocator::size_type definition, which is still present in C++20,
and requires predefining a special symbol in order to do it -- which we
must do to compile boost/regex.hpp as it (indirectly) uses this type.
Add a configure test checking if we really need to do it and do define
it if it is required.
---
configure.ac | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/configure.ac b/configure.ac
index 1788619..911138d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -365,6 +365,36 @@ dnl Restore pre-wx CPPFLAGS value only now, we needed wx
flags for
dnl wxPdfDocument checks.
CPPFLAGS=$save_CPPFLAGS
+dnl Add clang-specific workaround before checking for Boost, as its headers use
+dnl std::allocator::size_type.
+dnl
+dnl This is necessary because libc++ used by clang 11 mistakenly removed
+dnl std::allocator::size_type, which is finally not removed by C++20. Luckily,
+dnl we still can predefine _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS to
+dnl get its declaration, but we don't want to do this unconditionally because
+dnl this also reintroduces other, really removed, members in later clang
+dnl versions, so only do it if we need it.
+if test "$CLANG" = "yes"; then
+ m4_define([lmi_cxx_alloc_test], [[
+#include <memory>
+std::allocator<char*>::size_type s = 17;
+ ]])
+ AC_CACHE_CHECK([whether clang requires workaround for
std::allocator::size_type],
+ lmi_cv_cxx_alloc_workaround_needed,
+ [
+ AC_LANG_PUSH([C++])
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([lmi_cxx_alloc_test])],
+ lmi_cv_cxx_alloc_workaround_needed=no,
+ [CXXFLAGS="$CXXFLAGS
-D_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([lmi_cxx_alloc_test])],
+ lmi_cv_cxx_alloc_workaround_needed=yes,
+ AC_MSG_ERROR([std::allocator::size_type unavailable]))]
+ )
+ AC_LANG_POP([C++])
+ ]
+ )
+fi
+
dnl --- Boost (required) ---
if test "x$lmi_boost_headers" != "x"; then
CPPFLAGS="$CPPFLAGS -I$lmi_boost_headers"
- [lmi-commits] [lmi] master 2213a23 22/28: Disable clang deprecated declarations warnings in uBLAS headers, (continued)
- [lmi-commits] [lmi] master 2213a23 22/28: Disable clang deprecated declarations warnings in uBLAS headers, Greg Chicares, 2021/05/12
- [lmi-commits] [lmi] master 7e32f37 02/28: Don't build Boost.Filesystem library in the CI builds any more, Greg Chicares, 2021/05/12
- [lmi-commits] [lmi] master 0713a8f 14/28: Don't put NORMAL_UID in the environment unnecessarily, Greg Chicares, 2021/05/12
- [lmi-commits] [lmi] master aa750df 12/28: Work around global_settings_test failure in autotools builds, Greg Chicares, 2021/05/12
- [lmi-commits] [lmi] master 0d89ef3 07/28: Install sudo without using sudo, Greg Chicares, 2021/05/12
- [lmi-commits] [lmi] master 2814dec 11/28: Check for comparison operator defaulting in configure C++ test, Greg Chicares, 2021/05/12
- [lmi-commits] [lmi] master e5160fe 20/28: Revert "Add workaround for Boost.Regex compilation with clang 11", Greg Chicares, 2021/05/12
- [lmi-commits] [lmi] master d09dfce 17/28: Merge lmi directories creation step with the system setup one, Greg Chicares, 2021/05/12
- [lmi-commits] [lmi] master 95c9f72 08/28: Use Debian Wine version in CI job, Greg Chicares, 2021/05/12
- [lmi-commits] [lmi] master 4a1c735 19/28: Rename CI job and build names for brevity and consistency, Greg Chicares, 2021/05/12
- [lmi-commits] [lmi] master e46db7c 21/28: Work around std::allocator::size_type problem in clang 11 libc++,
Greg Chicares <=
- [lmi-commits] [lmi] master 4a09a23 09/28: Work around JRE installation problem in Debian slim container, Greg Chicares, 2021/05/12
- [lmi-commits] [lmi] master 21706da 25/28: Fix expression_template_0_test compilation with clang 12, Greg Chicares, 2021/05/12
- [lmi-commits] [lmi] master c4a85fc 06/28: Install the required packages before checkout in the CI job, Greg Chicares, 2021/05/12
- [lmi-commits] [lmi] master 5d5054f 18/28: Use correct permissions for the Git checkout, Greg Chicares, 2021/05/12
- [lmi-commits] [lmi] master 3a89381 24/28: Create /tmp/.X11-unix directory before running Xvfb, Greg Chicares, 2021/05/12
- [lmi-commits] [lmi] master 5c2b93a 23/28: Install x11-xserver-utils package to get xset, Greg Chicares, 2021/05/12
- [lmi-commits] [lmi] master 2be5478 27/28: Preserve NUL characters in fs::path::string(), Greg Chicares, 2021/05/12