Disable -Wstringop-truncation warnings

Disable -Wstringop-truncation warnings as they result in many false
positives.

In most (all?) cases where std::strncpy is used, we want to fill the
entire buffer or match emulated code that also ignores the null
terminator, so the warnings are not useful.

Given that Dolphin itself mostly uses std::string, they do not
really help catch any bugs.
This commit is contained in:
Léo Lam 2020-11-21 01:44:15 +01:00
parent ade9f92a63
commit 4b7f784d1b
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
1 changed files with 9 additions and 0 deletions

View File

@ -84,6 +84,15 @@ else()
check_and_add_flag(INIT_SELF -Winit-self)
check_and_add_flag(MISSING_DECLARATIONS -Wmissing-declarations)
check_and_add_flag(MISSING_VARIABLE_DECLARATIONS -Wmissing-variable-declarations)
# Disable -Wstringop-truncation warnings as they result in many false positives.
# In most (all?) cases where std::strncpy is used, we want to fill the entire buffer
# or match emulated code that also ignores the null terminator, so the warnings are not useful.
# Given that Dolphin itself mostly uses std::string, they do not really help catch any bugs.
check_cxx_compiler_flag(-Wstringop-truncation HAS_STRINGOP_TRUNCATION_WARNING)
if (HAS_STRINGOP_TRUNCATION_WARNING)
check_and_add_flag(NO_STRINGOP_TRUNCATION -Wno-stringop-truncation)
endif()
endif()
# These aren't actually needed for C11/C++11