There are some wrong usage of ATTRIBUTE_NONNULL, which may cause the compilation fail.
The
ATTRIBUTE_NONNULL is the define of __attribute__((__nonnull__(m))), which declares that
the
input pointer parameter of funciton should not be NULL. If we declare some input pointer
parameter of the function is ATTRIBUTE_NONNULL, the function should not redundancy check
of
the pointer parameter. And the ATTRIBUTE_NONNULL can only be using to pointer.
From 01a7301d50d6c1388df80dfa9af9da2582deec82 Mon Sep 17 00:00:00 2001
From: Bihong Yu <yubihong(a)huawei.com>
Date: Sat, 6 Jun 2020 18:20:16 +0800
Subject: [PATCH] bugifx: fix some wrong usage of ATTRIBUTE_NONNULL
The ATTRIBUTE_NONNULL is the define of __attribute__((__nonnull__(m))), which
declares that the input pointer parameter of funciton should not be NULL. If we
declare some input pointer parameter of the function is ATTRIBUTE_NONNULL, the
function should not redundancy check of the pointer parameter. And the
ATTRIBUTE_NONNULL can only be using to pointer.
Signed-off-by:Bihong Yu <yubihong(a)huawei.com>
Reviewed-by:Chuan Zheng <zhengchuan(a)huawei.com>
---
src/libvirt_internal.h | 3 +--
src/util/vircommand.h | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/libvirt_internal.h b/src/libvirt_internal.h
index 00ef7aa..72c6127 100644
--- a/src/libvirt_internal.h
+++ b/src/libvirt_internal.h
@@ -33,8 +33,7 @@ int virStateInitialize(bool privileged,
bool mandatory,
const char *root,
virStateInhibitCallback inhibit,
- void *opaque)
- ATTRIBUTE_NONNULL(2);
+ void *opaque);
int virStateCleanup(void);
int virStateReload(void);
int virStateStop(void);
diff --git a/src/util/vircommand.h b/src/util/vircommand.h
index ff8a785..e12c88b 100644
--- a/src/util/vircommand.h
+++ b/src/util/vircommand.h
@@ -126,8 +126,7 @@ void virCommandAddArgFormat(virCommandPtr cmd,
void virCommandAddArgPair(virCommandPtr cmd,
const char *name,
- const char *val)
- ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+ const char *val);
void virCommandAddArgSet(virCommandPtr cmd,
const char *const*vals) ATTRIBUTE_NONNULL(2);
--
1.8.3.1