Rather than inlining gl_WARN_ADD loads of time, we can shave about
17k size off of the configure script by delaying it to a cleanup
shell loop.
* m4/virt-compile-warnings.m4 (LIBVIRT_COMPILE_WARNINGS): Track a
list of things to check, rather than inlining multiple checks.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
m4/virt-compile-warnings.m4 | 72 ++++++++++++++++++++++-----------------------
1 file changed, 36 insertions(+), 36 deletions(-)
diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
index 6bf797f..938c8bb 100644
--- a/m4/virt-compile-warnings.m4
+++ b/m4/virt-compile-warnings.m4
@@ -133,47 +133,31 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
# Remove the ones we don't want, blacklisted earlier
gl_MANYWARN_COMPLEMENT([wantwarn], [$maybewarn], [$dontwarn])
- # Check for $CC support of each warning
- for w in $wantwarn; do
- gl_WARN_ADD([$w])
- done
-
# 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...
- gl_WARN_ADD([-Wno-sign-compare])
+ 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
- gl_WARN_ADD([-Wjump-misses-init])
+ wantwarn="$wantwarn -Wjump-misses-init"
# GNULIB turns on -Wformat=2 which implies -Wformat-nonliteral,
# so we need to manually re-exclude it. Also, older gcc 4.2
# added an implied ATTRIBUTE_NONNULL on any parameter marked
# ATTRIBUTE_FMT_PRINT, which causes -Wformat failure on our
# intentional use of virReportError(code, NULL).
- gl_WARN_ADD([-Wno-format-nonliteral])
+ wantwarn="$wantwarn -Wno-format-nonliteral"
if test $lv_cv_gcc_wformat_null_works = no; then
- gl_WARN_ADD([-Wno-format])
+ wantwarn="$wantwarn -Wno-format"
fi
# This should be < 256 really. Currently we're down to 4096,
# but using 1024 bytes sized buffers (mostly for virStrerror)
# stops us from going down further
- gl_WARN_ADD([-Wframe-larger-than=4096])
- dnl gl_WARN_ADD([-Wframe-larger-than=256])
-
- # Silence certain warnings in gnulib, and use improved glibc headers
- AC_DEFINE([lint], [1],
- [Define to 1 if the compiler is checking for lint.])
- AH_VERBATIM([FORTIFY_SOURCE],
- [/* Enable compile-time and run-time bounds-checking, and some warnings,
- without upsetting newer glibc. */
- #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ &&
__OPTIMIZE__
- # define _FORTIFY_SOURCE 2
- #endif
- ])
+ wantwarn="$wantwarn -Wframe-larger-than=4096"
+ dnl wantwarn="$wantwarn -Wframe-larger-than=256"
# Extra special flags
dnl -fstack-protector stuff passes gl_WARN_ADD with gcc
@@ -182,43 +166,59 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
*-*-linux*)
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])
- gl_WARN_ADD([-fstack-protector-all])
- gl_WARN_ADD([--param=ssp-buffer-size=4])
+ dnl wantwarn="$wantwarn -fstack-protector"
+ wantwarn="$wantwarn -fstack-protector-all"
+ wantwarn="$wantwarn --param=ssp-buffer-size=4"
dnl Even though it supports it, clang complains about
dnl use of --param=ssp-buffer-size=4 unless used with
dnl the -c arg. It doesn't like it when used with args
dnl that just link together .o files. Unfortunately
dnl we can't avoid that with automake, so we must turn
dnl off the following clang specific warning
- gl_WARN_ADD([-Wno-unused-command-line-argument])
+ wantwarn="$wantwarn -Wno-unused-command-line-argument"
;;
*-*-freebsd*)
dnl FreeBSD ships old gcc 4.2.1 which doesn't handle
dnl -fstack-protector-all well
- gl_WARN_ADD([-fstack-protector])
+ wantwarn="$wantwarn -fstack-protector"
- gl_WARN_ADD([-Wno-unused-command-line-argument])
+ wantwarn="$wantwarn -Wno-unused-command-line-argument"
;;
esac
- gl_WARN_ADD([-fexceptions])
- gl_WARN_ADD([-fasynchronous-unwind-tables])
- gl_WARN_ADD([-fdiagnostics-show-option])
- gl_WARN_ADD([-funit-at-a-time])
+ wantwarn="$wantwarn -fexceptions"
+ wantwarn="$wantwarn -fasynchronous-unwind-tables"
+ wantwarn="$wantwarn -fdiagnostics-show-option"
+ wantwarn="$wantwarn -funit-at-a-time"
# Need -fipa-pure-const in order to make -Wsuggest-attribute=pure
# fire even without -O.
- gl_WARN_ADD([-fipa-pure-const])
+ wantwarn="$wantwarn -fipa-pure-const"
# We should eventually enable this, but right now there are at
# least 75 functions triggering warnings.
- gl_WARN_ADD([-Wno-suggest-attribute=pure])
- gl_WARN_ADD([-Wno-suggest-attribute=const])
+ wantwarn="$wantwarn -Wno-suggest-attribute=pure"
+ wantwarn="$wantwarn -Wno-suggest-attribute=const"
if test "$set_werror" = "yes"
then
- gl_WARN_ADD([-Werror])
+ wantwarn="$wantwarn -Werror"
fi
+ # Check for $CC support of each warning
+ for w in $wantwarn; do
+ gl_WARN_ADD([$w])
+ done
+
+ # Silence certain warnings in gnulib, and use improved glibc headers
+ AC_DEFINE([lint], [1],
+ [Define to 1 if the compiler is checking for lint.])
+ AH_VERBATIM([FORTIFY_SOURCE],
+ [/* Enable compile-time and run-time bounds-checking, and some warnings,
+ without upsetting newer glibc. */
+ #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ &&
__OPTIMIZE__
+ # define _FORTIFY_SOURCE 2
+ #endif
+ ])
+
dnl Needed to keep compile quiet on python 2.4
save_WARN_CFLAGS=$WARN_CFLAGS
WARN_CFLAGS=
--
1.8.3.1
Show replies by date
On 08/16/2013 04:37 AM, Daniel P. Berrange wrote:
On Thu, Aug 15, 2013 at 03:11:39PM -0600, Eric Blake wrote:
> Rather than inlining gl_WARN_ADD loads of time, we can shave about
> 17k size off of the configure script by delaying it to a cleanup
> shell loop.
>
> * m4/virt-compile-warnings.m4 (LIBVIRT_COMPILE_WARNINGS): Track a
> list of things to check, rather than inlining multiple checks.
>
> Signed-off-by: Eric Blake <eblake(a)redhat.com>
> ---
> m4/virt-compile-warnings.m4 | 72 ++++++++++++++++++++++-----------------------
> 1 file changed, 36 insertions(+), 36 deletions(-)
ACK
Thanks; pushed.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org