On 4/22/25 10:19, Philippe Mathieu-Daudé wrote:
When using Visual Studio Code (v1.99.3) and Apple clangd v17.0.0
I get:

   In file included from ../../qapi/string-output-visitor.c:14:
   qemu/include/qemu/cutils.h:144:12: error: 'strchrnul' is only available on 
macOS 15.4 or newer [-Werror,-Wunguarded-availability-new]
     144 |     return strchrnul(s, c);
         |            ^~~~~~~~~
   
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_string.h:198:9:
 note: 'strchrnul' has been marked as being introduced in macOS 15.4 here, but 
the deployment target is macOS 15.0.0
     198 |         strchrnul(const char *__s, int __c);
         |         ^
   qemu/include/qemu/cutils.h:144:12: note: enclose 'strchrnul' in a 
__builtin_available check to silence this warning
     144 |     return strchrnul(s, c);
         |            ^~~~~~~~~
   1 error generated.

Disable this -Wunguarded-availability-new warning as a
short term band-aid fix.

Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org>
---
  meson.build | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/meson.build b/meson.build
index 41f68d38069..539368f82b1 100644
--- a/meson.build
+++ b/meson.build
@@ -735,6 +735,7 @@ warn_flags = [
    '-Wstrict-prototypes',
    '-Wtype-limits',
    '-Wundef',
+  '-Wunguarded-availability',
    '-Wvla',
    '-Wwrite-strings',
@@ -747,6 +748,7 @@ warn_flags = [
    '-Wno-string-plus-int',
    '-Wno-tautological-type-limit-compare',
    '-Wno-typedef-redefinition',
+  '-Wno-unguarded-availability-new',
  ]
if host_os != 'darwin'

I solved it the same way locally, but didn't send a patch because I'm not sure what happens if the code runs on MacOS < 15.4, and I don't have such a machine available.

Is the symbol already there?
Does it crash?
I guess the warning is here for a good reason.

You can find a lot of issues open in various open source projects with this warning (with various fixes) since this update was released.

Reply via email to