[libvirt] [PATCH 2/2] m4: Don't suggest attribute malloc

Michal Privoznik mprivozn at redhat.com
Fri Oct 18 08:16:50 UTC 2019


With glib inclusion, some of its functions have
__attribute__((__malloc__)) which make compiler realize we want
to use the same attribute for some trivial functions of ours. For
instance qemuDomainManagedSavePath(). I don't see any real
benefit into using the attribute, so disable that suggestion.

In fact, wrong use of the attribute may lead to mysterious bugs:

  https://gitlab.gnome.org/GNOME/glib/issues/1465

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 m4/virt-compile-warnings.m4 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
index 7c86fdd3c6..1318ca59b9 100644
--- a/m4/virt-compile-warnings.m4
+++ b/m4/virt-compile-warnings.m4
@@ -126,6 +126,7 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
     dontwarn="$dontwarn -Wunused-macros"
     dontwarn="$dontwarn -Woverlength-strings"
     dontwarn="$dontwarn -Wstack-protector"
+    dontwarn="$dontwarn -Wsuggest-attribute=malloc"
 
     # Get all possible GCC warnings
     gl_MANYWARN_ALL_GCC([maybewarn])
-- 
2.21.0




More information about the libvir-list mailing list