[libvirt] [PATCH] build: stop clang complaining about redefined typedefs

Daniel P. Berrangé posted 1 patch 32 weeks ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20191008143922.13378-1-berrange@redhat.com
m4/virt-compile-warnings.m4 | 4 ++++
1 file changed, 4 insertions(+)

[libvirt] [PATCH] build: stop clang complaining about redefined typedefs

Posted by Daniel P. Berrangé 32 weeks ago
Clang's gnu99 mode is not quite the same as GCC's. It will complain
about redefined typedefs being a C11 feature, while GCC does not
complain and allows them in GNU99.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---

Technically a build breaker fix, but given my track record of
breaking the build today/yestday, lets have a reviewer approve :-)

 m4/virt-compile-warnings.m4 | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
index 26f231f97e..4f9eee121c 100644
--- a/m4/virt-compile-warnings.m4
+++ b/m4/virt-compile-warnings.m4
@@ -125,6 +125,10 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
     # We do "bad" function casts all the time for event callbacks
     wantwarn="$wantwarn -Wno-cast-function-type"
 
+    # CLang incorrectly complains about dup typedefs win gnu99 mode
+    # so use this CLang-specific arg to keep it quiet
+    wantwarn="$wantwarn -Wno-typedef-redefinition"
+
     # 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"
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] build: stop clang complaining about redefined typedefs

Posted by Peter Krempa 32 weeks ago
On Tue, Oct 08, 2019 at 15:39:22 +0100, Daniel Berrange wrote:
> Clang's gnu99 mode is not quite the same as GCC's. It will complain
> about redefined typedefs being a C11 feature, while GCC does not
> complain and allows them in GNU99.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
> 
> Technically a build breaker fix, but given my track record of
> breaking the build today/yestday, lets have a reviewer approve :-)
> 
>  m4/virt-compile-warnings.m4 | 4 ++++
>  1 file changed, 4 insertions(+)

ACK,

tested with:

clang version 8.0.0 (Fedora 8.0.0-1.fc30)
gcc version 9.2.1 20190827 (Red Hat 9.2.1-1) (GCC)

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] build: stop clang complaining about redefined typedefs

Posted by Fabiano Fidêncio 32 weeks ago
On Tue, Oct 8, 2019 at 5:14 PM Daniel P. Berrangé <berrange@redhat.com> wrote:
>
> Clang's gnu99 mode is not quite the same as GCC's. It will complain
> about redefined typedefs being a C11 feature, while GCC does not
> complain and allows them in GNU99.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>
> Technically a build breaker fix, but given my track record of
> breaking the build today/yestday, lets have a reviewer approve :-)
>
>  m4/virt-compile-warnings.m4 | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
> index 26f231f97e..4f9eee121c 100644
> --- a/m4/virt-compile-warnings.m4
> +++ b/m4/virt-compile-warnings.m4
> @@ -125,6 +125,10 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
>      # We do "bad" function casts all the time for event callbacks
>      wantwarn="$wantwarn -Wno-cast-function-type"
>
> +    # CLang incorrectly complains about dup typedefs win gnu99 mode
> +    # so use this CLang-specific arg to keep it quiet
> +    wantwarn="$wantwarn -Wno-typedef-redefinition"
> +

Is this the *only* failure we have with CLang? If so ...
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>

Best Regards,
-- 
Fabiano Fidêncio

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list