Suppress GCC8+ warnings about memcpy()/memset() on classes

.. with "no trivial copy-assignment".
All the cases I checked were harmless; as long as a class has no vptr
or owns memory (or other resources) that need to be handled properly
in the destructor, memcpy() and memset() aren't too dangerous.
This commit is contained in:
Daniel Gibson 2020-09-15 00:53:07 +02:00
parent 1e80eac345
commit 2a649bd074

View file

@ -126,6 +126,14 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
add_compile_options(-Wno-strict-overflow) add_compile_options(-Wno-strict-overflow)
add_compile_options(-Wno-format-security) add_compile_options(-Wno-format-security)
if(CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
# void* memset(void*, int, size_t) clearing an object of type struct refSound_t with no trivial copy-assignment; use assignment or value-initialization instead
# void* memcpy(void*, const void*, size_t) writing to an object of type class idDrawVert with no trivial copy-assignment; use copy-assignment or copy-initialization instead
# etc - I don't care, all the cases I've checked were safe and I'm not gonna add (void*) casts in 1000 places
# (that would make merging new mods painful)
add_compile_options(-Wno-class-memaccess)
endif()
CHECK_CXX_COMPILER_FLAG("-Woverloaded-virtual" cxx_has_Woverload_virtual) CHECK_CXX_COMPILER_FLAG("-Woverloaded-virtual" cxx_has_Woverload_virtual)
if(cxx_has_Woverload_virtual) if(cxx_has_Woverload_virtual)
add_compile_options(-Woverloaded-virtual) add_compile_options(-Woverloaded-virtual)