Re: [PATCH 0/2] Work around broken clang. Again.

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

 



On 3/15/23 20:10, Michal Privoznik wrote:
>

Another option might be to just turn off optimization for the whole
virnuma.c file when compiling with clang. Except not really, because
meson deliberately doesn't allow that:

  https://github.com/mesonbuild/meson/issues/1367

On the other hand, that would solve only the problem at hand and not the
root cause. So maybe we need a bigger hammer after all. Something among
these lines:



diff --git i/meson.build w/meson.build
index 319ed790f9..d018693ca0 100644
--- i/meson.build
+++ w/meson.build
@@ -206,6 +206,12 @@ libvirt_lib_version = '@0@.@1@.@2@'.format(libvirt_so_version, libvirt_age, libv
 cc = meson.get_compiler('c')
 cc_flags = []
 
+compiler_warn = 0
+if cc.get_id() == 'clang'
+  cc_flags += [ '-O0' ]
+  compiler_warn = 1
+endif
+
 git_werror = get_option('git_werror')
 if (git_werror.enabled() or git_werror.auto()) and git and not get_option('werror')
   cc_flags += [ '-Werror' ]
@@ -2268,3 +2274,7 @@ if conf.has('WITH_QEMU')
   }
   summary(priv_summary, section: 'Privileges')
 endif
+
+if compiler_warn != 0
+  summary({'compiler': 'broken !!! Forcibly turning off optimizations. Go unbreak your compiler !!!'}, section: 'Compiler')
+endif



Of course, we could do more clever check (from my example in cover
letter whether Y() calls X()), but I don't know how to write that in
meson. But since we officially aim on GCC an Clang and only the latter
is broken I guess checking for compiler's ID is just fine.

Michal




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

  Powered by Linux