зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1718408 - Enable some clang warning flags that are currently warning-free. r=firefox-build-system-reviewers,andi
-Wdeprecated-this-capture (in a lambda expression) warning: implicit capture of ‘this’ with a capture default of ‘=’ is deprecated https://clang.llvm.org/docs/DiagnosticsReference.html#wdeprecated-this-capture -Wenum-compare-conditional Example: return foo ? enumType1 : enumType2; // deprecated in C++20 https://clang.llvm.org/docs/DiagnosticsReference.html#wenum-compare-conditional -Wformat-type-confusion (in a sprintf-like format function) warning: format specifies type A (e.g. short) but the argument has type B (e.g. char) https://clang.llvm.org/docs/DiagnosticsReference.html#wformat-type-confusion -Wshadow-uncaptured-local (variable declared in a lambda expression) warning: declaration shadows a local variable warning: declaration shadows a variable in C warning: declaration shadows a static data member of C warning: declaration shadows a field of C warning: declaration shadows a typedef in C warning: declaration shadows a type alias in C warning: declaration shadows a structured binding https://clang.llvm.org/docs/DiagnosticsReference.html#wshadow-uncaptured-local Differential Revision: https://phabricator.services.mozilla.com/D118896
This commit is contained in:
Родитель
60c1851943
Коммит
94283e10db
|
@ -40,9 +40,15 @@ add_gcc_warning("-Wall")
|
||||||
# catch implicit truncation of enum values assigned to smaller bit fields
|
# catch implicit truncation of enum values assigned to smaller bit fields
|
||||||
check_and_add_gcc_warning("-Wbitfield-enum-conversion")
|
check_and_add_gcc_warning("-Wbitfield-enum-conversion")
|
||||||
|
|
||||||
|
# catches deprecated implicit capture of `this` in lambdas.
|
||||||
|
check_and_add_gcc_warning("-Wdeprecated-this-capture", cxx_compiler)
|
||||||
|
|
||||||
# catches bugs, e.g. "if (c); foo();", few false positives
|
# catches bugs, e.g. "if (c); foo();", few false positives
|
||||||
add_gcc_warning("-Wempty-body")
|
add_gcc_warning("-Wempty-body")
|
||||||
|
|
||||||
|
# catches mismatched printf integer sizes.
|
||||||
|
check_and_add_gcc_warning("-Wformat-type-confusion")
|
||||||
|
|
||||||
# catches return types with qualifiers like const
|
# catches return types with qualifiers like const
|
||||||
add_gcc_warning("-Wignored-qualifiers")
|
add_gcc_warning("-Wignored-qualifiers")
|
||||||
|
|
||||||
|
@ -61,6 +67,9 @@ add_gcc_warning("-Wpointer-arith")
|
||||||
# catch modifying constructor parameter that shadows member variable
|
# catch modifying constructor parameter that shadows member variable
|
||||||
check_and_add_gcc_warning("-Wshadow-field-in-constructor-modified")
|
check_and_add_gcc_warning("-Wshadow-field-in-constructor-modified")
|
||||||
|
|
||||||
|
# catches lambda variables shadowing function variables.
|
||||||
|
check_and_add_gcc_warning("-Wshadow-uncaptured-local", cxx_compiler)
|
||||||
|
|
||||||
# catches comparing signed/unsigned ints
|
# catches comparing signed/unsigned ints
|
||||||
add_gcc_warning("-Wsign-compare")
|
add_gcc_warning("-Wsign-compare")
|
||||||
|
|
||||||
|
@ -102,6 +111,9 @@ check_and_add_gcc_warning("-Wcomma", cxx_compiler)
|
||||||
# catches duplicated conditions in if-else-if chains
|
# catches duplicated conditions in if-else-if chains
|
||||||
check_and_add_gcc_warning("-Wduplicated-cond")
|
check_and_add_gcc_warning("-Wduplicated-cond")
|
||||||
|
|
||||||
|
# catches expessions mixing different enum types deprecated in C++20
|
||||||
|
check_and_add_gcc_warning("-Wenum-compare-conditional")
|
||||||
|
|
||||||
# catches unintentional switch case fallthroughs
|
# catches unintentional switch case fallthroughs
|
||||||
check_and_add_gcc_warning("-Wimplicit-fallthrough", cxx_compiler)
|
check_and_add_gcc_warning("-Wimplicit-fallthrough", cxx_compiler)
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче