Re: [virt-viewer PATCH v2 3/3] Switch to gnulib's compiler warning flags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 19, 2019 at 03:00:11PM +0000, Daniel P. Berrangé wrote:
> diff --git a/m4/virt-viewer-warnings.m4 b/m4/virt-viewer-warnings.m4
> new file mode 100644
> index 0000000..4036b75
> --- /dev/null
> +++ b/m4/virt-viewer-warnings.m4
> [...]
> +    # List of warnings that are not relevant / wanted
> +
> +    # Don't care about C++ compiler compat
> +    dontwarn="$dontwarn -Wc++-compat"
> +    dontwarn="$dontwarn -Wabi"
> +    dontwarn="$dontwarn -Wdeprecated"
> +    # Don't care about ancient C standard compat
> +    dontwarn="$dontwarn -Wtraditional"
> +    # Don't care about ancient C standard compat
> +    dontwarn="$dontwarn -Wtraditional-conversion"
> +    # Ignore warnings in /usr/include
> +    dontwarn="$dontwarn -Wsystem-headers"
> +    # Happy for compiler to add struct padding
> +    dontwarn="$dontwarn -Wpadded"
> +    # GCC very confused with -O2
> +    dontwarn="$dontwarn -Wunreachable-code"
> +    # Too many to deal with
> +    dontwarn="$dontwarn -Wconversion"
> +    # Too many to deal with
> +    dontwarn="$dontwarn -Wsign-conversion"
> +    # We need to use long long in many places
> +    dontwarn="$dontwarn -Wlong-long"
> +    # Not a problem since we don't use -fstrict-overflow
> +    dontwarn="$dontwarn -Wstrict-overflow"
> +    # Not a problem since we don't use -funsafe-loop-optimizations
> +    dontwarn="$dontwarn -Wunsafe-loop-optimizations"
> +    # gcc 4.4.6 complains this is C++ only; gcc 4.7.0 implies this from -Wall
> +    dontwarn="$dontwarn -Wenum-compare"
> +    # /usr/include/spice-1/spice/protocol.h triggers violations
> +    dontwarn="$dontwarn -Wpacked"
> +
> +    # g_clear_object & G_ATOMIC_OP_USE_GCC_BUILTINS causes
> +    # violations with this. XXX Fix glib ?
> +    dontwarn="$dontwarn -Wbad-function-cast"
> +
> +    # Due to gutils.h bug in g_bit_storage
> +    wantwarn="$wantwarn -Wno-sign-conversion"
> +    wantwarn="$wantwarn -Wno-conversion"
> +    # We can't enable this due to horrible spice_usb_device_get_description
> +    # signature
> +#    wantwarn="$wantwarn -Wno-format-nonliteral"

I'd remove this, spice_usb_device_get_description is not marked as using
a format string, and uncommenting this line/changing it to
-Wformat-nonliteral did not trigger any additional warnings.

> +
> +    # Get all possible GCC warnings
> +    gl_MANYWARN_ALL_GCC([maybewarn])
> +
> +    # Remove the ones we don't want, blacklisted earlier
> +    gl_MANYWARN_COMPLEMENT([wantwarn], [$maybewarn], [$dontwarn])
> +
> +    # GNULIB uses '-W' (aka -Wextra) which includes a bunch of stuff.
> +    # Unfortunately, this means you can't simply use '-Wsign-compare'
> +    # with gl_MANYWARN_COMPLEMENT
> +    # So we have -W enabled, and then have to explicitly turn off...
> +    wantwarn="$wantwarn -Wno-sign-compare"
> +
> +    # GNULIB expects this to be part of -Wc++-compat, but we turn
> +    # that one off, so we need to manually enable this again
> +    wantwarn="$wantwarn -Wjump-misses-init"
> +
> +    # We do "bad" function casts all the time for event callbacks
> +    wantwarn="$wantwarn -Wno-cast-function-type"
> +
> +    # GNULIB turns on -Wformat=2 which implies -Wformat-nonliteral,
> +    # so we need to manually re-exclude it.
> +    wantwarn="$wantwarn -Wno-format-nonliteral"

This on can be removed too if we enable -Wformat-nonliteral.

Attachment: signature.asc
Description: PGP signature

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list

[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux