[PATCH-for-10.2? 1/2] tcg/tci: Disable -Wundef FFI_GO_CLOSURES warning

Philippe Mathieu-Daudé posted 2 patches 1 week, 4 days ago
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>
[PATCH-for-10.2? 1/2] tcg/tci: Disable -Wundef FFI_GO_CLOSURES warning
Posted by Philippe Mathieu-Daudé 1 week, 4 days ago
Since we build TCI with FFI (commit 22f15579fa1 "tcg: Build ffi data
structures for helpers") we get on Darwin:

  In file included from ../../tcg/tci.c:22:
  In file included from include/tcg/helper-info.h:13:
  /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/ffi/ffi.h:483:5: warning: 'FFI_GO_CLOSURES' is not defined, evaluates to 0 [-Wundef]
    483 | #if FFI_GO_CLOSURES
        |     ^
  1 warning generated.

Since this libffi change was committed more than 10 years ago (see
https://github.com/libffi/libffi/commit/e951d64c0852), just define
the missing definition on QEMU to silence the warning.

Reported-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/tcg/helper-info.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/tcg/helper-info.h b/include/tcg/helper-info.h
index 909fe73afa3..36bb7f8187f 100644
--- a/include/tcg/helper-info.h
+++ b/include/tcg/helper-info.h
@@ -10,6 +10,9 @@
 #define TCG_HELPER_INFO_H
 
 #ifdef CONFIG_TCG_INTERPRETER
+#ifndef FFI_GO_CLOSURES
+#define FFI_GO_CLOSURES 0
+#endif
 #include <ffi.h>
 #endif
 #include "tcg-target-reg-bits.h"
-- 
2.51.0


Re: [PATCH-for-10.2? 1/2] tcg/tci: Disable -Wundef FFI_GO_CLOSURES warning
Posted by Richard Henderson 1 week, 4 days ago
On 12/2/25 10:46, Philippe Mathieu-Daudé wrote:
> Since we build TCI with FFI (commit 22f15579fa1 "tcg: Build ffi data
> structures for helpers") we get on Darwin:
> 
>    In file included from ../../tcg/tci.c:22:
>    In file included from include/tcg/helper-info.h:13:
>    /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/ffi/ffi.h:483:5: warning: 'FFI_GO_CLOSURES' is not defined, evaluates to 0 [-Wundef]
>      483 | #if FFI_GO_CLOSURES
>          |     ^
>    1 warning generated.
> 
> Since this libffi change was committed more than 10 years ago (see
> https://github.com/libffi/libffi/commit/e951d64c0852), just define
> the missing definition on QEMU to silence the warning.

See also c23e9a1c from 2023, which fixed that to use an ifdef.

I suppose the inclusion or exclusion of the go interface is neither here nor there, so 
long as it compiles.

r~