From fed5128b7f55e947b3bb38905283dfba81da06a2 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Wed, 20 Dec 2017 21:54:47 +0100 Subject: [PATCH] Reverted regex to boost::regex as the C++11 regex seems to be broken on Linux/gcc 4.9. --- xs/src/libslic3r/PlaceholderParser.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/xs/src/libslic3r/PlaceholderParser.cpp b/xs/src/libslic3r/PlaceholderParser.cpp index 58ee09eea..bcd011da2 100644 --- a/xs/src/libslic3r/PlaceholderParser.cpp +++ b/xs/src/libslic3r/PlaceholderParser.cpp @@ -2,7 +2,6 @@ #include #include #include -#include #include #ifdef _MSC_VER #include // provides **_environ @@ -51,6 +50,15 @@ #include #include +// #define USE_CPP11_REGEX +#ifdef USE_CPP11_REGEX + #include + #define SLIC3R_REGEX_NAMESPACE std +#else /* USE_CPP11_REGEX */ + #include + #define SLIC3R_REGEX_NAMESPACE boost +#endif /* USE_CPP11_REGEX */ + namespace Slic3r { PlaceholderParser::PlaceholderParser() @@ -424,13 +432,13 @@ namespace client } try { std::string pattern(++ rhs.begin(), -- rhs.end()); - bool result = std::regex_match(*subject, std::regex(pattern)); + bool result = SLIC3R_REGEX_NAMESPACE::regex_match(*subject, SLIC3R_REGEX_NAMESPACE::regex(pattern)); if (op == '!') result = ! result; lhs.reset(); lhs.type = TYPE_BOOL; lhs.data.b = result; - } catch (std::regex_error &ex) { + } catch (SLIC3R_REGEX_NAMESPACE::regex_error &ex) { // Syntax error in the regular expression boost::throw_exception(qi::expectation_failure( rhs.begin(), rhs.end(), spirit::info(std::string("*Regular expression compilation failed: ") + ex.what())));