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

Change subject: base: Update <experimental/filesystem> include
......................................................................

base: Update <experimental/filesystem> include

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

For clang versions 6 through 10, as well as GCC 7,
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.

As opposed to checking by version, we now check if the
filesystem library has been defined before using it.

Change-Id: I8fb8d4eaa33f3edc29b7626f44b82ee66ffe72be
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/69778
Maintainer: Bobby Bruce <bbr...@ucdavis.edu>
Tested-by: kokoro <noreply+kok...@google.com>
Reviewed-by: Bobby Bruce <bbr...@ucdavis.edu>
---
M src/base/socket.cc
M src/mem/shared_memory_server.cc
2 files changed, 17 insertions(+), 10 deletions(-)

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 62f2071..06fc286 100644
--- a/src/base/socket.cc
+++ b/src/base/socket.cc
@@ -40,13 +40,16 @@

 #include <cerrno>

-#if (defined(__GNUC__) && (__GNUC__ >= 8)) || defined(__clang__)
+// check if filesystem library is available
+#if defined(__cpp_lib_filesystem) || __has_include(<filesystem>)
     #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 10 (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 10, 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 f99655c..a4305d0 100644
--- a/src/mem/shared_memory_server.cc
+++ b/src/mem/shared_memory_server.cc
@@ -39,13 +39,17 @@
 #include <algorithm>
 #include <cerrno>
 #include <cstring>
-#if (defined(__GNUC__) && (__GNUC__ >= 8)) || defined(__clang__)
+
+// check if filesystem library is available
+#if defined(__cpp_lib_filesystem) || __has_include(<filesystem>)
     #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 10 (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 10, we need to use
+    // <experimental/filesystem>.
     #include <experimental/filesystem>
     namespace std {
         namespace filesystem = experimental::filesystem;

--
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-MessageType: merged
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I8fb8d4eaa33f3edc29b7626f44b82ee66ffe72be
Gerrit-Change-Number: 69778
Gerrit-PatchSet: 4
Gerrit-Owner: Melissa Jost <melissakj...@gmail.com>
Gerrit-Reviewer: Bobby Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Melissa Jost <mkj...@ucdavis.edu>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org

Reply via email to