summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Derek Mauro <dmauro@google.com>2024-03-12 08:33:40 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2024-03-12 08:34:41 -0700
commitbb83aceacb554e79e7cd2404856f0be30bd00303 (patch)
treeced1d6f2053544972d40e743f228e8d91506afac
parent28e40003f899553197eacc81fdcd73b90b2d41c7 (diff)
Fix GCC7 C++17 build
GCC did not support <filesystem> until GCC8. Fixes #1635 PiperOrigin-RevId: 615051227 Change-Id: If7cd5802ead40805b1ff1c3bdfc10ba6d2858ef0
-rw-r--r--absl/hash/hash_test.cc2
-rw-r--r--absl/hash/internal/hash.h12
2 files changed, 11 insertions, 3 deletions
diff --git a/absl/hash/hash_test.cc b/absl/hash/hash_test.cc
index 59fe8dea..7fecf534 100644
--- a/absl/hash/hash_test.cc
+++ b/absl/hash/hash_test.cc
@@ -48,7 +48,7 @@
#include "absl/types/optional.h"
#include "absl/types/variant.h"
-#if ABSL_INTERNAL_CPLUSPLUS_LANG >= 201703L
+#ifdef ABSL_INTERNAL_STD_FILESYSTEM_PATH_HASH_AVAILABLE
#include <filesystem> // NOLINT
#endif
diff --git a/absl/hash/internal/hash.h b/absl/hash/internal/hash.h
index f4a94f91..b7d89b01 100644
--- a/absl/hash/internal/hash.h
+++ b/absl/hash/internal/hash.h
@@ -24,6 +24,15 @@
#include <TargetConditionals.h>
#endif
+#include "absl/base/config.h"
+
+// For feature testing and determining which headers can be included.
+#if ABSL_INTERNAL_CPLUSPLUS_LANG >= 202002L
+#include <version>
+#else
+#include <ciso646>
+#endif
+
#include <algorithm>
#include <array>
#include <bitset>
@@ -47,7 +56,6 @@
#include <utility>
#include <vector>
-#include "absl/base/config.h"
#include "absl/base/internal/unaligned_access.h"
#include "absl/base/port.h"
#include "absl/container/fixed_array.h"
@@ -61,7 +69,7 @@
#include "absl/types/variant.h"
#include "absl/utility/utility.h"
-#if ABSL_INTERNAL_CPLUSPLUS_LANG >= 201703L && \
+#if defined(__cpp_lib_filesystem) && __cpp_lib_filesystem >= 201703L && \
!defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY)
#include <filesystem> // NOLINT
#endif