From 30352032a6a5602bae3930ec4db97503d5ece558 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 10 Feb 2023 13:14:42 +0000 Subject: [PATCH] gstrfuncs: Use separate preprocessor conditionals for g-i and gtk-doc GObject-Introspection and gtk-doc both parse C headers using regular expressions, so they can easily be confused by non-trivial conditions. GObject-Introspection warns about this: .../gstrfuncs.h:151: the __GI_SCANNER__ constant should only be used with simple #ifdef or #endif: #if !defined (__GTK_DOC_IGNORE__) && !defined (__GI_SCANNER__) In this case it's very easy to convert the compound expression into nesting. Signed-off-by: Simon McVittie --- glib/gstrfuncs.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/glib/gstrfuncs.h b/glib/gstrfuncs.h index 569f96977..8a6830294 100644 --- a/glib/gstrfuncs.h +++ b/glib/gstrfuncs.h @@ -147,7 +147,8 @@ gboolean (g_str_has_prefix) (const gchar *str, const gchar *prefix); #if G_GNUC_CHECK_VERSION (2, 0) -#if !defined (__GTK_DOC_IGNORE__) && !defined (__GI_SCANNER__) +#ifndef __GTK_DOC_IGNORE__ +#ifndef __GI_SCANNER__ /* This macro is defeat a false -Wnonnull warning in GCC. * Without it, it thinks strlen and memcmp may be getting passed NULL @@ -220,7 +221,8 @@ gboolean (g_str_has_prefix) (const gchar *str, (g_strdup) ((STR)) \ ) -#endif /* !defined (__GTK_DOC_IGNORE__) && !defined (__GI_SCANNER__) */ +#endif /* !defined (__GI_SCANNER__) */ +#endif /* !defined (__GTK_DOC_IGNORE__) */ #endif /* G_GNUC_CHECK_VERSION (2, 0) */ /* String to/from double conversion functions */