diff options
| author | Léo Lam <leo@leolam.fr> | 2020-11-21 01:44:15 +0100 |
|---|---|---|
| committer | Léo Lam <leo@leolam.fr> | 2020-11-21 02:08:08 +0100 |
| commit | 4b7f784d1bcf3a9eb660aaabafaacd80957d2de2 (patch) | |
| tree | cc16873be057acbe163a5c43246ef72723d38efa /Source | |
| parent | ade9f92a63ca3c2f4146018ce0baacdd36328f77 (diff) | |
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.
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/CMakeLists.txt | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index df91f4b668..3b70daf4f2 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -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 |
