From 363f5ebafcf42a0c9a55a6d0db42448710080431 Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Tue, 23 Jul 2024 12:21:41 +0200 Subject: [PATCH] gmacros: Define G_STATIC_ASSERT for GI Scanner Using G_STATIC_ASSERT in headers which are introspected currently requires guarding them behind `#ifndef __GI_SCANNER__` which is really annoying. We can just define the macros to be noops in a way that the scanner doesn't trip over them. Signed-off-by: Sebastian Wick --- glib/gmacros.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/glib/gmacros.h b/glib/gmacros.h index bddc5af9d..ea924a8ca 100644 --- a/glib/gmacros.h +++ b/glib/gmacros.h @@ -878,7 +878,10 @@ #endif #endif /* G_CXX_STD_CHECK_VERSION (11) */ #define G_STATIC_ASSERT_EXPR(expr) ((void) sizeof (char[(expr) ? 1 : -1])) -#endif /* !__GI_SCANNER__ */ +#else /* __GI_SCANNER__ */ +#define G_STATIC_ASSERT(expr) static int G_PASTE (_GStaticAssertGiScannerNoop, __LINE__) G_GNUC_UNUSED +#define G_STATIC_ASSERT_EXPR(expr) static int G_PASTE (_GStaticAssertGiScannerNoop, __LINE__) G_GNUC_UNUSED +#endif /* __GI_SCANNER__ */ /* Provide a string identifying the current code position */ #if defined (__GNUC__) && (__GNUC__ < 3) && !defined (G_CXX_STD_VERSION)