Put -Wno-error=foo before -Wno-foo
Clang treats the combination of these two parameters differently
depending on which order they appear in. By reversing them, we can
compile with `clang --analyze` and get warnings from its static analyzer
without clutter.
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Will Thompson
13 years ago
21 | 21 | for tp_flag in $4; do |
22 | 22 | TP_COMPILER_FLAG([-Wno-$tp_flag], |
23 | 23 | [tp_warnings="$tp_warnings -Wno-$tp_flag"]) |
24 | dnl Yes, we do need to use both -Wno-foo and -Wno-error=foo. Simon says: | |
25 | dnl some warnings we explicitly don't want, like unused-parameter, but | |
26 | dnl they're in -Wall. when a distro using cdbs compiles us, we have: | |
27 | dnl -Werror -Wno-unused-parameter -Wall | |
28 | dnl ^ from us ^ from cdbs | |
29 | dnl which turns -Wunused-parameter back on, in effect | |
24 | 30 | TP_COMPILER_FLAG([-Wno-error=$tp_flag], |
25 | 31 | [tp_error_flags="$tp_error_flags -Wno-error=$tp_flag"], [tp_werror=no]) |
26 | 32 | done |
31 | 37 | tp_werror=$enableval, :) |
32 | 38 | |
33 | 39 | if test "x$tp_werror" = xyes && $2; then |
34 | $1="$tp_warnings $tp_error_flags" | |
40 | dnl We put -Wno-error=foo before -Wno-foo because clang interprets -Wall | |
41 | dnl -Werror -Wno-foo -Wno-error=foo as “make foo a non-fatal warning”, but does | |
42 | dnl what we want if you reverse them. | |
43 | $1="$tp_error_flags $tp_warnings" | |
35 | 44 | else |
36 | 45 | $1="$tp_warnings" |
37 | 46 | fi |