Bobby Bruce has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/69598?usp=email )

Change subject: base: Use <experimental/filesystem> include for GCC v7
......................................................................

base: Use <experimental/filesystem> include for GCC v7

gem5 officially supports GCC 7+. In GCC 7 the "filesystem" module was
added but only in the "experimental" namespace as
"<experimental/filesystem>". In GCC 8+ the module can be found as
"<filesystem>".

Because of this, include guards to handle this. They include
"<experimental/filesystem>" for the GCC v7 case and the "<filesystem>"
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 <GCC 8+ code> #else <GCC 7 code> #endif" logic is
valid.

Change-Id: I31db5488f272f9652edebf24ecefca3722369076
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/69598
Tested-by: kokoro <noreply+kok...@google.com>
Reviewed-by: Bobby Bruce <bbr...@ucdavis.edu>
Maintainer: Bobby Bruce <bbr...@ucdavis.edu>
---
M src/base/socket.cc
1 file changed, 13 insertions(+), 1 deletion(-)

Approvals:
  Bobby Bruce: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/base/socket.cc b/src/base/socket.cc
index 2e9f815..0f47b2a 100644
--- a/src/base/socket.cc
+++ b/src/base/socket.cc
@@ -39,7 +39,19 @@
 #include <unistd.h>

 #include <cerrno>
-#include <filesystem>
+
+#if (defined(__GNUC__) && (__GNUC__ >= 8)) || defined(__clang__)
+    #include <filesystem>
+#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 <experimental/filesystem>.
+    #include <experimental/filesystem>
+    namespace std {
+        namespace filesystem = experimental::filesystem;
+    }
+#endif

 #include "base/logging.hh"
 #include "base/output.hh"

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/69598?usp=email To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I31db5488f272f9652edebf24ecefca3722369076
Gerrit-Change-Number: 69598
Gerrit-PatchSet: 2
Gerrit-Owner: Bobby Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Bobby Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org

Reply via email to