Skip to content

Commit

Permalink
Fix GCC7 C++17 build
Browse files Browse the repository at this point in the history
GCC did not support <filesystem> until GCC8.

Fixes #1635

PiperOrigin-RevId: 615051227
Change-Id: If7cd5802ead40805b1ff1c3bdfc10ba6d2858ef0
  • Loading branch information
derekmauro authored and copybara-github committed Mar 12, 2024
1 parent 28e4000 commit bb83ace
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion absl/hash/hash_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 10 additions & 2 deletions absl/hash/internal/hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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"
Expand All @@ -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
Expand Down

0 comments on commit bb83ace

Please sign in to comment.