From: Joel Rosdahl Date: Tue, 4 Aug 2020 14:51:25 +0000 (+0200) Subject: Work around missing std::is_trivially_copyable in GCC < 5 X-Git-Tag: v4.0~221 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0789bc267731cf81ca2a28d08323c1d2c5851eee;p=thirdparty%2Fccache.git Work around missing std::is_trivially_copyable in GCC < 5 --- diff --git a/src/InodeCache.cpp b/src/InodeCache.cpp index d573afd04..eeef9ac88 100644 --- a/src/InodeCache.cpp +++ b/src/InodeCache.cpp @@ -63,7 +63,7 @@ const uint32_t k_num_entries = 4; static_assert(Digest::size() == 20, "Increment version number if size of digest is changed."); -static_assert(std::is_trivially_copyable::value, +static_assert(IS_TRIVIALLY_COPYABLE(Digest), "Digest is expected to be trivially copyable."); static_assert( diff --git a/src/system.hpp b/src/system.hpp index 788123a79..845f21fd6 100644 --- a/src/system.hpp +++ b/src/system.hpp @@ -95,3 +95,10 @@ const size_t READ_BUFFER_SIZE = 65536; #ifdef HAVE_SYS_MMAN_H # define INODE_CACHE_SUPPORTED #endif + +// Workaround for missing std::is_trivially_copyable in GCC < 5. +#if __GNUG__ && __GNUC__ < 5 +# define IS_TRIVIALLY_COPYABLE(T) __has_trivial_copy(T) +#else +# define IS_TRIVIALLY_COPYABLE(T) std::is_trivially_copyable::value +#endif