[Libguestfs] [libnbd PATCH 01/23] generator: split LIBNBD_ATTRIBUTE_NONNULL replacement text

Laszlo Ersek lersek at redhat.com
Tue Apr 25 07:10:45 UTC 2023


The LIBNBD_ATTRIBUTE_NONNULL replacement text is just a bit too long;
split the macro definition similarly to LIBNBD_ATTRIBUTE_ALLOC_DEALLOC.

It changes "include/libnbd.h" like this:

>  #ifndef LIBNBD_ATTRIBUTE_NONNULL
>  #if defined (__GNUC__) && LIBNBD_GCC_VERSION >= 120000 /* gcc >= 12.0 */
> -#define LIBNBD_ATTRIBUTE_NONNULL(...) __attribute__ ((__nonnull__ (__VA_ARGS__)))
> +#define LIBNBD_ATTRIBUTE_NONNULL(...) \
> +  __attribute__ ((__nonnull__ (__VA_ARGS__)))
>  #else
>  #define LIBNBD_ATTRIBUTE_NONNULL(...)
>  #endif

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2172516
Signed-off-by: Laszlo Ersek <lersek at redhat.com>
---
 generator/C.ml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/generator/C.ml b/generator/C.ml
index 61ca43d95db5..b65d3de2e82d 100644
--- a/generator/C.ml
+++ b/generator/C.ml
@@ -420,7 +420,8 @@ let
   pr "\n";
   pr "#ifndef LIBNBD_ATTRIBUTE_NONNULL\n";
   pr "#if defined (__GNUC__) && LIBNBD_GCC_VERSION >= 120000 /* gcc >= 12.0 */\n";
-  pr "#define LIBNBD_ATTRIBUTE_NONNULL(...) __attribute__ ((__nonnull__ (__VA_ARGS__)))\n";
+  pr "#define LIBNBD_ATTRIBUTE_NONNULL(...) \\\n";
+  pr "  __attribute__ ((__nonnull__ (__VA_ARGS__)))\n";
   pr "#else\n";
   pr "#define LIBNBD_ATTRIBUTE_NONNULL(...)\n";
   pr "#endif\n";



More information about the Libguestfs mailing list