]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Revert "meson: avoid bogus warnings from clang and g_autoptr"
authorJán Tomko <jtomko@redhat.com>
Fri, 3 Sep 2021 14:39:36 +0000 (16:39 +0200)
committerJán Tomko <jtomko@redhat.com>
Wed, 8 Sep 2021 14:19:55 +0000 (16:19 +0200)
Commit 345996c6208b281233074362a8d81295e2e711d4 disabled the
-Wunused-but-set-variable warning on CLang, beacuse it warned
on variables that were unread, but we relied on the side effects
of their destructors.

Reinstate the warning now that all the occurrences have been fixed.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
build-aux/syntax-check.mk
meson.build

index 5c5a2a87713b6e37b1f5a50f5fd9836c2ab218e6..2058af0b77ce175262b172fb7a7706466b6ff08b 100644 (file)
@@ -1589,7 +1589,7 @@ exclude_file_name_regexp--sc_prohibit_canonicalize_file_name = \
   ^(build-aux/syntax-check\.mk|tests/virfilemock\.c)$$
 
 exclude_file_name_regexp--sc_prohibit_raw_allocation = \
-  ^(meson\.build|docs/advanced-tests\.rst|src/util/viralloc\.[ch]|examples/.*|tests/(securityselinuxhelper|(vircgroup|nss)mock|commandhelper)\.c|tools/wireshark/src/packet-libvirt\.c|tools/nss/libvirt_nss(_leases|_macs)?\.c)$$
+  ^(docs/advanced-tests\.rst|src/util/viralloc\.[ch]|examples/.*|tests/(securityselinuxhelper|(vircgroup|nss)mock|commandhelper)\.c|tools/wireshark/src/packet-libvirt\.c|tools/nss/libvirt_nss(_leases|_macs)?\.c)$$
 
 exclude_file_name_regexp--sc_prohibit_readlink = \
   ^src/(util/virutil|lxc/lxc_container)\.c$$
index a8c99ac4b162c33125e6d473c39be4b12481b8cc..9d493ccd9eb270b7f22edfabd96d3e7bf9bfd7e5 100644 (file)
@@ -470,27 +470,6 @@ if get_option('warning_level') == '2'
     supported_cc_flags += [ '-Wno-unused-function' ]
   endif
 
-  if supported_cc_flags.contains('-Wunused-but-set-variable')
-    # Clang complains about unused variables in many scenarios related
-    # to attribute((cleanup)) aka g_auto*
-    w_unused_but_set_var_args = [ '-Wunused-but-set-variable', '-Werror' ]
-    w_unused_but_set_var_code = '''
-      static inline void free_pointer (void *p) {
-        void **pp = (void**)p;
-        free (*pp);
-      }
-
-      int main(void) {
-        __attribute__((cleanup(free_pointer))) char *buffer = 0x0;
-        buffer = 0x1;
-      }
-    '''
-    # We previously turned on unused-but-set-variable, so we must turn
-    # it off again explicitly now.
-    if not cc.compiles(w_unused_but_set_var_code, args: w_unused_but_set_var_args)
-      supported_cc_flags += [ '-Wno-unused-but-set-variable' ]
-    endif
-  endif
 endif
 add_project_arguments(supported_cc_flags, language: 'c')