From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Cc: alex.bennee@linaro.org
Subject: Re: [PATCH v3 3/5] configure: Clean up warning flag lists
Date: Wed, 17 Jun 2020 09:11:29 +0200 [thread overview]
Message-ID: <588db04a-086f-3e2e-301d-1aee43843a34@redhat.com> (raw)
In-Reply-To: <20200617043757.1623337-4-richard.henderson@linaro.org>
On 6/17/20 6:37 AM, Richard Henderson wrote:
> Use a helper function to tidy the assembly of gcc_flags.
> Separate flags that disable warnings from those that enable,
> and sort the disable warnings to the end.
>
> Suggested-by: Eric Blake <eblake@redhat.com>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> configure | 42 ++++++++++++++++++++++++++++++++----------
> 1 file changed, 32 insertions(+), 10 deletions(-)
>
> diff --git a/configure b/configure
> index b01b5e3bed..a8bef95282 100755
> --- a/configure
> +++ b/configure
> @@ -97,6 +97,11 @@ do_cxx() {
> do_compiler "$cxx" "$@"
> }
>
> +# Append $2 to the variable named $1, with space separation
> +add_to() {
> + eval $1=\${$1:+\"\$$1 \"}\$2
> +}
Nice trick Eric!
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> +
> update_cxxflags() {
> # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those
> # options which some versions of GCC's C++ compiler complain about
> @@ -2024,16 +2029,33 @@ if ! compile_prog "" "" ; then
> error_exit "You need at least GCC v4.8 or Clang v3.4 (or XCode Clang v5.1)"
> fi
>
> -gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
> -gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
> -gcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
> -gcc_flags="-Wendif-labels -Wno-shift-negative-value $gcc_flags"
> -gcc_flags="-Wno-initializer-overrides -Wexpansion-to-defined $gcc_flags"
> -gcc_flags="-Wno-string-plus-int -Wno-typedef-redefinition $gcc_flags"
> -# Note that we do not add -Werror to gcc_flags here, because that would
> -# enable it for all configure tests. If a configure test failed due
> -# to -Werror this would just silently disable some features,
> -# so it's too error prone.
> +# Accumulate -Wfoo and -Wno-bar separately.
> +# We will list all of the enable flags first, and the disable flags second.
> +# Note that we do not add -Werror, because that would enable it for all
> +# configure tests. If a configure test failed due to -Werror this would
> +# just silently disable some features, so it's too error prone.
> +
> +warn_flags=
> +add_to warn_flags -Wold-style-declaration
> +add_to warn_flags -Wold-style-definition
> +add_to warn_flags -Wtype-limits
> +add_to warn_flags -Wformat-security
> +add_to warn_flags -Wformat-y2k
> +add_to warn_flags -Winit-self
> +add_to warn_flags -Wignored-qualifiers
> +add_to warn_flags -Wempty-body
> +add_to warn_flags -Wnested-externs
> +add_to warn_flags -Wendif-labels
> +add_to warn_flags -Wexpansion-to-defined
> +
> +nowarn_flags=
> +add_to nowarn_flags -Wno-initializer-overrides
> +add_to nowarn_flags -Wno-missing-include-dirs
> +add_to nowarn_flags -Wno-shift-negative-value
> +add_to nowarn_flags -Wno-string-plus-int
> +add_to nowarn_flags -Wno-typedef-redefinition
> +
> +gcc_flags="$warn_flags $nowarn_flags"
>
> cc_has_warning_flag() {
> write_c_skeleton;
>
next prev parent reply other threads:[~2020-06-17 7:12 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-17 4:37 [PATCH v3 0/5] Vs clang-10 and gcc-9 warnings Richard Henderson
2020-06-17 4:37 ` [PATCH v3 1/5] fpu/softfloat: Silence 'bitwise negation of boolean expression' warning Richard Henderson
2020-06-17 10:37 ` Alex Bennée
2020-06-17 4:37 ` [PATCH v3 2/5] migration: fix xbzrle encoding rate calculation Richard Henderson
2020-06-17 10:25 ` Philippe Mathieu-Daudé
2020-06-17 10:54 ` Alex Bennée
2020-06-17 4:37 ` [PATCH v3 3/5] configure: Clean up warning flag lists Richard Henderson
2020-06-17 7:11 ` Philippe Mathieu-Daudé [this message]
2020-06-17 10:56 ` Alex Bennée
2020-06-17 4:37 ` [PATCH v3 4/5] configure: Disable -Wtautological-type-limit-compare Richard Henderson
2020-06-17 4:37 ` [PATCH v3 5/5] configure: Add -Wno-psabi Richard Henderson
2020-06-17 6:50 ` Philippe Mathieu-Daudé
2020-06-17 7:10 ` Philippe Mathieu-Daudé
2020-06-17 11:02 ` Alex Bennée
2020-06-17 5:15 ` [PATCH v3 0/5] Vs clang-10 and gcc-9 warnings no-reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=588db04a-086f-3e2e-301d-1aee43843a34@redhat.com \
--to=philmd@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).