commit c916bd15022dd607994204a03955025272c988cb
Author: Jean-Marc Lasgouttes <[email protected]>
Date: Tue Oct 22 17:03:18 2024 +0200
Require C++17
Add a test that requires <any> header.
Update documentation.
Remove test for C++14.
Typical gcc version we have in mind is gcc 8.
---
INSTALL | 2 +-
config/lyxinclude.m4 | 27 +++++++++++++++------------
src/MetricsInfo.cpp | 6 ------
3 files changed, 16 insertions(+), 19 deletions(-)
diff --git a/INSTALL b/INSTALL
index 9d505dff33..61811cc3d7 100644
--- a/INSTALL
+++ b/INSTALL
@@ -52,7 +52,7 @@ You will also probably need GNU m4 (perhaps installed as gm4).
Requirements
------------
-First of all, you will need a C++11 standard conforming compiler, like
+First of all, you will need a C++17 standard conforming compiler, like
g++ (at least 5.0, to have proper std::regex & std::string) or
clang++.
diff --git a/config/lyxinclude.m4 b/config/lyxinclude.m4
index 2d6ceccb83..154fe16072 100644
--- a/config/lyxinclude.m4
+++ b/config/lyxinclude.m4
@@ -161,12 +161,12 @@ fi
])
-dnl Usage: LYX_CXX_CXX11_FLAGS(VERSION): add to AM_CXXFLAGS the best flag that
-dnl selects C++11 mode; gives an error when C++11 mode is not found.
-dnl VERSION is a list of years to try (e.g. 11 or {14,11}).
-AC_DEFUN([LYX_CXX_CXX11_FLAGS],
-[AC_CACHE_CHECK([for a good C++ mode], [lyx_cv_cxx11_flags],
- [lyx_cv_cxx11_flags=none
+dnl Usage: LYX_CXX_CXX17_FLAGS(VERSION): add to AM_CXXFLAGS the best flag that
+dnl selects C++17 mode; gives an error when C++17 mode is not found.
+dnl VERSION is a list of years to try (e.g. 17 or {20,17}).
+AC_DEFUN([LYX_CXX_CXX17_FLAGS],
+[AC_CACHE_CHECK([for a good C++ mode], [lyx_cv_cxx17_flags],
+ [lyx_cv_cxx17_flags=none
for flag in `eval echo -std=c++$1 default -std=gnu++$1` ; do
if test $flag = default ; then
flag=
@@ -199,14 +199,17 @@ AC_DEFUN([LYX_CXX_CXX11_FLAGS],
check_type c;
check_type&& cr = static_cast<check_type&&>(c);
- auto d = a;]], [[]])],[lyx_cv_cxx11_flags=$flag; break],[])
+ auto d = a;
+
+ #include <any>
+ std::any any_var = 10;]], [[]])],[lyx_cv_cxx17_flags=$flag; break],[])
CXXFLAGS=$save_CXXFLAGS
CPPFLAGS=$save_CPPFLAGS
done])
- if test x$lyx_cv_cxx11_flags = xnone ; then
+ if test x$lyx_cv_cxx17_flags = xnone ; then
AC_MSG_ERROR([Cannot find suitable mode for compiler $CXX])
fi
- AM_CXXFLAGS="$lyx_cv_cxx11_flags $AM_CXXFLAGS"
+ AM_CXXFLAGS="$lyx_cv_cxx17_flags $AM_CXXFLAGS"
])
@@ -228,13 +231,13 @@ AC_REQUIRE([AC_PROG_CXXCPP])
### We might want to force the C++ standard.
AC_ARG_ENABLE(cxx-mode,
- AS_HELP_STRING([--enable-cxx-mode],[choose C++ standard (default: 17, 14,
then 11)]),,
- [enable_cxx_mode={17,14,11}]
+ AS_HELP_STRING([--enable-cxx-mode],[choose C++ standard (default: 17)]),,
+ [enable_cxx_mode={17}]
)
AC_LANG_PUSH(C++)
LYX_PROG_CLANG
-LYX_CXX_CXX11_FLAGS($enable_cxx_mode)
+LYX_CXX_CXX17_FLAGS($enable_cxx_mode)
LYX_LIB_STDCXX
AC_LANG_POP(C++)
diff --git a/src/MetricsInfo.cpp b/src/MetricsInfo.cpp
index 3fa8973e01..d9e1453b19 100644
--- a/src/MetricsInfo.cpp
+++ b/src/MetricsInfo.cpp
@@ -80,13 +80,7 @@ Changer MetricsBase::changeFontSet(string const & name)
&& ((isTextFont(oldname) && oldcolor != Color_foreground)
|| (isMathFont(oldname) && oldcolor != Color_math)))
font.setColor(oldcolor);
-#if __cplusplus >= 201402L
return rc;
-#else
- /** In theory, this is not needed with C++11, and modern compilers
- * will complain in C++11 mode, but gcc 4.9 requires this. */
- return std::move(rc);
-#endif
}
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs