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

This change adds include guards to the inclusion of the
filesystem module to ensure GCC 7 can work properly,
addressing an issue in the compiler tests.

Change-Id: I642f79bd801baf4766572368b9339e34be46d1c3
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/69840
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Richard Cooper <richard.cooper@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
This commit is contained in:
Melissa Jost
2023-04-14 17:02:01 -07:00
parent e7ae5290f5
commit c127a38f48

View File

@@ -39,7 +39,18 @@
#include <algorithm>
#include <cerrno>
#include <cstring>
#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"