]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Work around missing std::is_trivially_copyable in GCC < 5
authorJoel Rosdahl <joel@rosdahl.net>
Tue, 4 Aug 2020 14:51:25 +0000 (16:51 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Tue, 4 Aug 2020 17:19:03 +0000 (19:19 +0200)
src/InodeCache.cpp
src/system.hpp

index d573afd044d42cff09b9058e917c30550569ff0b..eeef9ac884a478260e54b98d5f47950d973109e4 100644 (file)
@@ -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<Digest>::value,
+static_assert(IS_TRIVIALLY_COPYABLE(Digest),
               "Digest is expected to be trivially copyable.");
 
 static_assert(
index 788123a7939182c39800f06c5fe4cb11d5432834..845f21fd6009d3882deee66ad6020f98112cdca3 100644 (file)
@@ -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<T>::value
+#endif