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

Re: [libvirt] [PATCH 0/6] Ensure clean compile with clang



  Daniel P. Berrange wrote:

> From: "Daniel P. Berrange" <berrange redhat com>
> 
> There are various problems building libvirt with clang,
> which mostly revolve around compiler warning handling.
> This series fixes all the problems I see with clang
> 3.2 on a Fedora 19 x86_64 host.
> 
> Daniel P. Berrange (6):
>   Ensure consistent enablement of gcc 'diagnostic' pragma
>   Workaround issue with clang and inline functions with static vars
>   Ignore cast alignment warnings in inotify code for Xen.
>   Correctly detect warning flags with clang
>   Only pass -export-dynamic to linker, not compiler
>   Don't duplicate compiler warning flags when linking
> 
>  configure.ac                |  4 ++--
>  daemon/Makefile.am          |  1 -
>  m4/virt-compile-warnings.m4 | 29 +++++++++++++++++++++++++----
>  src/Makefile.am             | 11 +++--------
>  src/internal.h              |  2 +-
>  src/xen/xen_inotify.c       |  3 +++
>  tests/vircgroupmock.c       |  7 ++++++-
>  tools/Makefile.am           |  4 +---
>  8 files changed, 41 insertions(+), 20 deletions(-)

Tested this patchset on FreeBSD with clang 3.1.

Had a warning like that when building examples:

gmake[2]: Entering directory `/usr/home/novel/code/libvirt/examples/openauth'
  CC       openauth-openauth.o
  CCLD     openauth
clang: warning: argument unused during compilation: '-g' [-Wunused-command-line-argument]
gmake[2]: Leaving directory `/usr/home/novel/code/libvirt/examples/openauth'

The problem was fixed by this change:

diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
index 5174472..dc0e7d7 100644
--- a/m4/virt-compile-warnings.m4
+++ b/m4/virt-compile-warnings.m4
@@ -191,7 +191,7 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
     dnl -fstack-protector stuff passes gl_WARN_ADD with gcc
     dnl on Mingw32, but fails when actually used
     case $host in
-       *-*-linux*)
+       *-*-linux*|*-*-freebsd*)
        dnl Fedora only uses -fstack-protector, but doesn't seem to
        dnl be great overhead in adding -fstack-protector-all instead
        dnl gl_WARN_ADD([-fstack-protector])

I still have another warning in gnulib:

CC regex.lo
In file included from regex.c:70:
./regex_internal.c:1397:11: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
if (idx < 0 || idx >= set->nelem)
    ~~~ ^ ~
1 warning generated.

But I'm not sure it affects the build with -Werror because I don't use
it since it still fails at gcrypt.h deprecated stuff anyways (and I
haven't test a fix for that with clang I posted in other thread).

Roman Bogorodskiy

Attachment: pgpr4uG0cScb7.pgp
Description: PGP signature


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