Changeset View
Changeset View
Standalone View
Standalone View
CMakeLists.txt
Show First 20 Lines • Show All 117 Lines • ▼ Show 20 Line(s) | |||||
118 | ) | 118 | ) | ||
119 | 119 | | |||
120 | # Turn off missing-field-initializers warning for GCC to avoid noise from false positives with empty {} | 120 | # Turn off missing-field-initializers warning for GCC to avoid noise from false positives with empty {} | ||
121 | # See discussion: http://mail.kde.org/pipermail/kdevelop-devel/2014-February/046910.html | 121 | # See discussion: http://mail.kde.org/pipermail/kdevelop-devel/2014-February/046910.html | ||
122 | add_compile_flag_if_supported(-Wno-missing-field-initializers) | 122 | add_compile_flag_if_supported(-Wno-missing-field-initializers) | ||
123 | add_compile_flag_if_supported(-Werror=switch) | 123 | add_compile_flag_if_supported(-Werror=switch) | ||
124 | add_compile_flag_if_supported(-Werror=undefined-bool-conversion) | 124 | add_compile_flag_if_supported(-Werror=undefined-bool-conversion) | ||
125 | add_compile_flag_if_supported(-Werror=tautological-undefined-compare) | 125 | add_compile_flag_if_supported(-Werror=tautological-undefined-compare) | ||
126 | add_compile_flag_if_supported(-Werror=implicit-fallthrough) # Use Q_FALLTHROUGH for false positives. | ||||
kossebau: On GCC this flag is already enabled by -Wextra, which by something is already set for me.
What… | |||||
I didn't see it with Clang. Clang doesn't support fallthrough comments like GCC does, and the standard [[fallthrough]] attribute is only available with C++17, maybe that's why it's not on by default. aaronpuchert: I didn't see it with Clang. Clang doesn't support fallthrough [comments like GCC](https://gcc. | |||||
126 | if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") | 127 | if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
127 | add_compile_flag_if_supported(-Wdocumentation) | 128 | add_compile_flag_if_supported(-Wdocumentation) | ||
128 | add_compile_flag_if_supported(-Wcovered-switch-default) | 129 | add_compile_flag_if_supported(-Wcovered-switch-default) | ||
130 | add_compile_flag_if_supported(-Wunreachable-code-break) | ||||
129 | # This warning is triggered by every call to qCDebug() | 131 | # This warning is triggered by every call to qCDebug() | ||
130 | add_compile_flag_if_supported(-Wno-gnu-zero-variadic-macro-arguments) | 132 | add_compile_flag_if_supported(-Wno-gnu-zero-variadic-macro-arguments) | ||
131 | endif() | 133 | endif() | ||
132 | if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") | 134 | if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
133 | add_compile_flag_if_supported(-pedantic) | 135 | add_compile_flag_if_supported(-pedantic) | ||
134 | add_compile_flag_if_supported(-Wzero-as-null-pointer-constant CXX_ONLY) | 136 | add_compile_flag_if_supported(-Wzero-as-null-pointer-constant CXX_ONLY) | ||
135 | endif() | 137 | endif() | ||
136 | if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") | 138 | if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") | ||
▲ Show 20 Lines • Show All 58 Lines • Show Last 20 Lines |
On GCC this flag is already enabled by -Wextra, which by something is already set for me.
What about other compilers?