configure: Enable extra compiler warnings
PATCH 1/1 configure: Enable extra compiler warnings
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.
---
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(-)
configure +9 -5
@@ -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,
Signature · 1 line
1.7.10.4
Am 21.08.2013 07:44, schrieb Stefan Weil:
Quoted 21 lines
Compiler option -Wextra enables an additional set of compiler warnings.
Some of these warnings were already enabled explicitly in QEMU:
(quoted diff) +0
-2-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 <[email protected]>---
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 commitb22dd1243f38286263d40496ce5298a8a7d96eea).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.
Quoted 5 lines
Regards,
Stefanconfigure | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
Ping? I'd appreciate getting this patch committed. Is it trivial enough for qemu-trivial?
Stefan
Quoted 18 lines · Stefan Weil
Am 21.08.2013 07:44, schrieb Stefan Weil:
Quoted 17 lines
Compiler option -Wextra enables an additional set of compiler warnings.
Some of these warnings were already enabled explicitly in QEMU:
(quoted diff) +0
-2-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 <[email protected]>---
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 commitb22dd1243f38286263d40496ce5298a8a7d96eea).
Quoted 3 lines
Quoted 3 lines
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.
[]
Quoted 6 lines
Ping? I'd appreciate getting this patch committed. Is it trivial enough for qemu-trivial?
Stefan
Well. I see at least one hidden flag here which is not covered by the description:
-gcc_flags="-Wendif-labels $gcc_flags" +gcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags"
Is it intentional?
As for the rest, I think it may go to -trivial just fine. The patch does not apply to current git, but is easy to fix.
I'll fire a FreeBSD compile test with it applied.
Thanks,
/mjt
Am 14.09.2013 14:18, schrieb Michael Tokarev:
Quoted 37 lines
Quoted 18 lines · Stefan Weil
Am 21.08.2013 07:44, schrieb Stefan Weil:
Quoted 17 lines
Compiler option -Wextra enables an additional set of compiler warnings.
Some of these warnings were already enabled explicitly in QEMU:
(quoted diff) +0
-2-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 <[email protected]>---
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 commitb22dd1243f38286263d40496ce5298a8a7d96eea).Quoted 4 lines
Quoted 4 lines
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.[]
Quoted 6 lines
Ping? I'd appreciate getting this patch committed. Is it trivial enough for qemu-trivial?
Stefan
Well. I see at least one hidden flag here which is not covered by the description:
configure +1
-1-gcc_flags="-Wendif-labels $gcc_flags" +gcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags"
Quoted 1 line
Is it intentional?
No, -fstack-protector-all should not be there. It might be a relict of a previous patch rebase: I added -Wextra in my local branch a long time ago, and -fstack-protector-all was obviously moved to another location in configure during that time.
I can send an updated patch later, or you can just remove it from my original patch.
Quoted 9 lines
As for the rest, I think it may go to -trivial just fine. The patch does not apply to current git, but is easy to fix.
I'll fire a FreeBSD compile test with it applied.
Thanks,
/mjt
Quoted 1 line · Stefan Weil
Am 14.09.2013 14:18, schrieb Michael Tokarev:
[]
Quoted 13 lines
Quoted 7 lines
Well. I see at least one hidden flag here which is not covered by the description:
configure +1
-1-gcc_flags="-Wendif-labels $gcc_flags" +gcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags"Is it intentional?
No, -fstack-protector-all should not be there. It might be a relict of a previous patch rebase: I added -Wextra in my local branch a long time ago, and -fstack-protector-all was obviously moved to another location in configure during that time.
Quoted 2 lines
I can send an updated patch later, or you can just remove it from my original patch.
Please take a look at the resulting patch at
http://git.corpit.ru/?p=qemu.git;a=shortlog;h=refs/heads/trivial-patches-next
and see if this is the patch you want to be applied.
I verified it compiles on FreeBSD 9.1, but I tried only minimal set of optional dependencies so things might still break, but I think we can fix it later.
If it looks okay, I'll send a pull request today.
Thanks,
/mjt
Am 14.09.2013 19:38, schrieb Michael Tokarev:
Quoted 28 lines
Quoted 1 line · Stefan Weil
Am 14.09.2013 14:18, schrieb Michael Tokarev:
[]
Quoted 13 lines
Quoted 7 lines
Well. I see at least one hidden flag here which is not covered by the description:
configure +1
-1-gcc_flags="-Wendif-labels $gcc_flags" +gcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags"Is it intentional?
No, -fstack-protector-all should not be there. It might be a relict of a previous patch rebase: I added -Wextra in my local branch a long time ago, and -fstack-protector-all was obviously moved to another location in configure during that time.
Quoted 2 lines
I can send an updated patch later, or you can just remove it from my original patch.
Please take a look at the resulting patch at
http://git.corpit.ru/?p=qemu.git;a=shortlog;h=refs/heads/trivial-patches-nextand see if this is the patch you want to be applied.
I verified it compiles on FreeBSD 9.1, but I tried only minimal set of optional dependencies so things might still break, but I think we can fix it later.
Quoted 5 lines
If it looks okay, I'll send a pull request today.
Thanks,
/mjt
It looks good, but I'd prefer my v2:
http://patchwork.ozlabs.org/patch/274928/.
It's nearly identical to your version, but sorts some options alphabetically.
Thanks for your work.
Stefan