[libvirt] [dbus PATCH 4/8] m4: remove gnulib compile warning exceptions

Pavel Hrdina posted 8 patches 7 years, 3 months ago
[libvirt] [dbus PATCH 4/8] m4: remove gnulib compile warning exceptions
Posted by Pavel Hrdina 7 years, 3 months ago
We don't use gnulib so there is no need to have them.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 m4/virt-compile-warnings.m4 | 37 -------------------------------------
 1 file changed, 37 deletions(-)

diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
index 4d96a0e..644c321 100644
--- a/m4/virt-compile-warnings.m4
+++ b/m4/virt-compile-warnings.m4
@@ -37,12 +37,6 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
     dontwarn="$dontwarn -Wconversion"
     # Too many to deal with
     dontwarn="$dontwarn -Wsign-conversion"
-    # GNULIB gettext.h violates
-    dontwarn="$dontwarn -Wvla"
-    # Many GNULIB header violations
-    dontwarn="$dontwarn -Wundef"
-    # Need to allow bad cast for execve()
-    dontwarn="$dontwarn -Wcast-qual"
     # We need to use long long in many places
     dontwarn="$dontwarn -Wlong-long"
     # We allow manual list of all enum cases without default:
@@ -53,8 +47,6 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
     dontwarn="$dontwarn -Wstrict-overflow"
     # Not a problem since we don't use -funsafe-loop-optimizations
     dontwarn="$dontwarn -Wunsafe-loop-optimizations"
-    # Gnulib's stat-time.h violates this
-    dontwarn="$dontwarn -Waggregate-return"
     # gcc 4.4.6 complains this is C++ only; gcc 4.7.0 implies this from -Wall
     dontwarn="$dontwarn -Wenum-compare"
     # gcc 5.1 -Wformat-signedness mishandles enums, not ready for prime time
@@ -123,26 +115,6 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
     # Remove the ones we don't want, blacklisted earlier
     gl_MANYWARN_COMPLEMENT([wantwarn], [$maybewarn], [$dontwarn])
 
-    # 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...
-    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
-    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).
-    wantwarn="$wantwarn -Wno-format-nonliteral"
-    if test $lv_cv_gcc_wformat_null_works = no; then
-      wantwarn="$wantwarn -Wno-format"
-    fi
-
     # -Wformat enables this by default, and we should keep it,
     # but need to rewrite various areas of code first
     wantwarn="$wantwarn -Wno-format-truncation"
@@ -213,13 +185,4 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
            AC_DEFINE([HAVE_SUGGEST_ATTRIBUTE_FORMAT], [1], [Whether -Wsuggest-attribute=format works])
         ;;
     esac
-
-    # Silence certain warnings in gnulib, and use improved glibc headers
-    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
-    ])
 ])
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [dbus PATCH 4/8] m4: remove gnulib compile warning exceptions
Posted by Daniel P. Berrangé 7 years, 3 months ago
On Mon, Mar 19, 2018 at 10:30:48AM +0100, Pavel Hrdina wrote:
> We don't use gnulib so there is no need to have them.
> 
> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
> ---
>  m4/virt-compile-warnings.m4 | 37 -------------------------------------
>  1 file changed, 37 deletions(-)

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

> 
> diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
> index 4d96a0e..644c321 100644
> --- a/m4/virt-compile-warnings.m4
> +++ b/m4/virt-compile-warnings.m4
> @@ -37,12 +37,6 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
>      dontwarn="$dontwarn -Wconversion"
>      # Too many to deal with
>      dontwarn="$dontwarn -Wsign-conversion"
> -    # GNULIB gettext.h violates
> -    dontwarn="$dontwarn -Wvla"
> -    # Many GNULIB header violations
> -    dontwarn="$dontwarn -Wundef"
> -    # Need to allow bad cast for execve()
> -    dontwarn="$dontwarn -Wcast-qual"
>      # We need to use long long in many places
>      dontwarn="$dontwarn -Wlong-long"
>      # We allow manual list of all enum cases without default:
> @@ -53,8 +47,6 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
>      dontwarn="$dontwarn -Wstrict-overflow"
>      # Not a problem since we don't use -funsafe-loop-optimizations
>      dontwarn="$dontwarn -Wunsafe-loop-optimizations"
> -    # Gnulib's stat-time.h violates this
> -    dontwarn="$dontwarn -Waggregate-return"
>      # gcc 4.4.6 complains this is C++ only; gcc 4.7.0 implies this from -Wall
>      dontwarn="$dontwarn -Wenum-compare"
>      # gcc 5.1 -Wformat-signedness mishandles enums, not ready for prime time
> @@ -123,26 +115,6 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
>      # Remove the ones we don't want, blacklisted earlier
>      gl_MANYWARN_COMPLEMENT([wantwarn], [$maybewarn], [$dontwarn])
>  
> -    # 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...
> -    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
> -    wantwarn="$wantwarn -Wjump-misses-init"

We still have this at the top of the file:

    dontwarn="$dontwarn -Wc++-compat"

so this -Wjump-misses-init should be kept

> -
> -    # Silence certain warnings in gnulib, and use improved glibc headers
> -    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
> -    ])

Why are you disabling _FORTIFY_SOURCE - this is an important security
check.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [dbus PATCH 4/8] m4: remove gnulib compile warning exceptions
Posted by Pavel Hrdina 7 years, 3 months ago
On Mon, Mar 19, 2018 at 01:39:38PM +0000, Daniel P. Berrangé wrote:
> On Mon, Mar 19, 2018 at 10:30:48AM +0100, Pavel Hrdina wrote:
> > We don't use gnulib so there is no need to have them.
> > 
> > Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
> > ---
> >  m4/virt-compile-warnings.m4 | 37 -------------------------------------
> >  1 file changed, 37 deletions(-)
> 
> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> 
> > 
> > diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
> > index 4d96a0e..644c321 100644
> > --- a/m4/virt-compile-warnings.m4
> > +++ b/m4/virt-compile-warnings.m4
> > @@ -37,12 +37,6 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
> >      dontwarn="$dontwarn -Wconversion"
> >      # Too many to deal with
> >      dontwarn="$dontwarn -Wsign-conversion"
> > -    # GNULIB gettext.h violates
> > -    dontwarn="$dontwarn -Wvla"
> > -    # Many GNULIB header violations
> > -    dontwarn="$dontwarn -Wundef"
> > -    # Need to allow bad cast for execve()
> > -    dontwarn="$dontwarn -Wcast-qual"
> >      # We need to use long long in many places
> >      dontwarn="$dontwarn -Wlong-long"
> >      # We allow manual list of all enum cases without default:
> > @@ -53,8 +47,6 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
> >      dontwarn="$dontwarn -Wstrict-overflow"
> >      # Not a problem since we don't use -funsafe-loop-optimizations
> >      dontwarn="$dontwarn -Wunsafe-loop-optimizations"
> > -    # Gnulib's stat-time.h violates this
> > -    dontwarn="$dontwarn -Waggregate-return"
> >      # gcc 4.4.6 complains this is C++ only; gcc 4.7.0 implies this from -Wall
> >      dontwarn="$dontwarn -Wenum-compare"
> >      # gcc 5.1 -Wformat-signedness mishandles enums, not ready for prime time
> > @@ -123,26 +115,6 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
> >      # Remove the ones we don't want, blacklisted earlier
> >      gl_MANYWARN_COMPLEMENT([wantwarn], [$maybewarn], [$dontwarn])
> >  
> > -    # 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...
> > -    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
> > -    wantwarn="$wantwarn -Wjump-misses-init"
> 
> We still have this at the top of the file:
> 
>     dontwarn="$dontwarn -Wc++-compat"
> 
> so this -Wjump-misses-init should be kept

OK, didn't realize that.

> 
> > -
> > -    # Silence certain warnings in gnulib, and use improved glibc headers
> > -    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
> > -    ])
> 
> Why are you disabling _FORTIFY_SOURCE - this is an important security
> check.

That's a good question :) I saw gnulib in the comment and didn't look
what it actually does.  I'll keep it here.

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