mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-27 07:34:20 +00:00
Bug 1406618 - Enable gcc -Wduplicated-cond warnings. r=glandium
Warn about duplicated conditions in if-else-if chains, which are unreachable code and likely copy/paste bugs. The -Wduplicated-cond flag is available in gcc 6 and later. int example(int a) { if (a == 0) a = 42; else if (a == 0) // -Wduplicated-cond warning! a = 43; return a; } MozReview-Commit-ID: F9hqxMCct74 --HG-- extra : rebase_source : 71168f79ce8f03f650167cdedbbd2e5802846eab
This commit is contained in:
parent
fd26fb0032
commit
925214d9af
@ -65,6 +65,9 @@ check_and_add_gcc_warning('-Wc++1z-compat', cxx_compiler)
|
||||
# catches possible misuse of the comma operator
|
||||
check_and_add_gcc_warning('-Wcomma', cxx_compiler)
|
||||
|
||||
# catches duplicated conditions in if-else-if chains
|
||||
check_and_add_gcc_warning('-Wduplicated-cond')
|
||||
|
||||
# catches unintentional switch case fallthroughs
|
||||
check_and_add_gcc_warning('-Wimplicit-fallthrough', cxx_compiler)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user