[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] build: try improve handling of clang warnings
From: |
Thomas Huth |
Subject: |
Re: [Qemu-devel] [PATCH] build: try improve handling of clang warnings |
Date: |
Fri, 9 Mar 2018 12:31:48 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 |
On 09.03.2018 12:01, Gerd Hoffmann wrote:
> This patch disables the pragma diagnostic -Wunused-but-set-variable for
> clang in util/coroutine-ucontext.c.
>
> This in turn allows us to remove it from the configure check, so the
> CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE will succeed for clang.
>
> With that in place clang builds (linux) will use -Werror by default,
> which breaks the build due to warning about unaligned struct members.
>
> Given that our structs are often dictated by the hardware qemu emulates
> and the file formats we use this can't be fixed easily, so I think it is
> reasonaable to turn off this warning. Do so by adding
> -Wno-address-of-packed-member to our list of warning flags.
>
> Now clang builds qemu without warnings. Well, almost. There are some
> left in the rdma code. Leaving that to the rdma people. All others can
> use --disable-rdma to workarounds this.
>
> Cc: Thomas Huth <address@hidden>
> Cc: Peter Maydell <address@hidden>
> Signed-off-by: Gerd Hoffmann <address@hidden>
> ---
> configure | 2 +-
> util/coroutine-ucontext.c | 4 ++--
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/configure b/configure
> index 6f3921c02a..5e4310b910 100755
> --- a/configure
> +++ b/configure
> @@ -1692,6 +1692,7 @@ 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 $gcc_flags"
> +gcc_flags="-Wno-address-of-packed-member $gcc_flags"
Since the warning is sometimes also a good idea ... maybe it would
rather be better to use -Wno-error=address-of-packed-member instead?
Anyway, with or without that change:
Reviewed-by: Thomas Huth <address@hidden>