From 1141eb2c0d21580957de7478c00758b70b734df4 Mon Sep 17 00:00:00 2001 From: firewave Date: Tue, 3 Jan 2023 03:05:37 +0100 Subject: [PATCH] made C++17 check in `simplecpp::preprocess()` more robust --- simplecpp.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/simplecpp.cpp b/simplecpp.cpp index 67dff2c4..90b22005 100755 --- a/simplecpp.cpp +++ b/simplecpp.cpp @@ -2517,6 +2517,12 @@ static void simplifySizeof(simplecpp::TokenList &expr, const std::map= "201703L"); +} + static std::string openHeader(std::ifstream &f, const simplecpp::DUI &dui, const std::string &sourcefile, const std::string &header, bool systemheader); static void simplifyHasInclude(simplecpp::TokenList &expr, const simplecpp::DUI &dui) { @@ -3175,7 +3181,7 @@ void simplecpp::preprocess(simplecpp::TokenList &output, const simplecpp::TokenL sizeOfType.insert(std::make_pair("double *", sizeof(double *))); sizeOfType.insert(std::make_pair("long double *", sizeof(long double *))); - const bool hasInclude = (dui.std.size() == 5 && dui.std.compare(0,3,"c++") == 0 && dui.std >= "c++17"); + const bool hasInclude = isCpp17OrLater(dui); MacroMap macros; for (std::list::const_iterator it = dui.defines.begin(); it != dui.defines.end(); ++it) { const std::string ¯ostr = *it;