Commit Graph

14 Commits

Author SHA1 Message Date
Eric Blake
40e973dd00 maint: turn on gcc logical-op checking
This would have detected the bug in commit 38ad33931 (Aug 09), which
we missed until commit f828ca35 (Jul 10); over 11 months later.

However, on Fedora 13, it also triggers LOTS of warnings from
the libcurl-devel header for two files:

esx/esx_vi.c: In function 'esxVI_CURL_Perform':
esx/esx_vi.c:232: error: logical '&&' with non-zero constant will always evaluate as true [-Wlogical-op]
esx/esx_vi.c:232: error: logical '&&' with non-zero constant will always evaluate as true [-Wlogical-op]
esx/esx_vi.c:232: error: logical '&&' with non-zero constant will always evaluate as true [-Wlogical-op]
...
xenapi/xenapi_driver.c: In function 'call_func':
xenapi/xenapi_driver.c:1872: error: logical '&&' with non-zero constant will always evaluate as true [-Wlogical-op]
xenapi/xenapi_driver.c:1872: error: logical '&&' with non-zero constant will always evaluate as true [-Wlogical-op]
xenapi/xenapi_driver.c:1872: error: logical '&&' with non-zero constant will always evaluate as true [-Wlogical-op]
...

libcurl allows to disable the type-checking code that triggers those
warnings, along with the reduction in type-safety of calls to some
libcurl functions. I figure this is worth the improved compiler
checking throughout the rest of libvirt.

* acinclude.m4 (--enable-compile-warnings=error): Add -Wlogical-op.
* configure.ac: Add -DCURL_DISABLE_TYPECHECK to LIBCURL_CFLAGS to
avoid compilation warning.

Suggested by Daniel P. Berrange.
Tweaked by Matthias Bolte.
2010-07-28 15:25:36 +02:00
Eric Blake
6e5b5bbc0a build: fix up some compiler flags
Matthias noted that the line:
virt_aa_helper_LDFLAGS = $(WARN_CFLAGS)
looks inconsistent, so I did an audit.

Currently, the set of compiler warning flags passed to gcc as $CC are
equally permitted as the set of linker flags passed to gcc as $LD, so
there was no problem with that usage.  But if we ever get in a
situation where $CC and $LD treat particular flags differently, using
the right variable form will make it easier.

In the process, I spotted a couple of typos that were omitting useful
flags, as well as specifying a -l under the wrong variable.

* acinclude.m4 (LIBVIRT_COMPILE_WARNINGS): Define WARN_LDFLAGS as
an alias for WARN_CFLAGS.
* tools/Makefile.am (virsh_LDFLAGS): Use more canonical spelling.
* proxy/Makefile.am (libvirt_proxy_LDFLAGS): Likewise. Move
library...
(libvirt_proxy_LDADD): ...here.
* src/Makefile.am (virt_aa_helper_LDFLAGS): Use more canonical
spelling of WARN_LDFLAGS.
(libvirt_parthelper_LDFLAGS, libvirt_lxc_LDFLAGS): Likewise.  Use
correct spelling of COVERAGE_LDFLAGS.
Reported by Matthias Bolte.
2010-05-17 09:12:42 -06:00
Eric Blake
7b5114f62b maint: show which compiler warning triggered
* acinclude.m4 (LIBVIRT_COMPILE_WARNINGS): Add
-fdiagnostics-show-option.
2010-03-30 11:29:09 -06:00
Jim Meyering
07613d2020 remove all trailing blank lines
by running this command:
git ls-files -z | xargs -0 perl -pi -0777 -e 's/\n\n+$/\n/'
This is in preparation for a more strict make syntax-check
rule that will detect trailing blank lines.
2009-07-16 15:06:42 +02:00
John Levon
d052118dae Improve compiler flag checking 2009-01-14 15:23:26 +00:00
Daniel P. Berrange
264ed02079 Fix gcc-ism in python build (John Levon) 2008-12-18 12:20:00 +00:00
Daniel P. Berrange
9d7661e415 Fix compat for old pkg-config and gnutls 2008-01-22 21:30:05 +00:00
Richard W.M. Jones
5a628880b0 Tue Nov 6 19:54:00 CET 2007 Jim Meyering <meyering@redhat.com>
Avoid risk of format string abuse (also avoids gcc warnings).
        * src/util.c (ReportError): Use a literal "%s" format string.
        * src/remote_internal.c (server_error): Likewise.
        * src/qemu_conf.c (qemudReportError): Likewise.
        * acinclude.m4: Add -Wformat -Wformat-security to default
          list of warning flags, to warn about errors such as the
          above.
2007-11-07 12:29:37 +00:00
Daniel P. Berrange
6f44e36e15 Test compiler flags for linking too 2007-09-21 20:01:43 +00:00
Richard W.M. Jones
c946c197fe Tue Aug 7 13:58:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
* acinclude.m4, configure.in: ./configure option
          --disable-stack-protector.
        * src/gnutls_1_0_compat.h: Compatibility with GnuTLS 1.0.
        * src/bridge.c: If no bridge ioctls, give an error at runtime.
2007-08-07 13:02:35 +00:00
Daniel Veillard
2b233a049e * acinclude.m4: applied patch from Jim Meyering to avoid clobbering
user specified CFLAGS
Daniel
2007-03-26 09:30:36 +00:00
Daniel P. Berrange
bcf1632ee6 Fixed typo 2007-03-21 15:22:31 +00:00
Daniel P. Berrange
1c236e9c25 Enable compiler stack protection flags 2007-03-21 14:52:12 +00:00
Mark McLoughlin
51d5609843 Thu Mar 01 16:17:48 EST 2007 Mark McLoughlin <markmc@redhat.com>
* acinclude.m4: add LIBVIRT_COMPILE_WARNINGS, copied from
        GNOME but with a few more flags we'd been using.

        * configure.in: use that instead of setting CFLAGS
        directly.

        * proxy/Makefile.am, python/Makefile.am, qemud/Makefile.am,
          src/Makefile.am, tests/Makefile.am: use $(WARN_CFLAGS)
2007-03-01 16:18:55 +00:00