Merge pull request #134 from microsoft/gcc8_warning
Address GCC8 warning
This commit is contained in:
@@ -18,6 +18,12 @@
|
||||
# define SNMALLOC_PURE __attribute__((const))
|
||||
#endif
|
||||
|
||||
#if !defined(__clang__) && defined(__GNUC__)
|
||||
# if __GNUC__ >= 8
|
||||
# define GCC_VERSION_EIGHT_PLUS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef __has_builtin
|
||||
# define __has_builtin(x) 0
|
||||
#endif
|
||||
|
||||
@@ -97,9 +97,18 @@ namespace snmalloc
|
||||
MemoryProviderStateMixin<PAL>* allocated =
|
||||
local.alloc_chunk<MemoryProviderStateMixin<PAL>, 1>();
|
||||
|
||||
#ifdef GCC_VERSION_EIGHT_PLUS
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wclass-memaccess"
|
||||
#endif
|
||||
// Put temporary allocator we have used, into the permanent storage.
|
||||
// memcpy is safe as this is entirely single threaded.
|
||||
// memcpy is safe as this is entirely single threaded: the move
|
||||
// constructors were removed as unsafe to move std::atomic in a
|
||||
// concurrent setting.
|
||||
memcpy(allocated, &local, sizeof(MemoryProviderStateMixin<PAL>));
|
||||
#ifdef GCC_VERSION_EIGHT_PLUS
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
// Register this allocator for low-memory call-backs
|
||||
if constexpr (pal_supports<LowMemoryNotification, PAL>)
|
||||
|
||||
Reference in New Issue
Block a user