From e79d6616ddb97f0ca37fd5095f1cbe44fe9759c9 Mon Sep 17 00:00:00 2001 From: "Bobby R. Bruce" Date: Mon, 10 Apr 2023 17:07:18 -0700 Subject: [PATCH] base: Use include for GCC v7 gem5 officially supports GCC 7+. In GCC 7 the "filesystem" module was added but only in the "experimental" namespace as "". In GCC 8+ the module can be found as "". Because of this, include guards to handle this. They include "" for the GCC v7 case and the "" for all other versions. This bug was partially responsible for this compiler tests failures: https://jenkins.gem5.org/job/compiler-checks/570 Note: gem5 does not support GCC versions <7. Thus the "#if __GNUC__ >=8 #else #endif" logic is valid. Change-Id: I31db5488f272f9652edebf24ecefca3722369076 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/69598 Tested-by: kokoro Reviewed-by: Bobby Bruce Maintainer: Bobby Bruce --- src/base/socket.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/base/socket.cc b/src/base/socket.cc index 2e9f815758..0f47b2ab13 100644 --- a/src/base/socket.cc +++ b/src/base/socket.cc @@ -39,7 +39,19 @@ #include #include -#include + +#if (defined(__GNUC__) && (__GNUC__ >= 8)) || defined(__clang__) + #include +#else + // This is only reachable if we're using GCC 7 (note: gem5 does not support + // GCC versions older than GCC 7 as they do not support the C++17 + // standard). + // If we're using GCC 7, we need to use . + #include + namespace std { + namespace filesystem = experimental::filesystem; + } +#endif #include "base/logging.hh" #include "base/output.hh"