From 42e4b74e1bbd08aad3afa46d741e46c40a8af73d Mon Sep 17 00:00:00 2001
From: Bihong Yu <yubihong@huawei.com>
Date: Sat, 6 Jun 2020 18:52:35 +0800
Subject: [PATCH] Fix some wrong usage of ATTRIBUTE_NONNULL()

The virStateInitialize() function has ATTRIBUTE_NONNULL()
referring to @root argument (incorrectly anyway) but in
daemonRunStateInit() NULL is passed in anyway.

Then there is virCommandAddArgPair() which also has
ATTRIBUTE_NONNULL() for one of its arguments and then checks the
argument for being NULL anyways.

cherry-pick from commit: 2a372a5ad5fab3bf26fb9bea019d38fa04ba8b34

Signed-off-by:Bihong Yu <yubihong@huawei.com>
Reviewed-by:Chuan Zheng <zhengchuan@huawei.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Jin Yan <jinyan12@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 9086f9a..4e6cb0a 100644
--- a/src/util/vircommand.h
+++ b/src/util/vircommand.h
@@ -128,8 +128,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

