From: Stefan Weil <sw@weilnetz.de>
To: "Daniel P. Berrange" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/9] Move all compiler warning/optimization flags to the same place
Date: Mon, 02 Apr 2012 18:19:25 +0200 [thread overview]
Message-ID: <4F79D18D.7040203@weilnetz.de> (raw)
In-Reply-To: <1333363816-1691-2-git-send-email-berrange@redhat.com>
Am 02.04.2012 12:50, schrieb Daniel P. Berrange:
> From: "Daniel P. Berrange" <berrange@redhat.com>
>
> The list of warning/optimization flags set in QEMU_CFLAGS is
> in two places in configure. Only one of the places checks
> for GCC support. Merge the two separate lists into one and
> ensure they are all tested. Set one flag per line to make
> it easier to read the list of flags as increasing numbers
> are enabled
The first list includes compiler flags which don't need
a test because all versions of gcc support them.
Only the flags in the second list must be tested.
Merging both list and testing all flags increases the time
needed for configure when the current test method is used.
It's possible to reduce the number of compiler invocations
during configure by passing all flags together to the
compiler and analyzing the error message which is returned.
Example:
gcc -Wtest1 -Wunsupported2 -E - < /dev/null
cc1: error: unrecognized command line option "-Wtest1"
cc1: error: unrecognized command line option "-Wunsupported2"
>
> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> ---
> configure | 31 ++++++++++++++++++++++++-------
> 1 files changed, 24 insertions(+), 7 deletions(-)
>
> diff --git a/configure b/configure
> index 4b3adc9..cd40d17 100755
> --- a/configure
> +++ b/configure
> @@ -252,9 +252,6 @@ pkg_config=query_pkg_config
> sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
>
> # default flags for all hosts
> -QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
> -QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes
> $QEMU_CFLAGS"
> -QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
> QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
> $QEMU_CFLAGS"
> QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
> QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/fpu"
> @@ -1144,10 +1141,30 @@ else
> exit 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="-Wmissing-include-dirs -Wempty-body -Wnested-externs
> $gcc_flags"
> -gcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags"
> +gcc_flags=
> +
> +# Optimization flags
> +gcc_flags="$gcc_flags -fstack-protector-all"
> +gcc_flags="$gcc_flags -fno-strict-aliasing"
> +
> +# Warning flags
> +gcc_flags="$gcc_flags -Wall"
> +gcc_flags="$gcc_flags -Wundef"
> +gcc_flags="$gcc_flags -Wwrite-strings"
> +gcc_flags="$gcc_flags -Wmissing-prototypes"
> +gcc_flags="$gcc_flags -Wstrict-prototypes"
> +gcc_flags="$gcc_flags -Wredundant-decls"
> +gcc_flags="$gcc_flags -Wold-style-declaration"
> +gcc_flags="$gcc_flags -Wold-style-definition"
> +gcc_flags="$gcc_flags -Wtype-limits"
> +gcc_flags="$gcc_flags -Wformat-security"
> +gcc_flags="$gcc_flags -Wformat-y2k"
> +gcc_flags="$gcc_flags -Winit-self"
> +gcc_flags="$gcc_flags -Wignored-qualifiers"
> +gcc_flags="$gcc_flags -Wmissing-include-dirs"
> +gcc_flags="$gcc_flags -Wempty-body"
> +gcc_flags="$gcc_flags -Wnested-externs"
> +gcc_flags="$gcc_flags -Wendif-labels"
Could you sort the -Wxxx flags? Then it's easier to avoid
duplicates, and merge conflicts will occur less often when
new flags are added.
> cat > $TMPC << EOF
> int main(void) { return 0; }
> EOF
Regards,
Stefan Weil
next prev parent reply other threads:[~2012-04-02 16:19 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-02 10:50 [Qemu-devel] Fix enablement of some compiler warning flags & add some more Daniel P. Berrange
2012-04-02 10:50 ` [Qemu-devel] [PATCH 1/9] Move all compiler warning/optimization flags to the same place Daniel P. Berrange
2012-04-02 16:19 ` Stefan Weil [this message]
2012-04-02 10:50 ` [Qemu-devel] [PATCH 2/9] Fix checking for compiler flag support Daniel P. Berrange
2012-04-02 12:29 ` Peter Maydell
2012-04-02 16:28 ` Stefan Weil
2012-04-02 10:50 ` [Qemu-devel] [PATCH 3/9] Print out progress when checking compiler flags Daniel P. Berrange
2012-04-02 13:56 ` Peter Maydell
2012-04-02 14:00 ` Daniel P. Berrange
2012-04-02 16:31 ` Stefan Weil
2012-04-02 10:50 ` [Qemu-devel] [PATCH 4/9] Remove 4 MB stack frame usage from sheepdog Daniel P. Berrange
2012-04-02 10:50 ` [Qemu-devel] [PATCH 5/9] Add in a large number of extra GCC warnings Daniel P. Berrange
2012-04-02 10:50 ` [Qemu-devel] [PATCH 6/9] Fix bit test to use & instead of && and enable -Wlogical-op warning Daniel P. Berrange
2012-04-02 12:27 ` Peter Maydell
2012-04-02 16:02 ` Maksim Kozlov
2012-04-02 10:50 ` [Qemu-devel] [PATCH 7/9] Add -Wmissing-format-attribute & fix problems it finds Daniel P. Berrange
2012-04-02 12:49 ` Andreas Färber
2012-04-02 10:50 ` [Qemu-devel] [PATCH 8/9] Add more format string warning flags Daniel P. Berrange
2012-04-02 12:13 ` Peter Maydell
2012-04-02 12:17 ` Daniel P. Berrange
2012-04-02 14:04 ` Peter Maydell
2012-04-02 14:22 ` Daniel P. Berrange
2012-04-02 14:32 ` Peter Maydell
2012-04-02 14:34 ` Daniel P. Berrange
2012-04-02 10:50 ` [Qemu-devel] [PATCH 9/9] Add note about some other options potentially worth enabling Daniel P. Berrange
2012-04-02 16:48 ` Stefan Weil
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=4F79D18D.7040203@weilnetz.de \
--to=sw@weilnetz.de \
--cc=berrange@redhat.com \
--cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.