qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Weil <sw@weilnetz.de>
To: qemu-devel <qemu-devel@nongnu.org>
Cc: Stefan Weil <sw@weilnetz.de>
Subject: [Qemu-devel] [PATCH] configure: Enable extra compiler warnings
Date: Wed, 21 Aug 2013 07:44:29 +0200	[thread overview]
Message-ID: <1377063869-16834-1-git-send-email-sw@weilnetz.de> (raw)

Compiler option -Wextra enables an additional set of compiler warnings.

Some of these warnings were already enabled explicitly in QEMU:
-Wold-style-declaration, -Wtype-limits, -Wignored-qualifiers and
-Wempty-body are now redundant and can be removed.

Others don't work with the current code and must be disabled to
avoid warnings: -Wno-missing-field-initializers, -Wno-override-init,
-Wno-sign-compare and -Wno-unused-parameter.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
This is a rather old and long tested patch: I use -Wextra in my
QEMU builds for more than a year now. At least one bug was found
by using this warning level (see commit
b22dd1243f38286263d40496ce5298a8a7d96eea).

My tests include Linux and Windows hosts (gcc), but not BSD based hosts,
so maybe those hosts might need additional code fixes.
clang reports lots of -Wunused-value warnings.

Regards,
Stefan

 configure |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/configure b/configure
index 18fa608..252214b 100755
--- a/configure
+++ b/configure
@@ -299,7 +299,7 @@ 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="-Wall -Wextra -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_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/include"
@@ -1199,11 +1199,15 @@ if test -z "$werror" ; then
     fi
 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="-Wendif-labels $gcc_flags"
+gcc_flags="-Wold-style-definition"
+gcc_flags="-Wformat-security -Wformat-y2k -Winit-self $gcc_flags"
+gcc_flags="-Wmissing-include-dirs -Wnested-externs $gcc_flags"
+gcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags"
 gcc_flags="-Wno-initializer-overrides $gcc_flags"
+gcc_flags="-Wno-missing-field-initializers $gcc_flags"
+gcc_flags="-Wno-override-init $gcc_flags"
+gcc_flags="-Wno-sign-compare $gcc_flags"
+gcc_flags="-Wno-unused-parameter $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,
-- 
1.7.10.4

             reply	other threads:[~2013-08-21  5:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-21  5:44 Stefan Weil [this message]
2013-09-03 18:28 ` [Qemu-devel] [PATCH] configure: Enable extra compiler warnings Stefan Weil
2013-09-14 12:18   ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2013-09-14 15:30     ` Stefan Weil
2013-09-14 17:38       ` Michael Tokarev
2013-09-14 17:46         ` 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=1377063869-16834-1-git-send-email-sw@weilnetz.de \
    --to=sw@weilnetz.de \
    --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 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).