mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +00:00
Use std::regex if possible
It works with gcc >= 4.9.0 and clang (with libc++ or gcc libstdc++ from gcc >= 4.9.0). The MSVC parg is missing, because I cannot test it, and the autotools build still link against boost::regex even if it is not needed, but I don't know how to fix that.
This commit is contained in:
parent
dae8555234
commit
394e1bf99c
@ -246,12 +246,11 @@ set(LYX_GCC11_MODE)
|
||||
if(UNIX OR MINGW)
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
|
||||
message(STATUS "Using GCC version ${GCC_VERSION}")
|
||||
# disabled because of missing match_partial
|
||||
# if(GCC_VERSION VERSION_LESS 4.9)
|
||||
if(GCC_VERSION VERSION_LESS 4.9)
|
||||
# <regex> in gcc is unusable in versions less than 4.9.0
|
||||
# see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53631
|
||||
set(LYX_USE_STD_REGEX 0)
|
||||
# endif()
|
||||
endif()
|
||||
if (LYX_ENABLE_CXX11)
|
||||
find_package(CXX11Compiler)
|
||||
if(NOT CXX11COMPILER_FOUND)
|
||||
@ -260,7 +259,6 @@ if(UNIX OR MINGW)
|
||||
set(LYX_GCC11_MODE "${CXX11_FLAG}")
|
||||
endif()
|
||||
else()
|
||||
# disabled because of missing match_partial
|
||||
set(LYX_USE_STD_REGEX 0)
|
||||
# if(MSVC10)
|
||||
# set(LYX_USE_STD_REGEX 1) #TODO should we use it in ECMAScript mode?
|
||||
|
11
configure.ac
11
configure.ac
@ -287,12 +287,11 @@ char * strerror(int n);
|
||||
// <regex> in gcc is unusable in versions less than 4.9.0
|
||||
// see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53631
|
||||
// clang defines __GNUC__ but how do the versions match?
|
||||
// disabled because of missing match_partial
|
||||
//#ifndef LYX_USE_STD_REGEX
|
||||
//# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 9) || __GNUC__ > 4 || defined(USE_LLVM_LIBCPP)
|
||||
//# define LYX_USE_STD_REGEX
|
||||
//# endif
|
||||
//#endif
|
||||
#ifndef LYX_USE_STD_REGEX
|
||||
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 9) || __GNUC__ > 4 || defined(USE_LLVM_LIBCPP)
|
||||
# define LYX_USE_STD_REGEX
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
# define NOMINMAX
|
||||
|
@ -18,6 +18,8 @@
|
||||
namespace lyx {
|
||||
// inheriting 'private' to see which functions are used and if there are
|
||||
// other ECMAScrip defaults
|
||||
// FIXME: Is this really needed?
|
||||
// If yes, then the MSVC regex implementation is not standard-conforming.
|
||||
class regex : private std::regex
|
||||
{
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user