@@ -2673,13 +2673,16 @@ static void simplifySizeof(simplecpp::TokenList &expr, const std::map<std::strin
26732673 }
26742674}
26752675
2676- /* * Evaluate __has_include(file) */
26772676static bool isCpp17OrLater (const simplecpp::DUI &dui)
26782677{
26792678 const std::string std_ver = simplecpp::getCppStdString (dui.std );
26802679 return !std_ver.empty () && (std_ver >= " 201703L" );
26812680}
26822681
2682+ static bool isGnu (const simplecpp::DUI &dui)
2683+ {
2684+ return dui.std .rfind (" gnu" , 0 ) != std::string::npos;
2685+ }
26832686
26842687static std::string currentDirectoryOSCalc () {
26852688 const std::size_t size = 4096 ;
@@ -2752,7 +2755,7 @@ static std::string extractRelativePathFromAbsolute(const std::string& absoluteSi
27522755static std::string openHeader (std::ifstream &f, const simplecpp::DUI &dui, const std::string &sourcefile, const std::string &header, bool systemheader);
27532756static void simplifyHasInclude (simplecpp::TokenList &expr, const simplecpp::DUI &dui)
27542757{
2755- if (!isCpp17OrLater (dui))
2758+ if (!isCpp17OrLater (dui) && ! isGnu (dui) )
27562759 return ;
27572760
27582761 for (simplecpp::Token *tok = expr.front (); tok; tok = tok->next ) {
@@ -3475,7 +3478,7 @@ void simplecpp::preprocess(simplecpp::TokenList &output, const simplecpp::TokenL
34753478 // use a dummy vector for the macros because as this is not part of the file and would add an empty entry - e.g. /usr/include/poll.h
34763479 std::vector<std::string> dummy;
34773480
3478- const bool hasInclude = isCpp17OrLater (dui);
3481+ const bool hasInclude = isCpp17OrLater (dui) || isGnu (dui) ;
34793482 MacroMap macros;
34803483 for (std::list<std::string>::const_iterator it = dui.defines .begin (); it != dui.defines .end (); ++it) {
34813484 const std::string ¯ostr = *it;
0 commit comments