[libvirt] [PATCH] m4: Disable -Wdisabled-optimization

Andrea Bolognani posted 1 patch 6 years, 7 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20170905153203.25638-1-abologna@redhat.com
m4/virt-compile-warnings.m4 | 5 +++++
1 file changed, 5 insertions(+)
[libvirt] [PATCH] m4: Disable -Wdisabled-optimization
Posted by Andrea Bolognani 6 years, 7 months ago
After b4f7793ce269, qemuxml2xmltest has apparently become big enough
to trigger a compilation error on aarch64:

    CC       qemuxml2xmltest.o
  qemuxml2xmltest.c: In function 'mymain':
  qemuxml2xmltest.c:1216:1: error: const/copy propagation disabled: 4361 basic blocks and 99285 registers [-Werror=disabled-optimization]
   }
   ^
  qemuxml2xmltest.c:1216:1: error: PRE disabled: 4361 basic blocks and 99285 registers [-Werror=disabled-optimization]
  qemuxml2xmltest.c:1216:1: error: const/copy propagation disabled: 4361 basic blocks and 99285 registers [-Werror=disabled-optimization]
  qemuxml2xmltest.c:1216:1: error: const/copy propagation disabled: 4361 basic blocks and 99285 registers [-Werror=disabled-optimization]

However, as the GCC documentation states, this warning is not really
caused by issues in our code, so it makes sense to disable it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 m4/virt-compile-warnings.m4 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
index e8f135126..f18a08a8f 100644
--- a/m4/virt-compile-warnings.m4
+++ b/m4/virt-compile-warnings.m4
@@ -64,6 +64,11 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
     # Several conditionals expand the same on both branches
     # depending on the particular platform/architecture
     dontwarn="$dontwarn -Wduplicated-branches"
+    # > This warning does not generally indicate that there is anything wrong
+    # > with your code; it merely indicates that GCC's optimizers are unable
+    # > to handle the code effectively.
+    # Source: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
+    dontwarn="$dontwarn -Wdisabled-optimization"
 
     # gcc 4.2 treats attribute(format) as an implicit attribute(nonnull),
     # which triggers spurious warnings for our usage
-- 
2.13.5

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] m4: Disable -Wdisabled-optimization
Posted by Daniel P. Berrange 6 years, 7 months ago
On Tue, Sep 05, 2017 at 05:32:03PM +0200, Andrea Bolognani wrote:
> After b4f7793ce269, qemuxml2xmltest has apparently become big enough
> to trigger a compilation error on aarch64:
> 
>     CC       qemuxml2xmltest.o
>   qemuxml2xmltest.c: In function 'mymain':
>   qemuxml2xmltest.c:1216:1: error: const/copy propagation disabled: 4361 basic blocks and 99285 registers [-Werror=disabled-optimization]
>    }
>    ^
>   qemuxml2xmltest.c:1216:1: error: PRE disabled: 4361 basic blocks and 99285 registers [-Werror=disabled-optimization]
>   qemuxml2xmltest.c:1216:1: error: const/copy propagation disabled: 4361 basic blocks and 99285 registers [-Werror=disabled-optimization]
>   qemuxml2xmltest.c:1216:1: error: const/copy propagation disabled: 4361 basic blocks and 99285 registers [-Werror=disabled-optimization]
> 
> However, as the GCC documentation states, this warning is not really
> caused by issues in our code, so it makes sense to disable it.
> 
> Signed-off-by: Andrea Bolognani <abologna@redhat.com>
> ---
>  m4/virt-compile-warnings.m4 | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
> index e8f135126..f18a08a8f 100644
> --- a/m4/virt-compile-warnings.m4
> +++ b/m4/virt-compile-warnings.m4
> @@ -64,6 +64,11 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
>      # Several conditionals expand the same on both branches
>      # depending on the particular platform/architecture
>      dontwarn="$dontwarn -Wduplicated-branches"
> +    # > This warning does not generally indicate that there is anything wrong
> +    # > with your code; it merely indicates that GCC's optimizers are unable
> +    # > to handle the code effectively.
> +    # Source: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
> +    dontwarn="$dontwarn -Wdisabled-optimization"
>  
>      # gcc 4.2 treats attribute(format) as an implicit attribute(nonnull),
>      # which triggers spurious warnings for our usage

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


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