[PATCH] Disable -Wunsafe-loop-optimizations warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This warning option is not reporting broken code. Rather it is merely
identifying loops which GCC would not be able to optimize fully when
using -funsafe-loop-optimizations.  In GCC 7 this triggers on the
loader code

osinfo_loader.c: In function 'osinfo_loader_process_list':
osinfo_loader.c:2127:11: error: missed loop optimization, the loop counter may overflow [-Werror=unsafe-loop-optimizations]
     while (tmp && *tmp) {
           ^

The warning just needs to be turned off since the code is not broken,
and we don't care about the optimization level

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---

Pushed as a broken build fix for Fedora rawhide

 m4/libosinfo-compile-warnings.m4 | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/m4/libosinfo-compile-warnings.m4 b/m4/libosinfo-compile-warnings.m4
index 9e0469a..1876837 100644
--- a/m4/libosinfo-compile-warnings.m4
+++ b/m4/libosinfo-compile-warnings.m4
@@ -41,6 +41,10 @@ AC_DEFUN([LIBOSINFO_COMPILE_WARNINGS],[
     dontwarn="$dontwarn -Wlong-long"
     # Unused macros are ok
     dontwarn="$dontwarn -Wunused-macros"
+    # This isn't warning about code bugs, it is telling
+    # you about loops which the compiler can't optimize
+    # due to unpredictable boundary conditions
+    dontwarn="$dontwarn -Wunsafe-loop-optimizations"
 
 
     # g_clear_object & G_ATOMIC_OP_USE_GCC_BUILTINS causes
-- 
2.9.3

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux