[Libguestfs] [PATCH] build: build mlaugeas with -Wno-shift-negative-value

Richard W.M. Jones rjones at redhat.com
Mon Oct 9 13:36:22 UTC 2017


On Mon, Oct 09, 2017 at 02:34:50PM +0200, Pino Toscano wrote:
> The embedded copy of ocaml-augeas does Val_int(-1), which in turns
> triggers warnings in newer GCC versions about "left shift of negative
> value".  The issue actually lies in the OCaml headers (mlvalues.h in
> particular), and it was fixed in newer OCaml versions.
> 
> Since the code is actually correct, disable -Wshift-negative-value with
> -Wno-shift-negative-value (checking whether the compiler has it).
> ---
>  common/mlaugeas/Makefile.am | 2 +-
>  m4/guestfs-c.m4             | 6 ++++++
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/common/mlaugeas/Makefile.am b/common/mlaugeas/Makefile.am
> index d71d0074d..0f3cea820 100644
> --- a/common/mlaugeas/Makefile.am
> +++ b/common/mlaugeas/Makefile.am
> @@ -53,7 +53,7 @@ libmlaugeas_a_CPPFLAGS = \
>  	-I$(top_builddir) \
>  	-I$(shell $(OCAMLC) -where)
>  libmlaugeas_a_CFLAGS = \
> -	$(WARN_CFLAGS) $(WERROR_CFLAGS) \
> +	$(WARN_CFLAGS) $(NO_SNV_CFLAGS) $(WERROR_CFLAGS) \
>  	$(LIBVIRT_CFLAGS) $(LIBXML2_CFLAGS) \
>  	-fPIC
>  
> diff --git a/m4/guestfs-c.m4 b/m4/guestfs-c.m4
> index 6621a2747..13310d5db 100644
> --- a/m4/guestfs-c.m4
> +++ b/m4/guestfs-c.m4
> @@ -105,6 +105,12 @@ gl_WARN_ADD([-Wformat-truncation=1])
>  
>  AC_SUBST([WARN_CFLAGS])
>  
> +NO_SNV_CFLAGS=
> +gl_COMPILER_OPTION_IF([-Wno-shift-negative-value],[
> +    NO_SNV_CFLAGS="-Wno-shift-negative-value"
> +])
> +AC_SUBST([NO_SNV_CFLAGS])
> +
>  AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
>  AC_DEFINE([GNULIB_PORTCHECK], [1], [Enable some gnulib portability checks.])
>  AH_VERBATIM([FORTIFY_SOURCE],[

ACK

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top




More information about the Libguestfs mailing list