Melissa Jost has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/69778?usp=email )

Change subject: base: Use <experimental/filesystem> include for clang 6-9
......................................................................

base: Use <experimental/filesystem> include for clang 6-9

This change addresses an error in the compiler tests:
https://jenkins.gem5.org/job/compiler-checks/573/

For clang versions 6 through 9, in order to use the
"filesystem" module, you must include the experimental
namespace.  In all newer versions, you can use the
"filesystem" module as is.

Because of this, include guards to handle this. They include
"<experimental/filesystem>" for the older clang versions and
the "<filesystem>" for all other versions.

Change-Id: I8fb8d4eaa33f3edc29b7626f44b82ee66ffe72be
---
M src/base/socket.cc
M src/mem/shared_memory_server.cc
2 files changed, 23 insertions(+), 6 deletions(-)



diff --git a/src/base/socket.cc b/src/base/socket.cc
index 62f2071..8243bc0 100644
--- a/src/base/socket.cc
+++ b/src/base/socket.cc
@@ -40,13 +40,16 @@

 #include <cerrno>

-#if (defined(__GNUC__) && (__GNUC__ >= 8)) || defined(__clang__)
+#if (defined(__GNUC__) && (__GNUC__ >= 8)) || \
+    (defined(__clang__) && (__GNUC__ >= 9))
     #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>.
+    // This is only reachable if we're using GCC 7 or clang versions 6
+    // through 9 (note: gem5 does not support GCC versions older than
+    // GCC 7 or clang versions older than clang 6.0 as they do not
+    // support the C++17 standard).
+    // If we're using GCC 7 or clang versions 6 through 9, we need to use
+    // <experimental/filesystem>.
     #include <experimental/filesystem>
     namespace std {
         namespace filesystem = experimental::filesystem;
diff --git a/src/mem/shared_memory_server.cc b/src/mem/shared_memory_server.cc
index 3e49164..8f66217 100644
--- a/src/mem/shared_memory_server.cc
+++ b/src/mem/shared_memory_server.cc
@@ -39,7 +39,21 @@
 #include <algorithm>
 #include <cerrno>
 #include <cstring>
-#include <filesystem>
+#if (defined(__GNUC__) && (__GNUC__ >= 8)) || \
+    (defined(__clang__) && (__GNUC__ >= 9))
+    #include <filesystem>
+#else
+    // This is only reachable if we're using GCC 7 or clang versions 6
+    // through 9 (note: gem5 does not support GCC versions older than
+    // GCC 7 or clang versions older than clang 6.0 as they do not
+    // support the C++17 standard).
+    // If we're using GCC 7 or clang versions 6 through 9, 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/+/69778?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: I8fb8d4eaa33f3edc29b7626f44b82ee66ffe72be
Gerrit-Change-Number: 69778
Gerrit-PatchSet: 1
Gerrit-Owner: Melissa Jost <melissakj...@gmail.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org

Reply via email to