[libvirt] [PATCH (RFC?)] Remove usage of __attribute__((nonnull))

Martin Kletzander posted 1 patch 141 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/4c92353ab0fe39ddac2ffc5375ec4e07ec72b137.1490701502.git.mkletzan@redhat.com
daemon/libvirtd.c                       |   2 +-
src/bhyve/bhyve_device.h                |   3 +-
src/bhyve/bhyve_driver.c                |   2 +-
src/conf/cpu_conf.c                     |   4 +-
src/conf/cpu_conf.h                     |   9 ++-
src/conf/domain_addr.c                  |   4 +-
src/conf/domain_addr.h                  |  96 ++++++++++------------------
src/conf/domain_audit.h                 |  60 ++++++------------
src/conf/domain_conf.c                  |   4 +-
src/conf/domain_conf.h                  |  58 +++++++----------
src/conf/domain_event.h                 |  24 +++----
src/conf/netdev_bandwidth_conf.h        |   5 +-
src/conf/network_event.h                |   8 +--
src/conf/node_device_event.h            |   8 +--
src/conf/numa_conf.h                    |  24 +++----
src/conf/object_event.c                 |   2 +-
src/conf/object_event.h                 |  15 ++---
src/conf/object_event_private.h         |  12 +---
src/conf/secret_event.h                 |   8 +--
src/conf/storage_event.h                |   8 +--
src/conf/virnodedeviceobj.h             |   3 +-
src/cpu/cpu.h                           |  36 ++++-------
src/interface/interface_backend_netcf.c |   2 +-
src/interface/interface_backend_udev.c  |  18 ++----
src/internal.h                          |  21 -------
src/libxl/libxl_domain.h                |   3 +-
src/network/bridge_driver.c             |   2 +-
src/network/bridge_driver.h             |  21 +++----
src/phyp/phyp_driver.c                  |   8 ---
src/qemu/qemu_alias.h                   |   6 +-
src/qemu/qemu_capabilities.c            |   2 +-
src/qemu/qemu_capabilities.h            |   6 +-
src/qemu/qemu_command.h                 |  12 ++--
src/qemu/qemu_conf.h                    |  15 ++---
src/qemu/qemu_domain.c                  |   4 +-
src/qemu/qemu_domain.h                  |  95 +++++++++-------------------
src/qemu/qemu_domain_address.h          |   9 +--
src/qemu/qemu_driver.c                  |   8 +--
src/qemu/qemu_interface.h               |   3 +-
src/qemu/qemu_migration.h               |  19 +++---
src/qemu/qemu_monitor.h                 |  63 +++++++------------
src/qemu/qemu_monitor_json.h            | 107 +++++++++++---------------------
src/rpc/virkeepalive.h                  |   4 +-
src/rpc/virnetclientstream.h            |   3 +-
src/rpc/virnetmessage.h                 |  23 +++----
src/secret/secret_util.h                |   3 +-
src/security/security_dac.c             |   4 --
src/storage/storage_driver.h            |  11 ++--
src/storage/storage_util.c              |   2 +-
src/storage/storage_util.h              |   3 +-
src/util/viralloc.h                     |  25 ++++----
src/util/viratomic.h                    |  27 +++-----
src/util/virbitmap.h                    |  63 +++++++------------
src/util/virbuffer.h                    |   2 +-
src/util/vircgroup.h                    |  22 +++----
src/util/vircommand.h                   |  44 +++++++------
src/util/vircrypto.h                    |   4 +-
src/util/virfile.h                      |  62 +++++++++---------
src/util/virfirewall.h                  |   8 +--
src/util/virfirmware.h                  |   6 +-
src/util/virhostcpu.c                   |   4 --
src/util/virhostdev.h                   |  67 +++++++-------------
src/util/viridentity.h                  |  12 +---
src/util/viriscsi.h                     |  13 ++--
src/util/virjson.h                      |  16 ++---
src/util/virkeyfile.h                   |  13 ++--
src/util/virkmod.h                      |   9 +--
src/util/virlog.h                       |  14 ++---
src/util/virmacaddr.h                   |   2 +-
src/util/virnetdev.h                    |  75 ++++++++++------------
src/util/virnetdevbandwidth.c           |   2 +-
src/util/virnetdevbandwidth.h           |   8 +--
src/util/virnetdevbridge.h              |  30 +++++----
src/util/virnetdevip.h                  |  10 ++-
src/util/virnetdevmacvlan.h             |  29 ++++-----
src/util/virnetdevmidonet.h             |   4 +-
src/util/virnetdevopenvswitch.h         |  11 ++--
src/util/virnetdevtap.h                 |  12 ++--
src/util/virnetdevveth.h                |   4 +-
src/util/virnetdevvportprofile.h        |   4 +-
src/util/virnuma.h                      |   3 +-
src/util/virobject.h                    |  27 +++-----
src/util/virpci.h                       |   2 +-
src/util/virpidfile.h                   |   2 +-
src/util/virqemu.h                      |   3 +-
src/util/virrandom.h                    |   2 +-
src/util/virscsihost.h                  |   3 +-
src/util/virseclabel.h                  |   3 +-
src/util/virsocketaddr.h                |   3 +-
src/util/virstorageencryption.h         |   3 +-
src/util/virstoragefile.h               |  27 +++-----
src/util/virstring.h                    |  37 +++++------
src/util/virsysinfo.h                   |   3 +-
src/util/virthread.h                    |   2 +-
src/util/virthreadpool.h                |   5 +-
src/util/virtime.h                      |  17 +++--
src/util/viruri.h                       |   6 +-
src/util/virutil.h                      |  11 ++--
src/util/viruuid.h                      |   6 +-
src/util/virvhba.h                      |  12 ++--
src/vz/vz_utils.h                       |   2 +-
src/xen/xen_hypervisor.h                |  33 ++++------
src/xen/xend_internal.c                 |   5 +-
tools/virsh-domain-monitor.h            |   2 +-
tools/vsh.c                             |   4 +-
tools/vsh.h                             |  27 ++++----
106 files changed, 625 insertions(+), 1099 deletions(-)

[libvirt] [PATCH (RFC?)] Remove usage of __attribute__((nonnull))

Posted by Martin Kletzander 141 weeks ago
The attribute (defined as ATTRIBUTE_NONNULL) was added long time
ago (2009), but in 2012 (commit eefb881d4683) it was disabled for
normal build, making it used only when coverity was building libvirt
or on special request.  It was disabled because it was being misused
and misunderstood -- the attribute is there as an optimization hint
for the compiler, not to enhance static analysis.

However, it is used until today in many places and since it is
disabled by default, it just screws up builds with STATIC_ANALYSIS
enabled.

Remove that attribute and all its usages.

Moreover lv_cv_static_analysis should not be used after this patch as
it does not have any other effect than just disabling one check in
domain_conf.c.  That check is there for developers to make sure no
device is forgotten, which for coverity is just a dead code.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
---
Sorry for long mail, but I figured it's not worth splitting this.

 daemon/libvirtd.c                       |   2 +-
 src/bhyve/bhyve_device.h                |   3 +-
 src/bhyve/bhyve_driver.c                |   2 +-
 src/conf/cpu_conf.c                     |   4 +-
 src/conf/cpu_conf.h                     |   9 ++-
 src/conf/domain_addr.c                  |   4 +-
 src/conf/domain_addr.h                  |  96 ++++++++++------------------
 src/conf/domain_audit.h                 |  60 ++++++------------
 src/conf/domain_conf.c                  |   4 +-
 src/conf/domain_conf.h                  |  58 +++++++----------
 src/conf/domain_event.h                 |  24 +++----
 src/conf/netdev_bandwidth_conf.h        |   5 +-
 src/conf/network_event.h                |   8 +--
 src/conf/node_device_event.h            |   8 +--
 src/conf/numa_conf.h                    |  24 +++----
 src/conf/object_event.c                 |   2 +-
 src/conf/object_event.h                 |  15 ++---
 src/conf/object_event_private.h         |  12 +---
 src/conf/secret_event.h                 |   8 +--
 src/conf/storage_event.h                |   8 +--
 src/conf/virnodedeviceobj.h             |   3 +-
 src/cpu/cpu.h                           |  36 ++++-------
 src/interface/interface_backend_netcf.c |   2 +-
 src/interface/interface_backend_udev.c  |  18 ++----
 src/internal.h                          |  21 -------
 src/libxl/libxl_domain.h                |   3 +-
 src/network/bridge_driver.c             |   2 +-
 src/network/bridge_driver.h             |  21 +++----
 src/phyp/phyp_driver.c                  |   8 ---
 src/qemu/qemu_alias.h                   |   6 +-
 src/qemu/qemu_capabilities.c            |   2 +-
 src/qemu/qemu_capabilities.h            |   6 +-
 src/qemu/qemu_command.h                 |  12 ++--
 src/qemu/qemu_conf.h                    |  15 ++---
 src/qemu/qemu_domain.c                  |   4 +-
 src/qemu/qemu_domain.h                  |  95 +++++++++-------------------
 src/qemu/qemu_domain_address.h          |   9 +--
 src/qemu/qemu_driver.c                  |   8 +--
 src/qemu/qemu_interface.h               |   3 +-
 src/qemu/qemu_migration.h               |  19 +++---
 src/qemu/qemu_monitor.h                 |  63 +++++++------------
 src/qemu/qemu_monitor_json.h            | 107 +++++++++++---------------------
 src/rpc/virkeepalive.h                  |   4 +-
 src/rpc/virnetclientstream.h            |   3 +-
 src/rpc/virnetmessage.h                 |  23 +++----
 src/secret/secret_util.h                |   3 +-
 src/security/security_dac.c             |   4 --
 src/storage/storage_driver.h            |  11 ++--
 src/storage/storage_util.c              |   2 +-
 src/storage/storage_util.h              |   3 +-
 src/util/viralloc.h                     |  25 ++++----
 src/util/viratomic.h                    |  27 +++-----
 src/util/virbitmap.h                    |  63 +++++++------------
 src/util/virbuffer.h                    |   2 +-
 src/util/vircgroup.h                    |  22 +++----
 src/util/vircommand.h                   |  44 +++++++------
 src/util/vircrypto.h                    |   4 +-
 src/util/virfile.h                      |  62 +++++++++---------
 src/util/virfirewall.h                  |   8 +--
 src/util/virfirmware.h                  |   6 +-
 src/util/virhostcpu.c                   |   4 --
 src/util/virhostdev.h                   |  67 +++++++-------------
 src/util/viridentity.h                  |  12 +---
 src/util/viriscsi.h                     |  13 ++--
 src/util/virjson.h                      |  16 ++---
 src/util/virkeyfile.h                   |  13 ++--
 src/util/virkmod.h                      |   9 +--
 src/util/virlog.h                       |  14 ++---
 src/util/virmacaddr.h                   |   2 +-
 src/util/virnetdev.h                    |  75 ++++++++++------------
 src/util/virnetdevbandwidth.c           |   2 +-
 src/util/virnetdevbandwidth.h           |   8 +--
 src/util/virnetdevbridge.h              |  30 +++++----
 src/util/virnetdevip.h                  |  10 ++-
 src/util/virnetdevmacvlan.h             |  29 ++++-----
 src/util/virnetdevmidonet.h             |   4 +-
 src/util/virnetdevopenvswitch.h         |  11 ++--
 src/util/virnetdevtap.h                 |  12 ++--
 src/util/virnetdevveth.h                |   4 +-
 src/util/virnetdevvportprofile.h        |   4 +-
 src/util/virnuma.h                      |   3 +-
 src/util/virobject.h                    |  27 +++-----
 src/util/virpci.h                       |   2 +-
 src/util/virpidfile.h                   |   2 +-
 src/util/virqemu.h                      |   3 +-
 src/util/virrandom.h                    |   2 +-
 src/util/virscsihost.h                  |   3 +-
 src/util/virseclabel.h                  |   3 +-
 src/util/virsocketaddr.h                |   3 +-
 src/util/virstorageencryption.h         |   3 +-
 src/util/virstoragefile.h               |  27 +++-----
 src/util/virstring.h                    |  37 +++++------
 src/util/virsysinfo.h                   |   3 +-
 src/util/virthread.h                    |   2 +-
 src/util/virthreadpool.h                |   5 +-
 src/util/virtime.h                      |  17 +++--
 src/util/viruri.h                       |   6 +-
 src/util/virutil.h                      |  11 ++--
 src/util/viruuid.h                      |   6 +-
 src/util/virvhba.h                      |  12 ++--
 src/vz/vz_utils.h                       |   2 +-
 src/xen/xen_hypervisor.h                |  33 ++++------
 src/xen/xend_internal.c                 |   5 +-
 tools/virsh-domain-monitor.h            |   2 +-
 tools/vsh.c                             |   4 +-
 tools/vsh.h                             |  27 ++++----
 106 files changed, 625 insertions(+), 1099 deletions(-)

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 891238bcbe0d..5cd3fa4ebccb 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -410,7 +410,7 @@ static void daemonInitialize(void)
 #undef VIR_DAEMON_LOAD_MODULE


-static int ATTRIBUTE_NONNULL(3)
+static int
 daemonSetupNetworking(virNetServerPtr srv,
                       virNetServerPtr srvAdm,
                       struct daemonConfig *config,
diff --git a/src/bhyve/bhyve_device.h b/src/bhyve/bhyve_device.h
index 1144f51dbe94..7d834708e86b 100644
--- a/src/bhyve/bhyve_device.h
+++ b/src/bhyve/bhyve_device.h
@@ -32,7 +32,6 @@ int bhyveDomainAssignPCIAddresses(virDomainDefPtr def, virDomainObjPtr obj);
 virDomainPCIAddressSetPtr bhyveDomainPCIAddressSetCreate(virDomainDefPtr def,
                                                          unsigned int nbuses);

-int bhyveDomainAssignAddresses(virDomainDefPtr def, virDomainObjPtr obj)
-    ATTRIBUTE_NONNULL(1);
+int bhyveDomainAssignAddresses(virDomainDefPtr def, virDomainObjPtr obj);

 #endif /* __BHYVE_DEVICE_H__ */
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index 74cc5ab219cc..d1ed4dea830e 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -129,7 +129,7 @@ bhyveAutostartDomains(bhyveConnPtr driver)
  *
  * Returns: a reference to a virCapsPtr instance or NULL
  */
-virCapsPtr ATTRIBUTE_NONNULL(1)
+virCapsPtr
 bhyveDriverGetCapabilities(bhyveConnPtr driver)
 {

diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index b78531e60261..ce58958c9f3d 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -75,7 +75,7 @@ virCPUDefFreeFeatures(virCPUDefPtr def)
 }


-void ATTRIBUTE_NONNULL(1)
+void
 virCPUDefFreeModel(virCPUDefPtr def)
 {

@@ -96,7 +96,7 @@ virCPUDefFree(virCPUDefPtr def)
 }


-int ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
+int
 virCPUDefCopyModel(virCPUDefPtr dst,
                    const virCPUDef *src,
                    bool resetPolicy)
diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h
index 3e02deed4bc5..ccc334e94ea4 100644
--- a/src/conf/cpu_conf.h
+++ b/src/conf/cpu_conf.h
@@ -124,16 +124,16 @@ struct _virCPUDef {
 };


-void ATTRIBUTE_NONNULL(1)
+void
 virCPUDefFreeFeatures(virCPUDefPtr def);

-void ATTRIBUTE_NONNULL(1)
+void
 virCPUDefFreeModel(virCPUDefPtr def);

 void
 virCPUDefFree(virCPUDefPtr def);

-int ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
+int
 virCPUDefCopyModel(virCPUDefPtr dst,
                    const virCPUDef *src,
                    bool resetPolicy);
@@ -149,8 +149,7 @@ virCPUDefCopyModelFilter(virCPUDefPtr dst,
                          const virCPUDef *src,
                          bool resetPolicy,
                          virCPUDefFeatureFilter filter,
-                         void *opaque)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                         void *opaque);

 void
 virCPUDefStealModel(virCPUDefPtr dst,
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index 35bdc34537e1..23b6a574d379 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -524,7 +524,7 @@ virDomainPCIAddressSlotInUse(virDomainPCIAddressSetPtr addrs,
  * automatically created by libvirt, so it is an internal error (not
  * XML).
  */
-static int ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
+static int
 virDomainPCIAddressReserveAddrInternal(virDomainPCIAddressSetPtr addrs,
                                        virPCIDeviceAddressPtr addr,
                                        virDomainPCIConnectFlags flags,
@@ -735,7 +735,7 @@ virDomainPCIAddressFindUnusedFunctionOnBus(virDomainPCIAddressBusPtr bus,
 }


-static int ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
+static int
 virDomainPCIAddressGetNextAddr(virDomainPCIAddressSetPtr addrs,
                                virPCIDeviceAddressPtr next_addr,
                                int function,
diff --git a/src/conf/domain_addr.h b/src/conf/domain_addr.h
index f884b8af2bb6..c705ce39c6d6 100644
--- a/src/conf/domain_addr.h
+++ b/src/conf/domain_addr.h
@@ -114,8 +114,7 @@ struct _virDomainPCIAddressSet {
 typedef struct _virDomainPCIAddressSet virDomainPCIAddressSet;
 typedef virDomainPCIAddressSet *virDomainPCIAddressSetPtr;

-char *virDomainPCIAddressAsString(virPCIDeviceAddressPtr addr)
-      ATTRIBUTE_NONNULL(1);
+char *virDomainPCIAddressAsString(virPCIDeviceAddressPtr addr);

 virDomainPCIAddressSetPtr virDomainPCIAddressSetAlloc(unsigned int nbuses);

@@ -126,52 +125,42 @@ bool virDomainPCIAddressFlagsCompatible(virPCIDeviceAddressPtr addr,
                                         virDomainPCIConnectFlags busFlags,
                                         virDomainPCIConnectFlags devFlags,
                                         bool reportError,
-                                        bool fromConfig)
-     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                                        bool fromConfig);

 bool virDomainPCIAddressValidate(virDomainPCIAddressSetPtr addrs,
                                  virPCIDeviceAddressPtr addr,
                                  const char *addrStr,
                                  virDomainPCIConnectFlags flags,
-                                 bool fromConfig)
-     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                                 bool fromConfig);


 int virDomainPCIAddressBusSetModel(virDomainPCIAddressBusPtr bus,
-                                   virDomainControllerModelPCI model)
-    ATTRIBUTE_NONNULL(1);
+                                   virDomainControllerModelPCI model);

 bool virDomainPCIAddressSlotInUse(virDomainPCIAddressSetPtr addrs,
-                                  virPCIDeviceAddressPtr addr)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                                  virPCIDeviceAddressPtr addr);

 int virDomainPCIAddressSetGrow(virDomainPCIAddressSetPtr addrs,
                                virPCIDeviceAddressPtr addr,
-                               virDomainPCIConnectFlags flags)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                               virDomainPCIConnectFlags flags);

 int virDomainPCIAddressReserveAddr(virDomainPCIAddressSetPtr addrs,
                                    virPCIDeviceAddressPtr addr,
-                                   virDomainPCIConnectFlags flags)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                                   virDomainPCIConnectFlags flags);

 int virDomainPCIAddressEnsureAddr(virDomainPCIAddressSetPtr addrs,
                                   virDomainDeviceInfoPtr dev,
-                                  virDomainPCIConnectFlags flags)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                                  virDomainPCIConnectFlags flags);

 int virDomainPCIAddressReleaseAddr(virDomainPCIAddressSetPtr addrs,
-                                   virPCIDeviceAddressPtr addr)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                                   virPCIDeviceAddressPtr addr);

 int virDomainPCIAddressReserveNextAddr(virDomainPCIAddressSetPtr addrs,
                                        virDomainDeviceInfoPtr dev,
                                        virDomainPCIConnectFlags flags,
-                                       int function)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                                       int function);

-void virDomainPCIAddressSetAllMulti(virDomainDefPtr def)
-    ATTRIBUTE_NONNULL(1);
+void virDomainPCIAddressSetAllMulti(virDomainDefPtr def);

 struct _virDomainCCWAddressSet {
     virHashTablePtr defined;
@@ -182,23 +171,19 @@ typedef virDomainCCWAddressSet *virDomainCCWAddressSetPtr;

 int virDomainCCWAddressAssign(virDomainDeviceInfoPtr dev,
                               virDomainCCWAddressSetPtr addrs,
-                              bool autoassign)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                              bool autoassign);
 void virDomainCCWAddressSetFree(virDomainCCWAddressSetPtr addrs);
 int virDomainCCWAddressAllocate(virDomainDefPtr def,
                                 virDomainDeviceDefPtr dev,
                                 virDomainDeviceInfoPtr info,
-                                void *data)
-    ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
+                                void *data);
 int virDomainCCWAddressValidate(virDomainDefPtr def,
                                 virDomainDeviceDefPtr dev,
                                 virDomainDeviceInfoPtr info,
-                                void *data)
-    ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
+                                void *data);

 int virDomainCCWAddressReleaseAddr(virDomainCCWAddressSetPtr addrs,
-                                   virDomainDeviceInfoPtr dev)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                                   virDomainDeviceInfoPtr dev);
 virDomainCCWAddressSetPtr virDomainCCWAddressSetCreate(void);

 struct _virDomainVirtioSerialController {
@@ -220,59 +205,49 @@ virDomainVirtioSerialAddrSetPtr
 virDomainVirtioSerialAddrSetCreate(void);
 int
 virDomainVirtioSerialAddrSetAddControllers(virDomainVirtioSerialAddrSetPtr addrs,
-                                           virDomainDefPtr def)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                                           virDomainDefPtr def);
 void
 virDomainVirtioSerialAddrSetFree(virDomainVirtioSerialAddrSetPtr addrs);
 virDomainVirtioSerialAddrSetPtr
-virDomainVirtioSerialAddrSetCreateFromDomain(virDomainDefPtr def)
-    ATTRIBUTE_NONNULL(1);
+virDomainVirtioSerialAddrSetCreateFromDomain(virDomainDefPtr def);
 bool
 virDomainVirtioSerialAddrIsComplete(virDomainDeviceInfoPtr info);
 int
 virDomainVirtioSerialAddrAutoAssignFromCache(virDomainDefPtr def,
                                              virDomainVirtioSerialAddrSetPtr addrs,
                                              virDomainDeviceInfoPtr info,
-                                             bool allowZero)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                                             bool allowZero);

 int
 virDomainVirtioSerialAddrAutoAssign(virDomainDefPtr def,
                                     virDomainDeviceInfoPtr info,
-                                    bool allowZero)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                                    bool allowZero);

 int
 virDomainVirtioSerialAddrAssign(virDomainDefPtr def,
                                 virDomainVirtioSerialAddrSetPtr addrs,
                                 virDomainDeviceInfoPtr info,
                                 bool allowZero,
-                                bool portOnly)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                                bool portOnly);

 int
 virDomainVirtioSerialAddrReserve(virDomainDefPtr def,
                                  virDomainDeviceDefPtr dev,
                                  virDomainDeviceInfoPtr info,
-                                 void *data)
-    ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
+                                 void *data);

 int
 virDomainVirtioSerialAddrRelease(virDomainVirtioSerialAddrSetPtr addrs,
-                                 virDomainDeviceInfoPtr info)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                                 virDomainDeviceInfoPtr info);

 bool
-virDomainUSBAddressPortIsValid(unsigned int *port)
-    ATTRIBUTE_NONNULL(1);
+virDomainUSBAddressPortIsValid(unsigned int *port);

 void
 virDomainUSBAddressPortFormatBuf(virBufferPtr buf,
-                                 unsigned int *port)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                                 unsigned int *port);
 char *
-virDomainUSBAddressPortFormat(unsigned int *port)
-    ATTRIBUTE_NONNULL(1);
+virDomainUSBAddressPortFormat(unsigned int *port);

 # define VIR_DOMAIN_USB_HUB_PORTS 8

@@ -298,37 +273,30 @@ typedef virDomainUSBAddressSet *virDomainUSBAddressSetPtr;
 virDomainUSBAddressSetPtr virDomainUSBAddressSetCreate(void);

 int virDomainUSBAddressSetAddControllers(virDomainUSBAddressSetPtr addrs,
-                                         virDomainDefPtr def)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                                         virDomainDefPtr def);
 int
 virDomainUSBAddressSetAddHub(virDomainUSBAddressSetPtr addrs,
-                             virDomainHubDefPtr hub)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                             virDomainHubDefPtr hub);
 size_t
 virDomainUSBAddressCountAllPorts(virDomainDefPtr def);
 void virDomainUSBAddressSetFree(virDomainUSBAddressSetPtr addrs);

 int
 virDomainUSBAddressPresent(virDomainDeviceInfoPtr info,
-                           void *data)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                           void *data);
 int
 virDomainUSBAddressReserve(virDomainDeviceInfoPtr info,
-                           void *data)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                           void *data);

 int
 virDomainUSBAddressAssign(virDomainUSBAddressSetPtr addrs,
-                          virDomainDeviceInfoPtr info)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                          virDomainDeviceInfoPtr info);

 int
 virDomainUSBAddressEnsure(virDomainUSBAddressSetPtr addrs,
-                          virDomainDeviceInfoPtr info)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                          virDomainDeviceInfoPtr info);

 int
 virDomainUSBAddressRelease(virDomainUSBAddressSetPtr addrs,
-                           virDomainDeviceInfoPtr info)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                           virDomainDeviceInfoPtr info);
 #endif /* __DOMAIN_ADDR_H__ */
diff --git a/src/conf/domain_audit.h b/src/conf/domain_audit.h
index 8cb585dc7d96..f01d5b8344b4 100644
--- a/src/conf/domain_audit.h
+++ b/src/conf/domain_audit.h
@@ -29,110 +29,88 @@

 void virDomainAuditStart(virDomainObjPtr vm,
                          const char *reason,
-                         bool success)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                         bool success);
 void virDomainAuditInit(virDomainObjPtr vm,
                         pid_t pid,
-                        ino_t pidns)
-    ATTRIBUTE_NONNULL(1);
+                        ino_t pidns);
 void virDomainAuditStop(virDomainObjPtr vm,
-                        const char *reason)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                        const char *reason);
 void virDomainAuditDisk(virDomainObjPtr vm,
                         virStorageSourcePtr oldDef,
                         virStorageSourcePtr newDef,
                         const char *reason,
-                        bool success)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
+                        bool success);
 void virDomainAuditFS(virDomainObjPtr vm,
                       virDomainFSDefPtr oldDef,
                       virDomainFSDefPtr newDef,
                       const char *reason,
-                      bool success)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
+                      bool success);
 void virDomainAuditNet(virDomainObjPtr vm,
                        virDomainNetDefPtr oldDef,
                        virDomainNetDefPtr newDef,
                        const char *reason,
-                       bool success)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
+                       bool success);
 void virDomainAuditNetDevice(virDomainDefPtr vmDef,
                              virDomainNetDefPtr netDef,
                              const char *device,
-                             bool success)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                             bool success);
 void virDomainAuditHostdev(virDomainObjPtr vm,
                            virDomainHostdevDefPtr def,
                            const char *reason,
-                           bool success)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                           bool success);
 void virDomainAuditCgroup(virDomainObjPtr vm,
                           virCgroupPtr group,
                           const char *reason,
                           const char *extra,
-                          bool success)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
-    ATTRIBUTE_NONNULL(4);
+                          bool success);
 void virDomainAuditCgroupMajor(virDomainObjPtr vm,
                                virCgroupPtr group,
                                const char *reason,
                                int maj,
                                const char *name,
                                const char *perms,
-                               bool success)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
-    ATTRIBUTE_NONNULL(5) ATTRIBUTE_NONNULL(6);
+                               bool success);
 void virDomainAuditCgroupPath(virDomainObjPtr vm,
                               virCgroupPtr group,
                               const char *reason,
                               const char *path,
                               const char *perms,
-                              int rc)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
-    ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5);
+                              int rc);
 void virDomainAuditMemory(virDomainObjPtr vm,
                           unsigned long long oldmem,
                           unsigned long long newmem,
                           const char *reason,
-                          bool success)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
+                          bool success);
 void virDomainAuditVcpu(virDomainObjPtr vm,
                         unsigned int oldvcpu,
                         unsigned int newvcpu,
                         const char *reason,
-                        bool success)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
+                        bool success);
 void virDomainAuditIOThread(virDomainObjPtr vm,
                             unsigned int oldiothread,
                             unsigned int newiothread,
                             const char *reason,
-                            bool success)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
+                            bool success);
 void virDomainAuditSecurityLabel(virDomainObjPtr vm,
-                                 bool success)
-    ATTRIBUTE_NONNULL(1);
+                                 bool success);
 void virDomainAuditRedirdev(virDomainObjPtr vm,
                             virDomainRedirdevDefPtr def,
                             const char *reason,
-                            bool success)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                            bool success);

 void virDomainAuditChardev(virDomainObjPtr vm,
                            virDomainChrDefPtr oldDef,
                            virDomainChrDefPtr newDef,
                            const char *reason,
-                           bool success)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
+                           bool success);
 void virDomainAuditRNG(virDomainObjPtr vm,
                        virDomainRNGDefPtr oldDef,
                        virDomainRNGDefPtr newDef,
                        const char *reason,
-                       bool success)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
+                       bool success);
 void virDomainAuditShmem(virDomainObjPtr vm,
                          virDomainShmemDefPtr def,
-                         const char *reason, bool success)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                         const char *reason, bool success);


 #endif /* __VIR_DOMAIN_AUDIT_H__ */
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1b0a55b27fa9..63ba3e5bd1d1 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1947,7 +1947,7 @@ virDomainNetDefFree(virDomainNetDefPtr def)
     VIR_FREE(def);
 }

-void ATTRIBUTE_NONNULL(1)
+void
 virDomainChrSourceDefClear(virDomainChrSourceDefPtr def)
 {
     switch (def->type) {
@@ -5181,7 +5181,7 @@ virDomainDefValidate(virDomainDefPtr def,
 /* Generate a string representation of a device address
  * @info address Device address to stringify
  */
-static int ATTRIBUTE_NONNULL(2)
+static int
 virDomainDeviceInfoFormat(virBufferPtr buf,
                           virDomainDeviceInfoPtr info,
                           unsigned int flags)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 47eaacef3d48..ff33a235bcc8 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2531,8 +2531,7 @@ virDomainXMLOptionPtr virDomainXMLOptionNew(virDomainDefParserConfigPtr config,
 void virDomainNetGenerateMAC(virDomainXMLOptionPtr xmlopt, virMacAddrPtr mac);

 virDomainXMLNamespacePtr
-virDomainXMLOptionGetNamespace(virDomainXMLOptionPtr xmlopt)
-    ATTRIBUTE_NONNULL(1);
+virDomainXMLOptionGetNamespace(virDomainXMLOptionPtr xmlopt);

 int virDomainDefPostParse(virDomainDefPtr def,
                           virCapsPtr caps,
@@ -2565,8 +2564,7 @@ void virDomainDefVcpuOrderClear(virDomainDefPtr def);
 int  virDomainDefGetVcpusTopology(const virDomainDef *def,
                                   unsigned int *maxvcpus);

-virDomainObjPtr virDomainObjNew(virDomainXMLOptionPtr caps)
-    ATTRIBUTE_NONNULL(1);
+virDomainObjPtr virDomainObjNew(virDomainXMLOptionPtr caps);

 void virDomainObjEndAPI(virDomainObjPtr *vm);

@@ -2651,7 +2649,7 @@ int virDomainDeviceInfoIterate(virDomainDefPtr def,

 bool virDomainDefHasDeviceAddress(virDomainDefPtr def,
                                   virDomainDeviceInfoPtr info)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 void virDomainDefFree(virDomainDefPtr vm);

@@ -2886,11 +2884,9 @@ int virDomainHostdevFind(virDomainDefPtr def, virDomainHostdevDefPtr match,
 virDomainGraphicsListenDefPtr
 virDomainGraphicsGetListen(virDomainGraphicsDefPtr def, size_t i);
 int virDomainGraphicsListenAppendAddress(virDomainGraphicsDefPtr def,
-                                         const char *address)
-            ATTRIBUTE_NONNULL(1);
+                                         const char *address);
 int virDomainGraphicsListenAppendSocket(virDomainGraphicsDefPtr def,
-                                        const char *socket)
-            ATTRIBUTE_NONNULL(1);
+                                        const char *socket);

 virDomainNetType virDomainNetGetActualType(virDomainNetDefPtr iface);
 const char *virDomainNetGetActualBridgeName(virDomainNetDefPtr iface);
@@ -2921,8 +2917,7 @@ int virDomainControllerFindByPCIAddress(virDomainDefPtr def,
 int virDomainControllerFindUnusedIndex(virDomainDef const *def, int type);
 virDomainControllerDefPtr virDomainControllerRemove(virDomainDefPtr def, size_t i);
 const char *virDomainControllerAliasFind(const virDomainDef *def,
-                                         int type, int idx)
-    ATTRIBUTE_NONNULL(1);
+                                         int type, int idx);

 int virDomainLeaseIndex(virDomainDefPtr def,
                         virDomainLeaseDefPtr lease);
@@ -2942,8 +2937,7 @@ void
 virDomainChrGetDomainPtrs(const virDomainDef *vmdef,
                           virDomainChrDeviceType type,
                           const virDomainChrDef ***arrPtr,
-                          size_t *cntPtr)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
+                          size_t *cntPtr);
 virDomainChrDefPtr
 virDomainChrFind(virDomainDefPtr def,
                  virDomainChrDefPtr target);
@@ -3040,11 +3034,9 @@ int virDomainDiskDefForeachPath(virDomainDiskDefPtr disk,
                                 void *opaque);

 void
-virDomainObjSetState(virDomainObjPtr obj, virDomainState state, int reason)
-        ATTRIBUTE_NONNULL(1);
+virDomainObjSetState(virDomainObjPtr obj, virDomainState state, int reason);
 virDomainState
-virDomainObjGetState(virDomainObjPtr obj, int *reason)
-        ATTRIBUTE_NONNULL(1);
+virDomainObjGetState(virDomainObjPtr obj, int *reason);

 virSecurityLabelDefPtr
 virDomainDefGetSecurityLabelDef(virDomainDefPtr def, const char *model);
@@ -3056,23 +3048,21 @@ typedef const char* (*virEventActionToStringFunc)(int type);
 typedef int (*virEventActionFromStringFunc)(const char *type);

 int virDomainMemoryInsert(virDomainDefPtr def, virDomainMemoryDefPtr mem)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
-virDomainMemoryDefPtr virDomainMemoryRemove(virDomainDefPtr def, int idx)
-    ATTRIBUTE_NONNULL(1);
+    ATTRIBUTE_RETURN_CHECK;
+virDomainMemoryDefPtr virDomainMemoryRemove(virDomainDefPtr def, int idx);
 int virDomainMemoryFindByDef(virDomainDefPtr def, virDomainMemoryDefPtr mem)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virDomainMemoryFindInactiveByDef(virDomainDefPtr def,
                                      virDomainMemoryDefPtr mem)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virDomainShmemDefInsert(virDomainDefPtr def, virDomainShmemDefPtr shmem)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 bool virDomainShmemDefEquals(virDomainShmemDefPtr src, virDomainShmemDefPtr dst)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 ssize_t virDomainShmemDefFind(virDomainDefPtr def, virDomainShmemDefPtr shmem)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
-virDomainShmemDefPtr virDomainShmemDefRemove(virDomainDefPtr def, size_t idx)
-    ATTRIBUTE_NONNULL(1);
+    ATTRIBUTE_RETURN_CHECK;
+virDomainShmemDefPtr virDomainShmemDefRemove(virDomainDefPtr def, size_t idx);

 VIR_ENUM_DECL(virDomainTaint)
 VIR_ENUM_DECL(virDomainVirt)
@@ -3228,12 +3218,10 @@ virDomainParseMemory(const char *xpath,
                      bool required,
                      bool capped);

-bool virDomainDefNeedsPlacementAdvice(virDomainDefPtr def)
-    ATTRIBUTE_NONNULL(1);
+bool virDomainDefNeedsPlacementAdvice(virDomainDefPtr def);

 int virDomainDiskDefCheckDuplicateInfo(const virDomainDiskDef *a,
-                                       const virDomainDiskDef *b)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                                       const virDomainDiskDef *b);

 int virDomainDefGetVcpuPinInfoHelper(virDomainDefPtr def,
                                      int maplen,
@@ -3241,11 +3229,11 @@ int virDomainDefGetVcpuPinInfoHelper(virDomainDefPtr def,
                                      unsigned char *cpumaps,
                                      int hostcpus,
                                      virBitmapPtr autoCpuset)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

-bool virDomainDefHasMemballoon(const virDomainDef *def) ATTRIBUTE_NONNULL(1);
+bool virDomainDefHasMemballoon(const virDomainDef *def);

-char *virDomainObjGetShortName(const virDomainDef *def) ATTRIBUTE_NONNULL(1);
+char *virDomainObjGetShortName(const virDomainDef *def);

 int
 virDomainGetBlkioParametersAssignFromDef(virDomainDefPtr def,
@@ -3256,7 +3244,7 @@ virDomainGetBlkioParametersAssignFromDef(virDomainDefPtr def,
 bool
 virDomainDeviceInfoAddressIsEqual(const virDomainDeviceInfo *a,
                                   const virDomainDeviceInfo *b)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virDomainDiskSetBlockIOTune(virDomainDiskDefPtr disk,
                                 virDomainBlockIoTuneInfo *info);
diff --git a/src/conf/domain_event.h b/src/conf/domain_event.h
index 3992a29c5804..3f898d44fbb0 100644
--- a/src/conf/domain_event.h
+++ b/src/conf/domain_event.h
@@ -264,8 +264,7 @@ virDomainEventStateRegister(virConnectPtr conn,
                             virObjectEventStatePtr state,
                             virConnectDomainEventCallback callback,
                             void *opaque,
-                            virFreeCallback freecb)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                            virFreeCallback freecb);
 int
 virDomainEventStateRegisterID(virConnectPtr conn,
                               virObjectEventStatePtr state,
@@ -274,8 +273,7 @@ virDomainEventStateRegisterID(virConnectPtr conn,
                               virConnectDomainEventGenericCallback cb,
                               void *opaque,
                               virFreeCallback freecb,
-                              int *callbackID)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5);
+                              int *callbackID);
 int
 virDomainEventStateRegisterClient(virConnectPtr conn,
                                   virObjectEventStatePtr state,
@@ -286,23 +284,18 @@ virDomainEventStateRegisterClient(virConnectPtr conn,
                                   virFreeCallback freecb,
                                   bool legacy,
                                   int *callbackID,
-                                  bool remoteID)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5)
-    ATTRIBUTE_NONNULL(9);
+                                  bool remoteID);

 int
 virDomainEventStateCallbackID(virConnectPtr conn,
                               virObjectEventStatePtr state,
                               virConnectDomainEventCallback callback,
-                              int *remoteID)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
-    ATTRIBUTE_NONNULL(4);
+                              int *remoteID);

 int
 virDomainEventStateDeregister(virConnectPtr conn,
                               virObjectEventStatePtr state,
-                              virConnectDomainEventCallback callback)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                              virConnectDomainEventCallback callback);

 int
 virDomainQemuMonitorEventStateRegisterID(virConnectPtr conn,
@@ -313,9 +306,7 @@ virDomainQemuMonitorEventStateRegisterID(virConnectPtr conn,
                                          void *opaque,
                                          virFreeCallback freecb,
                                          unsigned int flags,
-                                         int *callbackID)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5)
-    ATTRIBUTE_NONNULL(9);
+                                         int *callbackID);

 virObjectEventPtr
 virDomainQemuMonitorEventNew(int id,
@@ -324,7 +315,6 @@ virDomainQemuMonitorEventNew(int id,
                              const char *event,
                              long long seconds,
                              unsigned int micros,
-                             const char *details)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
+                             const char *details);

 #endif
diff --git a/src/conf/netdev_bandwidth_conf.h b/src/conf/netdev_bandwidth_conf.h
index 30f988953cfd..413546666dbc 100644
--- a/src/conf/netdev_bandwidth_conf.h
+++ b/src/conf/netdev_bandwidth_conf.h
@@ -32,12 +32,11 @@
 int virNetDevBandwidthParse(virNetDevBandwidthPtr *bandwidth,
                             xmlNodePtr node,
                             int net_type)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virNetDevBandwidthFormat(virNetDevBandwidthPtr def,
                              virBufferPtr buf);

-void virDomainClearNetBandwidth(virDomainObjPtr vm)
-    ATTRIBUTE_NONNULL(1);
+void virDomainClearNetBandwidth(virDomainObjPtr vm);

 static inline bool virNetDevSupportBandwidth(virDomainNetType type)
 {
diff --git a/src/conf/network_event.h b/src/conf/network_event.h
index 51bd949beeae..8a23070318b7 100644
--- a/src/conf/network_event.h
+++ b/src/conf/network_event.h
@@ -36,9 +36,7 @@ virNetworkEventStateRegisterID(virConnectPtr conn,
                                virConnectNetworkEventGenericCallback cb,
                                void *opaque,
                                virFreeCallback freecb,
-                               int *callbackID)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5)
-    ATTRIBUTE_NONNULL(8);
+                               int *callbackID);

 int
 virNetworkEventStateRegisterClient(virConnectPtr conn,
@@ -48,9 +46,7 @@ virNetworkEventStateRegisterClient(virConnectPtr conn,
                                    virConnectNetworkEventGenericCallback cb,
                                    void *opaque,
                                    virFreeCallback freecb,
-                                   int *callbackID)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5)
-    ATTRIBUTE_NONNULL(8);
+                                   int *callbackID);

 virObjectEventPtr
 virNetworkEventLifecycleNew(const char *name,
diff --git a/src/conf/node_device_event.h b/src/conf/node_device_event.h
index 5a32d33abe5c..440a388b623a 100644
--- a/src/conf/node_device_event.h
+++ b/src/conf/node_device_event.h
@@ -35,9 +35,7 @@ virNodeDeviceEventStateRegisterID(virConnectPtr conn,
                                   virConnectNodeDeviceEventGenericCallback cb,
                                   void *opaque,
                                   virFreeCallback freecb,
-                                  int *callbackID)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5)
-    ATTRIBUTE_NONNULL(8);
+                                  int *callbackID);

 int
 virNodeDeviceEventStateRegisterClient(virConnectPtr conn,
@@ -47,9 +45,7 @@ virNodeDeviceEventStateRegisterClient(virConnectPtr conn,
                                       virConnectNodeDeviceEventGenericCallback cb,
                                       void *opaque,
                                       virFreeCallback freecb,
-                                      int *callbackID)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5)
-    ATTRIBUTE_NONNULL(8);
+                                      int *callbackID);

 virObjectEventPtr
 virNodeDeviceEventLifecycleNew(const char *name,
diff --git a/src/conf/numa_conf.h b/src/conf/numa_conf.h
index b6a535403d33..6fcfc2dad6d9 100644
--- a/src/conf/numa_conf.h
+++ b/src/conf/numa_conf.h
@@ -63,11 +63,9 @@ void virDomainNumaFree(virDomainNumaPtr numa);
  */
 int virDomainNumatuneParseXML(virDomainNumaPtr numa,
                               bool placement_static,
-                              xmlXPathContextPtr ctxt)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
+                              xmlXPathContextPtr ctxt);

-int virDomainNumatuneFormatXML(virBufferPtr buf, virDomainNumaPtr numatune)
-    ATTRIBUTE_NONNULL(1);
+int virDomainNumatuneFormatXML(virBufferPtr buf, virDomainNumaPtr numatune);

 /*
  * Getters
@@ -88,16 +86,12 @@ int virDomainNumatuneMaybeGetNodeset(virDomainNumaPtr numatune,
 size_t virDomainNumaGetNodeCount(virDomainNumaPtr numa);

 virBitmapPtr virDomainNumaGetNodeCpumask(virDomainNumaPtr numa,
-                                         size_t node)
-    ATTRIBUTE_NONNULL(1);
+                                         size_t node);
 virDomainMemoryAccess virDomainNumaGetNodeMemoryAccessMode(virDomainNumaPtr numa,
-                                                      size_t node)
-    ATTRIBUTE_NONNULL(1);
+                                                      size_t node);
 unsigned long long virDomainNumaGetNodeMemorySize(virDomainNumaPtr numa,
-                                                  size_t node)
-    ATTRIBUTE_NONNULL(1);
-unsigned long long virDomainNumaGetMemorySize(virDomainNumaPtr numa)
-    ATTRIBUTE_NONNULL(1);
+                                                  size_t node);
+unsigned long long virDomainNumaGetMemorySize(virDomainNumaPtr numa);

 unsigned int
 virDomainNumaGetMaxCPUID(virDomainNumaPtr numa);
@@ -121,13 +115,11 @@ int virDomainNumatuneSet(virDomainNumaPtr numa,
                          bool placement_static,
                          int placement,
                          int mode,
-                         virBitmapPtr nodeset)
-    ATTRIBUTE_NONNULL(1);
+                         virBitmapPtr nodeset);

 void virDomainNumaSetNodeMemorySize(virDomainNumaPtr numa,
                                     size_t node,
-                                    unsigned long long size)
-    ATTRIBUTE_NONNULL(1);
+                                    unsigned long long size);

 /*
  * Other accessors
diff --git a/src/conf/object_event.c b/src/conf/object_event.c
index e5f942f0cca9..eaba3ad2eb6f 100644
--- a/src/conf/object_event.c
+++ b/src/conf/object_event.c
@@ -335,7 +335,7 @@ virObjectEventCallbackListPurgeMarked(virObjectEventCallbackListPtr cbList)
  *
  * Return the id if found, or -1 with no error issued if not present.
  */
-static int ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
+static int
 virObjectEventCallbackLookup(virConnectPtr conn,
                              virObjectEventCallbackListPtr cbList,
                              const char *key,
diff --git a/src/conf/object_event.h b/src/conf/object_event.h
index 7a9995e122e7..f16a89bb51a7 100644
--- a/src/conf/object_event.h
+++ b/src/conf/object_event.h
@@ -61,33 +61,28 @@ typedef void (*virConnectObjectEventGenericCallback)(virConnectPtr conn,

 void
 virObjectEventStateQueue(virObjectEventStatePtr state,
-                         virObjectEventPtr event)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                         virObjectEventPtr event);

 void
 virObjectEventStateQueueRemote(virObjectEventStatePtr state,
                                virObjectEventPtr event,
-                               int remoteID)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                               int remoteID);

 int
 virObjectEventStateDeregisterID(virConnectPtr conn,
                                 virObjectEventStatePtr state,
-                                int callbackID)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                                int callbackID);

 int
 virObjectEventStateEventID(virConnectPtr conn,
                            virObjectEventStatePtr state,
                            int callbackID,
-                           int *remoteID)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                           int *remoteID);

 void
 virObjectEventStateSetRemote(virConnectPtr conn,
                              virObjectEventStatePtr state,
                              int callbackID,
-                             int remoteID)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                             int remoteID);

 #endif
diff --git a/src/conf/object_event_private.h b/src/conf/object_event_private.h
index 27b461f17785..bc03f9c53c1b 100644
--- a/src/conf/object_event_private.h
+++ b/src/conf/object_event_private.h
@@ -83,9 +83,7 @@ virObjectEventStateRegisterID(virConnectPtr conn,
                               virFreeCallback freecb,
                               bool legacy,
                               int *callbackID,
-                              bool remoteFilter)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(6)
-    ATTRIBUTE_NONNULL(8) ATTRIBUTE_NONNULL(12);
+                              bool remoteFilter);

 int
 virObjectEventStateCallbackID(virConnectPtr conn,
@@ -93,9 +91,7 @@ virObjectEventStateCallbackID(virConnectPtr conn,
                               virClassPtr klass,
                               int eventID,
                               virConnectObjectEventGenericCallback callback,
-                              int *remoteID)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
-    ATTRIBUTE_NONNULL(5);
+                              int *remoteID);

 void *
 virObjectEventNew(virClassPtr klass,
@@ -104,8 +100,6 @@ virObjectEventNew(virClassPtr klass,
                   int id,
                   const char *name,
                   const unsigned char *uuid,
-                  const char *key)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5)
-    ATTRIBUTE_NONNULL(7);
+                  const char *key);

 #endif
diff --git a/src/conf/secret_event.h b/src/conf/secret_event.h
index 5fd52f3fd3d2..c7deec1073f6 100644
--- a/src/conf/secret_event.h
+++ b/src/conf/secret_event.h
@@ -35,9 +35,7 @@ virSecretEventStateRegisterID(virConnectPtr conn,
                               virConnectSecretEventGenericCallback cb,
                               void *opaque,
                               virFreeCallback freecb,
-                              int *callbackID)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5)
-    ATTRIBUTE_NONNULL(8);
+                              int *callbackID);

 int
 virSecretEventStateRegisterClient(virConnectPtr conn,
@@ -47,9 +45,7 @@ virSecretEventStateRegisterClient(virConnectPtr conn,
                                   virConnectSecretEventGenericCallback cb,
                                   void *opaque,
                                   virFreeCallback freecb,
-                                  int *callbackID)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5)
-    ATTRIBUTE_NONNULL(8);
+                                  int *callbackID);

 virObjectEventPtr
 virSecretEventLifecycleNew(const unsigned char *uuid,
diff --git a/src/conf/storage_event.h b/src/conf/storage_event.h
index ea726911fa33..f1f7d58c11bc 100644
--- a/src/conf/storage_event.h
+++ b/src/conf/storage_event.h
@@ -35,9 +35,7 @@ virStoragePoolEventStateRegisterID(virConnectPtr conn,
                                    virConnectStoragePoolEventGenericCallback cb,
                                    void *opaque,
                                    virFreeCallback freecb,
-                                   int *callbackID)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5)
-    ATTRIBUTE_NONNULL(8);
+                                   int *callbackID);

 int
 virStoragePoolEventStateRegisterClient(virConnectPtr conn,
@@ -47,9 +45,7 @@ virStoragePoolEventStateRegisterClient(virConnectPtr conn,
                                    virConnectStoragePoolEventGenericCallback cb,
                                    void *opaque,
                                    virFreeCallback freecb,
-                                   int *callbackID)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5)
-    ATTRIBUTE_NONNULL(8);
+                                   int *callbackID);

 virObjectEventPtr
 virStoragePoolEventLifecycleNew(const char *name,
diff --git a/src/conf/virnodedeviceobj.h b/src/conf/virnodedeviceobj.h
index e32bbf8fb5fe..326e57b6a9f0 100644
--- a/src/conf/virnodedeviceobj.h
+++ b/src/conf/virnodedeviceobj.h
@@ -50,8 +50,7 @@ virNodeDeviceObjFindByName(virNodeDeviceObjListPtr devs,

 virNodeDeviceObjPtr
 virNodeDeviceObjFindBySysfsPath(virNodeDeviceObjListPtr devs,
-                                const char *sysfs_path)
-    ATTRIBUTE_NONNULL(2);
+                                const char *sysfs_path);

 virNodeDeviceObjPtr
 virNodeDeviceObjAssignDef(virNodeDeviceObjListPtr devs,
diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h
index 8c238ad553d4..2ceac118b36d 100644
--- a/src/cpu/cpu.h
+++ b/src/cpu/cpu.h
@@ -151,16 +151,14 @@ virCPUCompareResult
 virCPUCompare(virArch arch,
               virCPUDefPtr host,
               virCPUDefPtr cpu,
-              bool failIncompatible)
-    ATTRIBUTE_NONNULL(3);
+              bool failIncompatible);

 int
 cpuDecode   (virCPUDefPtr cpu,
              const virCPUData *data,
              const char **models,
              unsigned int nmodels,
-             const char *preferred)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+             const char *preferred);

 int
 cpuEncode   (virArch arch,
@@ -170,8 +168,7 @@ cpuEncode   (virArch arch,
              virCPUDataPtr *optional,
              virCPUDataPtr *disabled,
              virCPUDataPtr *forbidden,
-             virCPUDataPtr *vendor)
-    ATTRIBUTE_NONNULL(2);
+             virCPUDataPtr *vendor);

 virCPUDataPtr
 virCPUDataNew(virArch arch);
@@ -206,34 +203,29 @@ cpuBaseline (virCPUDefPtr *cpus,
 int
 virCPUUpdate(virArch arch,
              virCPUDefPtr guest,
-             const virCPUDef *host)
-    ATTRIBUTE_NONNULL(2);
+             const virCPUDef *host);

 int
 virCPUUpdateLive(virArch arch,
                  virCPUDefPtr cpu,
                  virCPUDataPtr dataEnabled,
-                 virCPUDataPtr dataDisabled)
-    ATTRIBUTE_NONNULL(2);
+                 virCPUDataPtr dataDisabled);

 int
 virCPUCheckFeature(virArch arch,
                    const virCPUDef *cpu,
-                   const char *feature)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                   const char *feature);


 int
 virCPUDataCheckFeature(const virCPUData *data,
-                       const char *feature)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                       const char *feature);


 bool
 virCPUModelIsAllowed(const char *model,
                      const char **models,
-                     unsigned int nmodels)
-    ATTRIBUTE_NONNULL(1);
+                     unsigned int nmodels);

 int
 virCPUGetModels(virArch arch, char ***models);
@@ -242,13 +234,11 @@ int
 virCPUTranslate(virArch arch,
                 virCPUDefPtr cpu,
                 const char **models,
-                unsigned int nmodels)
-    ATTRIBUTE_NONNULL(2);
+                unsigned int nmodels);

 int
 virCPUConvertLegacy(virArch arch,
-                    virCPUDefPtr cpu)
-    ATTRIBUTE_NONNULL(2);
+                    virCPUDefPtr cpu);

 int
 virCPUExpandFeatures(virArch arch,
@@ -257,9 +247,7 @@ virCPUExpandFeatures(virArch arch,
 /* virCPUDataFormat and virCPUDataParse are implemented for unit tests only and
  * have no real-life usage
  */
-char *virCPUDataFormat(const virCPUData *data)
-    ATTRIBUTE_NONNULL(1);
-virCPUDataPtr virCPUDataParse(const char *xmlStr)
-    ATTRIBUTE_NONNULL(1);
+char *virCPUDataFormat(const virCPUData *data);
+virCPUDataPtr virCPUDataParse(const char *xmlStr);

 #endif /* __VIR_CPU_H__ */
diff --git a/src/interface/interface_backend_netcf.c b/src/interface/interface_backend_netcf.c
index 700a8a075c39..960eff2d4973 100644
--- a/src/interface/interface_backend_netcf.c
+++ b/src/interface/interface_backend_netcf.c
@@ -153,7 +153,7 @@ netcfStateReload(void)
  * for access control checks to be performed. Currently
  * this implies existence of name and mac address attributes
  */
-static virInterfaceDef * ATTRIBUTE_NONNULL(1)
+static virInterfaceDef *
 netcfGetMinimalDefForDevice(struct netcf_if *iface)
 {
     virInterfaceDef *def;
diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c
index 18a45fa85479..f4397d1fd25f 100644
--- a/src/interface/interface_backend_udev.c
+++ b/src/interface/interface_backend_udev.c
@@ -73,7 +73,7 @@ virUdevStatusString(virUdevStatus status)
  * for access control checks to be performed. Currently
  * this implies existence of name and mac address attributes
  */
-static virInterfaceDef * ATTRIBUTE_NONNULL(1)
+static virInterfaceDef *
 udevGetMinimalDefForDevice(struct udev_device *dev)
 {
     virInterfaceDef *def;
@@ -96,7 +96,7 @@ udevGetMinimalDefForDevice(struct udev_device *dev)
 }


-static struct udev_enumerate * ATTRIBUTE_NONNULL(1)
+static struct udev_enumerate *
 udevGetDevices(struct udev *udev, virUdevStatus status)
 {
     struct udev_enumerate *enumerate;
@@ -579,9 +579,7 @@ udevBridgeScanDirFilter(const struct dirent *entry)
 }


-static int
-ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
-ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK
+static int ATTRIBUTE_RETURN_CHECK
 udevGetIfaceDefBond(struct udev *udev,
                     struct udev_device *dev,
                     const char *name,
@@ -804,9 +802,7 @@ udevGetIfaceDefBond(struct udev *udev,
     return -1;
 }

-static int
-ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
-ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK
+static int ATTRIBUTE_RETURN_CHECK
 udevGetIfaceDefBridge(struct udev *udev,
                       struct udev_device *dev,
                       const char *name,
@@ -910,9 +906,7 @@ udevGetIfaceDefBridge(struct udev *udev,
     return -1;
 }

-static int
-ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
-ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK
+static int ATTRIBUTE_RETURN_CHECK
 udevGetIfaceDefVlan(struct udev *udev ATTRIBUTE_UNUSED,
                     struct udev_device *dev ATTRIBUTE_UNUSED,
                     const char *name,
@@ -978,7 +972,7 @@ udevGetIfaceDefVlan(struct udev *udev ATTRIBUTE_UNUSED,
     return ret;
 }

-static virInterfaceDef * ATTRIBUTE_NONNULL(1)
+static virInterfaceDef *
 udevGetIfaceDef(struct udev *udev, const char *name)
 {
     struct udev_device *dev = NULL;
diff --git a/src/internal.h b/src/internal.h
index d64be93b348a..6d2a6f9c0a68 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -197,27 +197,6 @@
 #   endif
 #  endif

-/* gcc's handling of attribute nonnull is less than stellar - it does
- * NOT improve diagnostics, and merely allows gcc to optimize away
- * null code checks even when the caller manages to pass null in spite
- * of the attribute, leading to weird crashes.  Coverity, on the other
- * hand, knows how to do better static analysis based on knowing
- * whether a parameter is nonnull.  Make this attribute conditional
- * based on whether we are compiling for real or for analysis, while
- * still requiring correct gcc syntax when it is turned off.  See also
- * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17308 */
-#  ifndef ATTRIBUTE_NONNULL
-#   if __GNUC_PREREQ (3, 3)
-#    if STATIC_ANALYSIS
-#     define ATTRIBUTE_NONNULL(m) __attribute__((__nonnull__(m)))
-#    else
-#     define ATTRIBUTE_NONNULL(m) __attribute__(())
-#    endif
-#   else
-#    define ATTRIBUTE_NONNULL(m)
-#   endif
-#  endif
-
 #  ifndef ATTRIBUTE_FALLTHROUGH
 #   if __GNUC_PREREQ (7, 0)
 #    define ATTRIBUTE_FALLTHROUGH __attribute__((fallthrough))
diff --git a/src/libxl/libxl_domain.h b/src/libxl/libxl_domain.h
index 3a3890b732e3..73e16253a30e 100644
--- a/src/libxl/libxl_domain.h
+++ b/src/libxl/libxl_domain.h
@@ -108,8 +108,7 @@ libxlDomainSaveImageOpen(libxlDriverPrivatePtr driver,
                          libxlDriverConfigPtr cfg,
                          const char *from,
                          virDomainDefPtr *ret_def,
-                         libxlSavefileHeaderPtr ret_hdr)
-    ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5);
+                         libxlSavefileHeaderPtr ret_hdr);

 int
 libxlDomainDestroyInternal(libxlDriverPrivatePtr driver,
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 3270dc50074e..fb4c92a5c3e7 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -1494,7 +1494,7 @@ networkDnsmasqConfContents(virNetworkObjPtr network,
 }

 /* build the dnsmasq command line */
-static int ATTRIBUTE_NONNULL(3)
+static int
 networkBuildDhcpDaemonCommandLine(virNetworkDriverStatePtr driver,
                                   virNetworkObjPtr network,
                                   virCommandPtr *cmdout,
diff --git a/src/network/bridge_driver.h b/src/network/bridge_driver.h
index c696f0301ff7..bd45d9e0ae7d 100644
--- a/src/network/bridge_driver.h
+++ b/src/network/bridge_driver.h
@@ -35,20 +35,15 @@ int networkRegister(void);

 # if WITH_NETWORK
 int networkAllocateActualDevice(virDomainDefPtr dom,
-                                virDomainNetDefPtr iface)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                                virDomainNetDefPtr iface);
 int networkNotifyActualDevice(virDomainDefPtr dom,
-                              virDomainNetDefPtr iface)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                              virDomainNetDefPtr iface);
 int networkReleaseActualDevice(virDomainDefPtr dom,
-                               virDomainNetDefPtr iface)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                               virDomainNetDefPtr iface);

-int networkGetNetworkAddress(const char *netname, char **netaddr)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+int networkGetNetworkAddress(const char *netname, char **netaddr);

-int networkGetActualType(virDomainNetDefPtr iface)
-    ATTRIBUTE_NONNULL(1);
+int networkGetActualType(virDomainNetDefPtr iface);

 int networkDnsmasqConfContents(virNetworkObjPtr network,
                         const char *pidfile,
@@ -57,12 +52,10 @@ int networkDnsmasqConfContents(virNetworkObjPtr network,
                         dnsmasqCapsPtr caps);

 bool networkBandwidthChangeAllowed(virDomainNetDefPtr iface,
-                                   virNetDevBandwidthPtr newBandwidth)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                                   virNetDevBandwidthPtr newBandwidth);

 int networkBandwidthUpdate(virDomainNetDefPtr iface,
-                           virNetDevBandwidthPtr newBandwidth)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                           virNetDevBandwidthPtr newBandwidth);

 # else
 /* Define no-op replacements that don't drag in any link dependencies.  */
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 1803aa53b744..a8d24b699c92 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -140,9 +140,6 @@ waitsocket(int socket_fd, LIBSSH2_SESSION * session)

 /* this function is the layer that manipulates the ssh channel itself
  * and executes the commands on the remote machine */
-static char *phypExec(LIBSSH2_SESSION *, const char *, int *, virConnectPtr)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
-    ATTRIBUTE_NONNULL(4);
 static char *
 phypExec(LIBSSH2_SESSION *session, const char *cmd, int *exit_status,
          virConnectPtr conn)
@@ -240,9 +237,6 @@ phypExec(LIBSSH2_SESSION *session, const char *cmd, int *exit_status,
 }

 /* Convenience wrapper function */
-static char *phypExecBuffer(LIBSSH2_SESSION *, virBufferPtr buf, int *,
-                            virConnectPtr, bool) ATTRIBUTE_NONNULL(1)
-    ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
 static char *
 phypExecBuffer(LIBSSH2_SESSION *session, virBufferPtr buf, int *exit_status,
                virConnectPtr conn, bool strip_newline)
@@ -264,8 +258,6 @@ phypExecBuffer(LIBSSH2_SESSION *session, virBufferPtr buf, int *exit_status,
 }

 /* Convenience wrapper function */
-static int phypExecInt(LIBSSH2_SESSION *, virBufferPtr, virConnectPtr, int *)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
 static int
 phypExecInt(LIBSSH2_SESSION *session, virBufferPtr buf, virConnectPtr conn,
             int *result)
diff --git a/src/qemu/qemu_alias.h b/src/qemu/qemu_alias.h
index 300fd4de5658..26364ebce387 100644
--- a/src/qemu/qemu_alias.h
+++ b/src/qemu/qemu_alias.h
@@ -81,10 +81,8 @@ char *qemuDomainGetMasterKeyAlias(void);
 char *qemuDomainGetSecretAESAlias(const char *srcalias,
                                   bool isLuks);

-char *qemuAliasTLSObjFromSrcAlias(const char *srcAlias)
-    ATTRIBUTE_NONNULL(1);
+char *qemuAliasTLSObjFromSrcAlias(const char *srcAlias);

-char *qemuAliasChardevFromDevAlias(const char *devAlias)
-    ATTRIBUTE_NONNULL(1);
+char *qemuAliasChardevFromDevAlias(const char *devAlias);

 #endif /* __QEMU_ALIAS_H__*/
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index f51141b99062..c54075689201 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -5052,7 +5052,7 @@ virQEMUCapsCacheNew(const char *libDir,
 }


-static void ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
+static void
 virQEMUCapsCacheValidate(virQEMUCapsCachePtr cache,
                          const char *binary,
                          virCapsPtr caps,
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index d44682f2ad09..c8e4dc47ec68 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -414,12 +414,12 @@ typedef virQEMUCapsCache *virQEMUCapsCachePtr;
 virQEMUCapsPtr virQEMUCapsNew(void);

 void virQEMUCapsSet(virQEMUCapsPtr qemuCaps,
-                    virQEMUCapsFlags flag) ATTRIBUTE_NONNULL(1);
+                    virQEMUCapsFlags flag);

-void virQEMUCapsSetList(virQEMUCapsPtr qemuCaps, ...) ATTRIBUTE_NONNULL(1);
+void virQEMUCapsSetList(virQEMUCapsPtr qemuCaps, ...);

 void virQEMUCapsClear(virQEMUCapsPtr qemuCaps,
-                      virQEMUCapsFlags flag) ATTRIBUTE_NONNULL(1);
+                      virQEMUCapsFlags flag);

 bool virQEMUCapsGet(virQEMUCapsPtr qemuCaps,
                     virQEMUCapsFlags flag);
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index 7da92c8c98f5..195f419b3f41 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -57,8 +57,7 @@ virCommandPtr qemuBuildCommandLine(virQEMUDriverPtr driver,
                                    virBitmapPtr nodeset,
                                    size_t *nnicindexes,
                                    int **nicindexes,
-                                   const char *domainLibDir)
-    ATTRIBUTE_NONNULL(15);
+                                   const char *domainLibDir);


 /* Generate the object properties for a secret */
@@ -193,16 +192,13 @@ bool qemuCheckCCWS390AddressSupport(const virDomainDef *def,
                                     virQEMUCapsPtr qemuCaps,
                                     const char *devicename);

-virJSONValuePtr qemuBuildHotpluggableCPUProps(const virDomainVcpuDef *vcpu)
-    ATTRIBUTE_NONNULL(1);
+virJSONValuePtr qemuBuildHotpluggableCPUProps(const virDomainVcpuDef *vcpu);

-virJSONValuePtr qemuBuildShmemBackendMemProps(virDomainShmemDefPtr shmem)
-    ATTRIBUTE_NONNULL(1);
+virJSONValuePtr qemuBuildShmemBackendMemProps(virDomainShmemDefPtr shmem);

 char *qemuBuildShmemDevStr(virDomainDefPtr def,
                            virDomainShmemDefPtr shmem,
-                           virQEMUCapsPtr qemuCaps)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                           virQEMUCapsPtr qemuCaps);



diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index 1407eef4d4f0..455f4244c15a 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -313,28 +313,23 @@ typedef qemuSharedDeviceEntry *qemuSharedDeviceEntryPtr;

 bool qemuSharedDeviceEntryDomainExists(qemuSharedDeviceEntryPtr entry,
                                        const char *name,
-                                       int *idx)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                                       int *idx);

-char *qemuGetSharedDeviceKey(const char *disk_path)
-    ATTRIBUTE_NONNULL(1);
+char *qemuGetSharedDeviceKey(const char *disk_path);

 void qemuSharedDeviceEntryFree(void *payload, const void *name);

 int qemuAddSharedDevice(virQEMUDriverPtr driver,
                         virDomainDeviceDefPtr dev,
-                        const char *name)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                        const char *name);

 int qemuRemoveSharedDevice(virQEMUDriverPtr driver,
                            virDomainDeviceDefPtr dev,
-                           const char *name)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                           const char *name);

 int qemuRemoveSharedDisk(virQEMUDriverPtr driver,
                          virDomainDiskDefPtr disk,
-                         const char *name)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                         const char *name);

 int qemuSetUnprivSGIO(virDomainDeviceDefPtr dev);

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 458bb5f9a431..3c3ae1696af3 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3475,7 +3475,7 @@ qemuDomainJobAllowed(qemuDomainObjPrivatePtr priv, qemuDomainJob job)
 /*
  * obj must be locked before calling
  */
-static int ATTRIBUTE_NONNULL(1)
+static int
 qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver,
                               virDomainObjPtr obj,
                               qemuDomainJob job,
@@ -3774,7 +3774,7 @@ qemuDomainObjEnterMonitorInternal(virQEMUDriverPtr driver,
     return 0;
 }

-static void ATTRIBUTE_NONNULL(1)
+static void
 qemuDomainObjExitMonitorInternal(virQEMUDriverPtr driver,
                                  virDomainObjPtr obj)
 {
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 91573ff06338..861dba6a0dd6 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -456,31 +456,24 @@ void qemuDomainObjDiscardAsyncJob(virQEMUDriverPtr driver,
                                   virDomainObjPtr obj);
 void qemuDomainObjReleaseAsyncJob(virDomainObjPtr obj);

-qemuMonitorPtr qemuDomainGetMonitor(virDomainObjPtr vm)
-    ATTRIBUTE_NONNULL(1);
+qemuMonitorPtr qemuDomainGetMonitor(virDomainObjPtr vm);
 void qemuDomainObjEnterMonitor(virQEMUDriverPtr driver,
-                               virDomainObjPtr obj)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                               virDomainObjPtr obj);
 int qemuDomainObjExitMonitor(virQEMUDriverPtr driver,
                              virDomainObjPtr obj)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
     ATTRIBUTE_RETURN_CHECK;
 int qemuDomainObjEnterMonitorAsync(virQEMUDriverPtr driver,
                                    virDomainObjPtr obj,
                                    qemuDomainAsyncJob asyncJob)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;


-qemuAgentPtr qemuDomainObjEnterAgent(virDomainObjPtr obj)
-    ATTRIBUTE_NONNULL(1);
-void qemuDomainObjExitAgent(virDomainObjPtr obj, qemuAgentPtr agent)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+qemuAgentPtr qemuDomainObjEnterAgent(virDomainObjPtr obj);
+void qemuDomainObjExitAgent(virDomainObjPtr obj, qemuAgentPtr agent);


-void qemuDomainObjEnterRemote(virDomainObjPtr obj)
-    ATTRIBUTE_NONNULL(1);
-void qemuDomainObjExitRemote(virDomainObjPtr obj)
-    ATTRIBUTE_NONNULL(1);
+void qemuDomainObjEnterRemote(virDomainObjPtr obj);
+void qemuDomainObjExitRemote(virDomainObjPtr obj);

 virDomainDefPtr qemuDomainDefCopy(virQEMUDriverPtr driver,
                                   virDomainDefPtr src,
@@ -651,25 +644,18 @@ bool qemuDomainDefCheckABIStability(virQEMUDriverPtr driver,
 bool qemuDomainAgentAvailable(virDomainObjPtr vm,
                               bool reportError);

-int qemuDomainJobInfoUpdateTime(qemuDomainJobInfoPtr jobInfo)
-    ATTRIBUTE_NONNULL(1);
-int qemuDomainJobInfoUpdateDowntime(qemuDomainJobInfoPtr jobInfo)
-    ATTRIBUTE_NONNULL(1);
+int qemuDomainJobInfoUpdateTime(qemuDomainJobInfoPtr jobInfo);
+int qemuDomainJobInfoUpdateDowntime(qemuDomainJobInfoPtr jobInfo);
 int qemuDomainJobInfoToInfo(qemuDomainJobInfoPtr jobInfo,
-                            virDomainJobInfoPtr info)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                            virDomainJobInfoPtr info);
 int qemuDomainJobInfoToParams(qemuDomainJobInfoPtr jobInfo,
                               int *type,
                               virTypedParameterPtr *params,
-                              int *nparams)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
-    ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
+                              int *nparams);

-int qemuDomainSupportsBlockJobs(virDomainObjPtr vm, bool *modern)
-    ATTRIBUTE_NONNULL(1);
+int qemuDomainSupportsBlockJobs(virDomainObjPtr vm, bool *modern);
 bool qemuDomainDiskBlockJobIsActive(virDomainDiskDefPtr disk);
-bool qemuDomainHasBlockjob(virDomainObjPtr vm, bool copy_only)
-    ATTRIBUTE_NONNULL(1);
+bool qemuDomainHasBlockjob(virDomainObjPtr vm, bool copy_only);

 int qemuDomainAlignMemorySizes(virDomainDefPtr def);
 void qemuDomainMemoryDeviceAlignSize(virDomainDefPtr def,
@@ -739,17 +725,13 @@ int qemuDomainMasterKeyCreate(virDomainObjPtr vm);

 void qemuDomainMasterKeyRemove(qemuDomainObjPrivatePtr priv);

-void qemuDomainSecretInfoFree(qemuDomainSecretInfoPtr *secinfo)
-    ATTRIBUTE_NONNULL(1);
+void qemuDomainSecretInfoFree(qemuDomainSecretInfoPtr *secinfo);

-void qemuDomainSecretDiskDestroy(virDomainDiskDefPtr disk)
-    ATTRIBUTE_NONNULL(1);
+void qemuDomainSecretDiskDestroy(virDomainDiskDefPtr disk);

-bool qemuDomainSecretDiskCapable(virStorageSourcePtr src)
-    ATTRIBUTE_NONNULL(1);
+bool qemuDomainSecretDiskCapable(virStorageSourcePtr src);

-bool qemuDomainDiskHasEncryptionSecret(virStorageSourcePtr src)
-    ATTRIBUTE_NONNULL(1);
+bool qemuDomainDiskHasEncryptionSecret(virStorageSourcePtr src);

 qemuDomainSecretInfoPtr
 qemuDomainSecretInfoTLSNew(virConnectPtr conn,
@@ -759,59 +741,44 @@ qemuDomainSecretInfoTLSNew(virConnectPtr conn,

 int qemuDomainSecretDiskPrepare(virConnectPtr conn,
                                 qemuDomainObjPrivatePtr priv,
-                                virDomainDiskDefPtr disk)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                                virDomainDiskDefPtr disk);

-void qemuDomainSecretHostdevDestroy(virDomainHostdevDefPtr disk)
-    ATTRIBUTE_NONNULL(1);
+void qemuDomainSecretHostdevDestroy(virDomainHostdevDefPtr disk);

 int qemuDomainSecretHostdevPrepare(virConnectPtr conn,
                                    qemuDomainObjPrivatePtr priv,
-                                   virDomainHostdevDefPtr hostdev)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                                   virDomainHostdevDefPtr hostdev);

-void qemuDomainSecretChardevDestroy(virDomainChrSourceDefPtr dev)
-    ATTRIBUTE_NONNULL(1);
+void qemuDomainSecretChardevDestroy(virDomainChrSourceDefPtr dev);

 int qemuDomainSecretChardevPrepare(virConnectPtr conn,
                                    virQEMUDriverConfigPtr cfg,
                                    qemuDomainObjPrivatePtr priv,
                                    const char *chrAlias,
-                                   virDomainChrSourceDefPtr dev)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
-    ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5);
+                                   virDomainChrSourceDefPtr dev);

-void qemuDomainSecretDestroy(virDomainObjPtr vm)
-    ATTRIBUTE_NONNULL(1);
+void qemuDomainSecretDestroy(virDomainObjPtr vm);

 int qemuDomainSecretPrepare(virConnectPtr conn,
                             virQEMUDriverPtr driver,
-                            virDomainObjPtr vm)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                            virDomainObjPtr vm);

-int qemuDomainDefValidateDiskLunSource(const virStorageSource *src)
-    ATTRIBUTE_NONNULL(1);
+int qemuDomainDefValidateDiskLunSource(const virStorageSource *src);

 int qemuDomainPrepareChannel(virDomainChrDefPtr chr,
-                             const char *domainChannelTargetDir)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                             const char *domainChannelTargetDir);

 void qemuDomainPrepareChardevSourceTLS(virDomainChrSourceDefPtr source,
-                                       virQEMUDriverConfigPtr cfg)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                                       virQEMUDriverConfigPtr cfg);

 void qemuDomainPrepareChardevSource(virDomainDefPtr def,
-                                    virQEMUDriverPtr driver)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                                    virQEMUDriverPtr driver);

-int qemuDomainPrepareShmemChardev(virDomainShmemDefPtr shmem)
-    ATTRIBUTE_NONNULL(1);
+int qemuDomainPrepareShmemChardev(virDomainShmemDefPtr shmem);

-bool qemuDomainVcpuHotplugIsInOrder(virDomainDefPtr def)
-    ATTRIBUTE_NONNULL(1);
+bool qemuDomainVcpuHotplugIsInOrder(virDomainDefPtr def);

-void qemuDomainVcpuPersistOrder(virDomainDefPtr def)
-    ATTRIBUTE_NONNULL(1);
+void qemuDomainVcpuPersistOrder(virDomainDefPtr def);

 int qemuDomainCheckMonitor(virQEMUDriverPtr driver,
                            virDomainObjPtr vm,
diff --git a/src/qemu/qemu_domain_address.h b/src/qemu/qemu_domain_address.h
index 067f4e799703..4a98c2c4bf8d 100644
--- a/src/qemu/qemu_domain_address.h
+++ b/src/qemu/qemu_domain_address.h
@@ -36,21 +36,18 @@ int qemuDomainAssignAddresses(virDomainDefPtr def,
                               virQEMUCapsPtr qemuCaps,
                               virQEMUDriverPtr driver,
                               virDomainObjPtr obj,
-                              bool newDomain)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                              bool newDomain);

 int qemuDomainEnsurePCIAddress(virDomainObjPtr obj,
                                virDomainDeviceDefPtr dev,
-                               virQEMUDriverPtr driver)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                               virQEMUDriverPtr driver);

 void qemuDomainReleaseDeviceAddress(virDomainObjPtr vm,
                                     virDomainDeviceInfoPtr info,
                                     const char *devstr);

 virDomainCCWAddressSetPtr
-qemuDomainCCWAddrSetCreateFromDomain(virDomainDefPtr def)
-    ATTRIBUTE_NONNULL(1);
+qemuDomainCCWAddrSetCreateFromDomain(virDomainDefPtr def);

 int qemuDomainAssignMemoryDeviceSlot(virDomainDefPtr def,
                                      virDomainMemoryDefPtr mem);
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d5fc00eba231..9ad3019172a9 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3269,7 +3269,7 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom,
  *                           no there was an error, then just return RAW
  *                           indicating none.
  */
-static int ATTRIBUTE_NONNULL(2)
+static int
 qemuGetCompressionProgram(const char *imageFormat,
                           char **compresspath,
                           const char *styleFormat,
@@ -6160,7 +6160,7 @@ qemuDomainSaveImageUpdateDef(virQEMUDriverPtr driver,
  * on success. On error returns -1 on most failures, -3 if corrupt image was
  * unlinked (no error raised).
  */
-static int ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4)
+static int
 qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
                         const char *path,
                         virDomainDefPtr *ret_def,
@@ -6287,7 +6287,7 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
     return -1;
 }

-static int ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5) ATTRIBUTE_NONNULL(6)
+static int
 qemuDomainSaveImageStartVM(virConnectPtr conn,
                            virQEMUDriverPtr driver,
                            virDomainObjPtr vm,
@@ -11732,7 +11732,7 @@ qemuDomainMigratePrepareTunnel(virConnectPtr dconn,
  *
  * This starts an empty VM listening on a TCP port.
  */
-static int ATTRIBUTE_NONNULL(5)
+static int
 qemuDomainMigratePrepare2(virConnectPtr dconn,
                           char **cookie ATTRIBUTE_UNUSED,
                           int *cookielen ATTRIBUTE_UNUSED,
diff --git a/src/qemu/qemu_interface.h b/src/qemu/qemu_interface.h
index ba74ac2cfe4b..24ac90fa4954 100644
--- a/src/qemu/qemu_interface.h
+++ b/src/qemu/qemu_interface.h
@@ -52,8 +52,7 @@ int qemuInterfaceBridgeConnect(virDomainDefPtr def,
                                virDomainNetDefPtr net,
                                int *tapfd,
                                size_t *tapfdSize,
-                               unsigned int *mtu)
-    ATTRIBUTE_NONNULL(2);
+                               unsigned int *mtu);

 int qemuInterfaceOpenVhostNet(virDomainDefPtr def,
                               virDomainNetDefPtr net,
diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h
index 5248f399de4a..6e9aad6c3366 100644
--- a/src/qemu/qemu_migration.h
+++ b/src/qemu/qemu_migration.h
@@ -135,22 +135,17 @@ qemuMigrationParams(virTypedParameterPtr params,
 int qemuMigrationJobStart(virQEMUDriverPtr driver,
                           virDomainObjPtr vm,
                           qemuDomainAsyncJob job)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 void qemuMigrationJobSetPhase(virQEMUDriverPtr driver,
                               virDomainObjPtr vm,
-                              qemuMigrationJobPhase phase)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                              qemuMigrationJobPhase phase);
 void qemuMigrationJobStartPhase(virQEMUDriverPtr driver,
                                 virDomainObjPtr vm,
-                                qemuMigrationJobPhase phase)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
-void qemuMigrationJobContinue(virDomainObjPtr obj)
-    ATTRIBUTE_NONNULL(1);
+                                qemuMigrationJobPhase phase);
+void qemuMigrationJobContinue(virDomainObjPtr obj);
 bool qemuMigrationJobIsActive(virDomainObjPtr vm,
-                              qemuDomainAsyncJob job)
-    ATTRIBUTE_NONNULL(1);
-void qemuMigrationJobFinish(virQEMUDriverPtr driver, virDomainObjPtr obj)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                              qemuDomainAsyncJob job);
+void qemuMigrationJobFinish(virQEMUDriverPtr driver, virDomainObjPtr obj);

 int qemuMigrationSetOffline(virQEMUDriverPtr driver,
                             virDomainObjPtr vm);
@@ -247,7 +242,7 @@ int qemuMigrationToFile(virQEMUDriverPtr driver,
                         int fd,
                         const char *compressor,
                         qemuDomainAsyncJob asyncJob)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int qemuMigrationCancel(virQEMUDriverPtr driver,
                         virDomainObjPtr vm);
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 87a1496cf78d..bdf2a70661ec 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -287,17 +287,14 @@ qemuMonitorPtr qemuMonitorOpen(virDomainObjPtr vm,
                                bool json,
                                unsigned long long timeout,
                                qemuMonitorCallbacksPtr cb,
-                               void *opaque)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5);
+                               void *opaque);
 qemuMonitorPtr qemuMonitorOpenFD(virDomainObjPtr vm,
                                  int sockfd,
                                  bool json,
                                  qemuMonitorCallbacksPtr cb,
-                                 void *opaque)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
+                                 void *opaque);

-void qemuMonitorUnregister(qemuMonitorPtr mon)
-    ATTRIBUTE_NONNULL(1);
+void qemuMonitorUnregister(qemuMonitorPtr mon);
 void qemuMonitorClose(qemuMonitorPtr mon);

 virErrorPtr qemuMonitorLastError(qemuMonitorPtr mon);
@@ -306,25 +303,20 @@ int qemuMonitorSetCapabilities(qemuMonitorPtr mon);

 int qemuMonitorSetLink(qemuMonitorPtr mon,
                        const char *name,
-                       virDomainNetInterfaceLinkState state)
-    ATTRIBUTE_NONNULL(2);
+                       virDomainNetInterfaceLinkState state);

 /* These APIs are for use by the internal Text/JSON monitor impl code only */
 char *qemuMonitorNextCommandID(qemuMonitorPtr mon);
 int qemuMonitorSend(qemuMonitorPtr mon,
                     qemuMonitorMessagePtr msg);
-virJSONValuePtr qemuMonitorGetOptions(qemuMonitorPtr mon)
-    ATTRIBUTE_NONNULL(1);
-void qemuMonitorSetOptions(qemuMonitorPtr mon, virJSONValuePtr options)
-    ATTRIBUTE_NONNULL(1);
+virJSONValuePtr qemuMonitorGetOptions(qemuMonitorPtr mon);
+void qemuMonitorSetOptions(qemuMonitorPtr mon, virJSONValuePtr options);
 int qemuMonitorUpdateVideoMemorySize(qemuMonitorPtr mon,
                                      virDomainVideoDefPtr video,
-                                     const char *videoName)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                                     const char *videoName);
 int qemuMonitorUpdateVideoVram64Size(qemuMonitorPtr mon,
                                      virDomainVideoDefPtr video,
-                                     const char *videoName)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                                     const char *videoName);
 int qemuMonitorHMPCommandWithFd(qemuMonitorPtr mon,
                                 const char *cmd,
                                 int scm_fd,
@@ -431,8 +423,7 @@ int qemuMonitorVMStatusToPausedReason(const char *status);
 int qemuMonitorCheck(qemuMonitorPtr mon);
 int qemuMonitorGetStatus(qemuMonitorPtr mon,
                          bool *running,
-                         virDomainPausedReason *reason)
-    ATTRIBUTE_NONNULL(2);
+                         virDomainPausedReason *reason);

 int qemuMonitorSystemReset(qemuMonitorPtr mon);
 int qemuMonitorSystemPowerdown(qemuMonitorPtr mon);
@@ -541,13 +532,11 @@ struct _qemuBlockStats {

 int qemuMonitorGetAllBlockStatsInfo(qemuMonitorPtr mon,
                                     virHashTablePtr *ret_stats,
-                                    bool backingChain)
-    ATTRIBUTE_NONNULL(2);
+                                    bool backingChain);

 int qemuMonitorBlockStatsUpdateCapacity(qemuMonitorPtr mon,
                                         virHashTablePtr stats,
-                                        bool backingChain)
-    ATTRIBUTE_NONNULL(2);
+                                        bool backingChain);

 int qemuMonitorBlockResize(qemuMonitorPtr mon,
                            const char *dev_name,
@@ -839,8 +828,7 @@ int qemuMonitorDiskSnapshot(qemuMonitorPtr mon,
                             const char *file,
                             const char *format,
                             bool reuse);
-int qemuMonitorTransaction(qemuMonitorPtr mon, virJSONValuePtr actions)
-    ATTRIBUTE_NONNULL(2);
+int qemuMonitorTransaction(qemuMonitorPtr mon, virJSONValuePtr actions);
 int qemuMonitorDriveMirror(qemuMonitorPtr mon,
                            const char *device,
                            const char *file,
@@ -848,25 +836,21 @@ int qemuMonitorDriveMirror(qemuMonitorPtr mon,
                            unsigned long long bandwidth,
                            unsigned int granularity,
                            unsigned long long buf_size,
-                           unsigned int flags)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                           unsigned int flags);
 int qemuMonitorDrivePivot(qemuMonitorPtr mon,
-                          const char *device)
-    ATTRIBUTE_NONNULL(2);
+                          const char *device);

 int qemuMonitorBlockCommit(qemuMonitorPtr mon,
                            const char *device,
                            const char *top,
                            const char *base,
                            const char *backingName,
-                           unsigned long long bandwidth)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
+                           unsigned long long bandwidth);
 bool qemuMonitorSupportsActiveCommit(qemuMonitorPtr mon);
 char *qemuMonitorDiskNameLookup(qemuMonitorPtr mon,
                                 const char *device,
                                 virStorageSourcePtr top,
-                                virStorageSourcePtr target)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
+                                virStorageSourcePtr target);

 int qemuMonitorArbitraryCommand(qemuMonitorPtr mon,
                                 const char *cmd,
@@ -888,13 +872,11 @@ int qemuMonitorBlockStream(qemuMonitorPtr mon,
                            const char *base,
                            const char *backingName,
                            unsigned long long bandwidth,
-                           bool modern)
-    ATTRIBUTE_NONNULL(2);
+                           bool modern);

 int qemuMonitorBlockJobCancel(qemuMonitorPtr mon,
                               const char *device,
-                              bool modern)
-    ATTRIBUTE_NONNULL(2);
+                              bool modern);

 int qemuMonitorBlockJobSetSpeed(qemuMonitorPtr mon,
                                 const char *device,
@@ -914,8 +896,7 @@ struct _qemuMonitorBlockJobInfo {
 virHashTablePtr qemuMonitorGetAllBlockJobInfo(qemuMonitorPtr mon);
 int qemuMonitorGetBlockJobInfo(qemuMonitorPtr mon,
                                const char *device,
-                               qemuMonitorBlockJobInfoPtr info)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                               qemuMonitorBlockJobInfoPtr info);

 int qemuMonitorOpenGraphics(qemuMonitorPtr mon,
                             const char *protocol,
@@ -940,8 +921,7 @@ int qemuMonitorGetVersion(qemuMonitorPtr mon,
                           int *major,
                           int *minor,
                           int *micro,
-                          char **package)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
+                          char **package);


 typedef struct _qemuMonitorMachineInfo qemuMonitorMachineInfo;
@@ -1097,8 +1077,7 @@ struct _qemuMonitorMemoryDeviceInfo {
 };

 int qemuMonitorGetMemoryDeviceInfo(qemuMonitorPtr mon,
-                                   virHashTablePtr *info)
-    ATTRIBUTE_NONNULL(2);
+                                   virHashTablePtr *info);

 int qemuMonitorMigrateIncoming(qemuMonitorPtr mon,
                                const char *uri);
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index 9495efd034f8..1fe975fc87f8 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -246,11 +246,8 @@ int qemuMonitorJSONDiskSnapshot(qemuMonitorPtr mon,
                                 const char *device,
                                 const char *file,
                                 const char *format,
-                                bool reuse)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3)
-    ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5);
-int qemuMonitorJSONTransaction(qemuMonitorPtr mon, virJSONValuePtr actions)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                                bool reuse);
+int qemuMonitorJSONTransaction(qemuMonitorPtr mon, virJSONValuePtr actions);
 int qemuMonitorJSONDriveMirror(qemuMonitorPtr mon,
                                const char *device,
                                const char *file,
@@ -258,26 +255,21 @@ int qemuMonitorJSONDriveMirror(qemuMonitorPtr mon,
                                unsigned long long speed,
                                unsigned int granularity,
                                unsigned long long buf_size,
-                               unsigned int flags)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                               unsigned int flags);
 int qemuMonitorJSONDrivePivot(qemuMonitorPtr mon,
-                              const char *device)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                              const char *device);

 int qemuMonitorJSONBlockCommit(qemuMonitorPtr mon,
                                const char *device,
                                const char *top,
                                const char *base,
                                const char *backingName,
-                               unsigned long long bandwidth)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                               unsigned long long bandwidth);

 char *qemuMonitorJSONDiskNameLookup(qemuMonitorPtr mon,
                                     const char *device,
                                     virStorageSourcePtr top,
-                                    virStorageSourcePtr target)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
-    ATTRIBUTE_NONNULL(4);
+                                    virStorageSourcePtr target);

 int qemuMonitorJSONArbitraryCommand(qemuMonitorPtr mon,
                                     const char *cmd_str,
@@ -299,22 +291,18 @@ int qemuMonitorJSONBlockStream(qemuMonitorPtr mon,
                                const char *base,
                                const char *backingName,
                                unsigned long long speed,
-                               bool modern)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                               bool modern);

 int qemuMonitorJSONBlockJobCancel(qemuMonitorPtr mon,
                                   const char *device,
-                                  bool modern)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                                  bool modern);

 int qemuMonitorJSONBlockJobSetSpeed(qemuMonitorPtr mon,
                                     const char *device,
                                     unsigned long long speed,
-                                    bool modern)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                                    bool modern);

-virHashTablePtr qemuMonitorJSONGetAllBlockJobInfo(qemuMonitorPtr mon)
-    ATTRIBUTE_NONNULL(1);
+virHashTablePtr qemuMonitorJSONGetAllBlockJobInfo(qemuMonitorPtr mon);

 int qemuMonitorJSONSetLink(qemuMonitorPtr mon,
                            const char *name,
@@ -342,43 +330,34 @@ int qemuMonitorJSONGetVersion(qemuMonitorPtr mon,
                               int *major,
                               int *minor,
                               int *micro,
-                              char **package)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
+                              char **package);

 int qemuMonitorJSONGetMachines(qemuMonitorPtr mon,
-                               qemuMonitorMachineInfoPtr **machines)
-    ATTRIBUTE_NONNULL(2);
+                               qemuMonitorMachineInfoPtr **machines);

 int qemuMonitorJSONGetCPUDefinitions(qemuMonitorPtr mon,
-                                     qemuMonitorCPUDefInfoPtr **cpus)
-    ATTRIBUTE_NONNULL(2);
+                                     qemuMonitorCPUDefInfoPtr **cpus);

 int qemuMonitorJSONGetCPUModelExpansion(qemuMonitorPtr mon,
                                         qemuMonitorCPUModelExpansionType type,
                                         const char *model_name,
-                                        qemuMonitorCPUModelInfoPtr *model_info)
-    ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
+                                        qemuMonitorCPUModelInfoPtr *model_info);

 int qemuMonitorJSONGetCommands(qemuMonitorPtr mon,
-                               char ***commands)
-    ATTRIBUTE_NONNULL(2);
+                               char ***commands);
 int qemuMonitorJSONGetEvents(qemuMonitorPtr mon,
-                             char ***events)
-    ATTRIBUTE_NONNULL(2);
+                             char ***events);
 int qemuMonitorJSONGetCommandLineOptionParameters(qemuMonitorPtr mon,
                                                   const char *option,
                                                   char ***params,
-                                                  bool *found)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                                                  bool *found);

 int qemuMonitorJSONGetKVMState(qemuMonitorPtr mon,
                                bool *enabled,
-                               bool *present)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                               bool *present);

 int qemuMonitorJSONGetObjectTypes(qemuMonitorPtr mon,
-                                  char ***types)
-    ATTRIBUTE_NONNULL(2);
+                                  char ***types);

 /* ListPath structures and API's are public only for qemumonitorjsontest */
 typedef struct _qemuMonitorJSONListPath qemuMonitorJSONListPath;
@@ -391,8 +370,7 @@ struct _qemuMonitorJSONListPath {

 int qemuMonitorJSONGetObjectListPaths(qemuMonitorPtr mon,
                                       const char *path,
-                                      qemuMonitorJSONListPathPtr **paths)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                                      qemuMonitorJSONListPathPtr **paths);

 void qemuMonitorJSONListPathFree(qemuMonitorJSONListPathPtr paths);

@@ -430,19 +408,16 @@ struct _qemuMonitorJSONObjectProperty {
 int qemuMonitorJSONGetObjectProperty(qemuMonitorPtr mon,
                                      const char *path,
                                      const char *property,
-                                     qemuMonitorJSONObjectPropertyPtr prop)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
+                                     qemuMonitorJSONObjectPropertyPtr prop);

 int qemuMonitorJSONSetObjectProperty(qemuMonitorPtr mon,
                                      const char *path,
                                      const char *property,
-                                     qemuMonitorJSONObjectPropertyPtr prop)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
+                                     qemuMonitorJSONObjectPropertyPtr prop);

 int qemuMonitorJSONGetObjectProps(qemuMonitorPtr mon,
                                   const char *type,
-                                  char ***props)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                                  char ***props);
 char *qemuMonitorJSONGetTargetArch(qemuMonitorPtr mon);

 int qemuMonitorJSONNBDServerStart(qemuMonitorPtr mon,
@@ -453,12 +428,10 @@ int qemuMonitorJSONNBDServerAdd(qemuMonitorPtr mon,
                                 bool writable);
 int qemuMonitorJSONNBDServerStop(qemuMonitorPtr mon);
 int qemuMonitorJSONGetTPMModels(qemuMonitorPtr mon,
-                                char ***tpmmodels)
-    ATTRIBUTE_NONNULL(2);
+                                char ***tpmmodels);

 int qemuMonitorJSONGetTPMTypes(qemuMonitorPtr mon,
-                               char ***tpmtypes)
-    ATTRIBUTE_NONNULL(2);
+                               char ***tpmtypes);

 int qemuMonitorJSONAttachCharDev(qemuMonitorPtr mon,
                                  const char *chrID,
@@ -481,44 +454,34 @@ int qemuMonitorJSONGetGuestCPU(qemuMonitorPtr mon,
 int qemuMonitorJSONRTCResetReinjection(qemuMonitorPtr mon);

 int qemuMonitorJSONGetIOThreads(qemuMonitorPtr mon,
-                                qemuMonitorIOThreadInfoPtr **iothreads)
-    ATTRIBUTE_NONNULL(2);
+                                qemuMonitorIOThreadInfoPtr **iothreads);

 int qemuMonitorJSONGetMemoryDeviceInfo(qemuMonitorPtr mon,
-                                       virHashTablePtr info)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                                       virHashTablePtr info);

 int qemuMonitorJSONFindLinkPath(qemuMonitorPtr mon,
                                 const char *name,
                                 const char *alias,
-                                char **path)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(4);
+                                char **path);

 int qemuMonitorJSONMigrateIncoming(qemuMonitorPtr mon,
-                                   const char *uri)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                                   const char *uri);

-int qemuMonitorJSONMigrateStartPostCopy(qemuMonitorPtr mon)
-    ATTRIBUTE_NONNULL(1);
+int qemuMonitorJSONMigrateStartPostCopy(qemuMonitorPtr mon);

 int qemuMonitorJSONGetRTCTime(qemuMonitorPtr mon,
-                              struct tm *tm)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                              struct tm *tm);

 int qemuMonitorJSONGetHotpluggableCPUs(qemuMonitorPtr mon,
                                        struct qemuMonitorQueryHotpluggableCpusEntry **entries,
-                                       size_t *nentries)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                                       size_t *nentries);

-virHashTablePtr qemuMonitorJSONQueryQMPSchema(qemuMonitorPtr mon)
-    ATTRIBUTE_NONNULL(1);
+virHashTablePtr qemuMonitorJSONQueryQMPSchema(qemuMonitorPtr mon);

 int qemuMonitorJSONSetBlockThreshold(qemuMonitorPtr mon,
                                      const char *nodename,
-                                     unsigned long long threshold)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                                     unsigned long long threshold);

-virJSONValuePtr qemuMonitorJSONQueryNamedBlockNodes(qemuMonitorPtr mon)
-    ATTRIBUTE_NONNULL(1);
+virJSONValuePtr qemuMonitorJSONQueryNamedBlockNodes(qemuMonitorPtr mon);

 #endif /* QEMU_MONITOR_JSON_H */
diff --git a/src/rpc/virkeepalive.h b/src/rpc/virkeepalive.h
index 2297cd95e83c..a92c77c50ae4 100644
--- a/src/rpc/virkeepalive.h
+++ b/src/rpc/virkeepalive.h
@@ -39,9 +39,7 @@ virKeepAlivePtr virKeepAliveNew(int interval,
                                 void *client,
                                 virKeepAliveSendFunc sendCB,
                                 virKeepAliveDeadFunc deadCB,
-                                virKeepAliveFreeFunc freeCB)
-                                ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4)
-                                ATTRIBUTE_NONNULL(5) ATTRIBUTE_NONNULL(6);
+                                virKeepAliveFreeFunc freeCB);

 int virKeepAliveStart(virKeepAlivePtr ka,
                       int interval,
diff --git a/src/rpc/virnetclientstream.h b/src/rpc/virnetclientstream.h
index a0d2be9ed749..0450fe90eeaa 100644
--- a/src/rpc/virnetclientstream.h
+++ b/src/rpc/virnetclientstream.h
@@ -69,7 +69,6 @@ int virNetClientStreamEventUpdateCallback(virNetClientStreamPtr st,
                                           int events);
 int virNetClientStreamEventRemoveCallback(virNetClientStreamPtr st);

-bool virNetClientStreamEOF(virNetClientStreamPtr st)
-    ATTRIBUTE_NONNULL(1);
+bool virNetClientStreamEOF(virNetClientStreamPtr st);

 #endif /* __VIR_NET_CLIENT_STREAM_H__ */
diff --git a/src/rpc/virnetmessage.h b/src/rpc/virnetmessage.h
index d7406fcd24d5..85a135cb7e95 100644
--- a/src/rpc/virnetmessage.h
+++ b/src/rpc/virnetmessage.h
@@ -60,27 +60,25 @@ void virNetMessageClear(virNetMessagePtr);

 void virNetMessageFree(virNetMessagePtr msg);

-virNetMessagePtr virNetMessageQueueServe(virNetMessagePtr *queue)
-    ATTRIBUTE_NONNULL(1);
+virNetMessagePtr virNetMessageQueueServe(virNetMessagePtr *queue);
 void virNetMessageQueuePush(virNetMessagePtr *queue,
-                            virNetMessagePtr msg)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                            virNetMessagePtr msg);

 int virNetMessageEncodeHeader(virNetMessagePtr msg)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virNetMessageDecodeLength(virNetMessagePtr msg)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virNetMessageDecodeHeader(virNetMessagePtr msg)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetMessageEncodePayload(virNetMessagePtr msg,
                                xdrproc_t filter,
                                void *data)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virNetMessageDecodePayload(virNetMessagePtr msg,
                                xdrproc_t filter,
                                void *data)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetMessageEncodeNumFDs(virNetMessagePtr msg);
 int virNetMessageDecodeNumFDs(virNetMessagePtr msg);
@@ -88,12 +86,11 @@ int virNetMessageDecodeNumFDs(virNetMessagePtr msg);
 int virNetMessageEncodePayloadRaw(virNetMessagePtr msg,
                                   const char *buf,
                                   size_t len)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virNetMessageEncodePayloadEmpty(virNetMessagePtr msg)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

-void virNetMessageSaveError(virNetMessageErrorPtr rerr)
-    ATTRIBUTE_NONNULL(1);
+void virNetMessageSaveError(virNetMessageErrorPtr rerr);

 int virNetMessageDupFD(virNetMessagePtr msg,
                        size_t slot);
diff --git a/src/secret/secret_util.h b/src/secret/secret_util.h
index 12b51b1aa295..0c9ea4a2bf8a 100644
--- a/src/secret/secret_util.h
+++ b/src/secret/secret_util.h
@@ -30,6 +30,5 @@ int virSecretGetSecretString(virConnectPtr conn,
                              virSecretUsageType secretUsageType,
                              uint8_t **ret_secret,
                              size_t *ret_secret_size)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(4)
-    ATTRIBUTE_NONNULL(5) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 #endif /* __VIR_SECRET_UTIL_H__ */
diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index 922e484942c4..759299ecaf69 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -247,7 +247,6 @@ virSecurityDACSetChownCallback(virSecurityManagerPtr mgr,

 /* returns 1 if label isn't found, 0 on success, -1 on error */
 static int
-ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
 virSecurityDACParseIds(virSecurityLabelDefPtr seclabel,
                        uid_t *uidPtr, gid_t *gidPtr)
 {
@@ -261,7 +260,6 @@ virSecurityDACParseIds(virSecurityLabelDefPtr seclabel,
 }

 static int
-ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4)
 virSecurityDACGetIds(virSecurityLabelDefPtr seclabel,
                      virSecurityDACDataPtr priv,
                      uid_t *uidPtr, gid_t *gidPtr,
@@ -292,7 +290,6 @@ virSecurityDACGetIds(virSecurityLabelDefPtr seclabel,

 /* returns 1 if label isn't found, 0 on success, -1 on error */
 static int
-ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
 virSecurityDACParseImageIds(virSecurityLabelDefPtr seclabel,
                             uid_t *uidPtr, gid_t *gidPtr)
 {
@@ -306,7 +303,6 @@ virSecurityDACParseImageIds(virSecurityLabelDefPtr seclabel,
 }

 static int
-ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4)
 virSecurityDACGetImageIds(virSecurityLabelDefPtr seclabel,
                           virSecurityDACDataPtr priv,
                           uid_t *uidPtr, gid_t *gidPtr)
diff --git a/src/storage/storage_driver.h b/src/storage/storage_driver.h
index 530bc338806c..2962eaa75aa0 100644
--- a/src/storage/storage_driver.h
+++ b/src/storage/storage_driver.h
@@ -51,23 +51,20 @@ bool virStorageFileSupportsSecurityDriver(const virStorageSource *src);
 int virStorageFileGetMetadata(virStorageSourcePtr src,
                               uid_t uid, gid_t gid,
                               bool allow_probe,
-                              bool report_broken)
-    ATTRIBUTE_NONNULL(1);
+                              bool report_broken);

 int virStorageTranslateDiskSourcePool(virConnectPtr conn,
                                       virDomainDiskDefPtr def);

-virStoragePoolObjPtr virStoragePoolObjFindPoolByUUID(const unsigned char *uuid)
-    ATTRIBUTE_NONNULL(1);
+virStoragePoolObjPtr virStoragePoolObjFindPoolByUUID(const unsigned char *uuid);

 virStoragePoolPtr
 storagePoolLookupByTargetPath(virConnectPtr conn,
-                              const char *path)
-    ATTRIBUTE_NONNULL(2);
+                              const char *path);

 char *virStoragePoolObjBuildTempFilePath(virStoragePoolObjPtr pool,
                                          virStorageVolDefPtr vol)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int storageRegister(void);
 int storageRegisterAll(void);
diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
index 7687eb89a0ba..00f9bc89e0ba 100644
--- a/src/storage/storage_util.c
+++ b/src/storage/storage_util.c
@@ -96,7 +96,7 @@ btrfsCloneFile(int dest_fd ATTRIBUTE_UNUSED,
 }
 #endif

-static int ATTRIBUTE_NONNULL(2)
+static int
 virStorageBackendCopyToFD(virStorageVolDefPtr vol,
                           virStorageVolDefPtr inputvol,
                           int fd,
diff --git a/src/storage/storage_util.h b/src/storage/storage_util.h
index fa3b6522c9a8..5bba088cd635 100644
--- a/src/storage/storage_util.h
+++ b/src/storage/storage_util.h
@@ -131,8 +131,7 @@ enum {

 int virStorageBackendVolOpen(const char *path, struct stat *sb,
                              unsigned int flags)
-    ATTRIBUTE_RETURN_CHECK
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+    ATTRIBUTE_RETURN_CHECK;

 # define VIR_STORAGE_DEFAULT_POOL_PERM_MODE 0755
 # define VIR_STORAGE_DEFAULT_VOL_PERM_MODE  0600
diff --git a/src/util/viralloc.h b/src/util/viralloc.h
index 088f18f42548..45ded9a41a16 100644
--- a/src/util/viralloc.h
+++ b/src/util/viralloc.h
@@ -48,38 +48,35 @@
 /* Don't call these directly - use the macros below */
 int virAlloc(void *ptrptr, size_t size, bool report, int domcode,
              const char *filename, const char *funcname, size_t linenr)
-    ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1);
+    ATTRIBUTE_RETURN_CHECK;
 int virAllocN(void *ptrptr, size_t size, size_t count, bool report, int domcode,
               const char *filename, const char *funcname, size_t linenr)
-    ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1);
+    ATTRIBUTE_RETURN_CHECK;
 int virReallocN(void *ptrptr, size_t size, size_t count, bool report, int domcode,
                 const char *filename, const char *funcname, size_t linenr)
-    ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1);
+    ATTRIBUTE_RETURN_CHECK;
 int virExpandN(void *ptrptr, size_t size, size_t *count, size_t add, bool report,
                int domcode, const char *filename, const char *funcname, size_t linenr)
-    ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
+    ATTRIBUTE_RETURN_CHECK;
 int virResizeN(void *ptrptr, size_t size, size_t *alloc, size_t count, size_t desired,
                bool report, int domcode, const char *filename,
                const char *funcname, size_t linenr)
-    ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
-void virShrinkN(void *ptrptr, size_t size, size_t *count, size_t toremove)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
+    ATTRIBUTE_RETURN_CHECK;
+void virShrinkN(void *ptrptr, size_t size, size_t *count, size_t toremove);
 int virInsertElementsN(void *ptrptr, size_t size, size_t at, size_t *countptr,
                        size_t add, void *newelem,
                        bool clearOriginal, bool inPlace, bool report, int domcode,
                        const char *filename, const char *funcname, size_t linenr)
-    ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
+    ATTRIBUTE_RETURN_CHECK;
 int virDeleteElementsN(void *ptrptr, size_t size, size_t at, size_t *countptr,
-                       size_t toremove, bool inPlace)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
+                       size_t toremove, bool inPlace);
 int virAllocVar(void *ptrptr, size_t struct_size, size_t element_size, size_t count,
                 bool report, int domcode, const char *filename,
                 const char *funcname, size_t linenr)
-    ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1);
-void virFree(void *ptrptr) ATTRIBUTE_NONNULL(1);
+    ATTRIBUTE_RETURN_CHECK;
+void virFree(void *ptrptr);

-void virDispose(void *ptrptr, size_t count, size_t element_size, size_t *countptr)
-    ATTRIBUTE_NONNULL(1);
+void virDispose(void *ptrptr, size_t count, size_t element_size, size_t *countptr);

 /**
  * VIR_ALLOC:
diff --git a/src/util/viratomic.h b/src/util/viratomic.h
index 4d7f7e582519..f4e3acfb9e90 100644
--- a/src/util/viratomic.h
+++ b/src/util/viratomic.h
@@ -41,8 +41,7 @@
  * This call acts as a full compiler and hardware memory barrier
  * (before the get)
  */
-VIR_STATIC int virAtomicIntGet(volatile int *atomic)
-    ATTRIBUTE_NONNULL(1);
+VIR_STATIC int virAtomicIntGet(volatile int *atomic);

 /**
  * virAtomicIntSet:
@@ -52,8 +51,7 @@ VIR_STATIC int virAtomicIntGet(volatile int *atomic)
  * (after the set)
  */
 VIR_STATIC void virAtomicIntSet(volatile int *atomic,
-                                int newval)
-    ATTRIBUTE_NONNULL(1);
+                                int newval);

 /**
  * virAtomicIntInc:
@@ -64,8 +62,7 @@ VIR_STATIC void virAtomicIntSet(volatile int *atomic,
  *
  * This call acts as a full compiler and hardware memory barrier.
  */
-VIR_STATIC int virAtomicIntInc(volatile int *atomic)
-    ATTRIBUTE_NONNULL(1);
+VIR_STATIC int virAtomicIntInc(volatile int *atomic);

 /**
  * virAtomicIntDecAndTest:
@@ -76,8 +73,7 @@ VIR_STATIC int virAtomicIntInc(volatile int *atomic)
  *
  * This call acts as a full compiler and hardware memory barrier.
  */
-VIR_STATIC bool virAtomicIntDecAndTest(volatile int *atomic)
-    ATTRIBUTE_NONNULL(1);
+VIR_STATIC bool virAtomicIntDecAndTest(volatile int *atomic);

 /**
  * virAtomicIntCompareExchange:
@@ -94,8 +90,7 @@ VIR_STATIC bool virAtomicIntDecAndTest(volatile int *atomic)
  */
 VIR_STATIC bool virAtomicIntCompareExchange(volatile int *atomic,
                                             int oldval,
-                                            int newval)
-    ATTRIBUTE_NONNULL(1);
+                                            int newval);

 /**
  * virAtomicIntAdd:
@@ -107,8 +102,7 @@ VIR_STATIC bool virAtomicIntCompareExchange(volatile int *atomic,
  * This call acts as a full compiler and hardware memory barrier.
  */
 VIR_STATIC int virAtomicIntAdd(volatile int *atomic,
-                               int val)
-    ATTRIBUTE_NONNULL(1);
+                               int val);

 /**
  * virAtomicIntAnd:
@@ -121,8 +115,7 @@ VIR_STATIC int virAtomicIntAdd(volatile int *atomic,
  * { tmp = *atomic; *atomic &= val; return tmp; }
  */
 VIR_STATIC unsigned int virAtomicIntAnd(volatile unsigned int *atomic,
-                                        unsigned int val)
-    ATTRIBUTE_NONNULL(1);
+                                        unsigned int val);

 /**
  * virAtomicIntOr:
@@ -135,8 +128,7 @@ VIR_STATIC unsigned int virAtomicIntAnd(volatile unsigned int *atomic,
  * This call acts as a full compiler and hardware memory barrier.
  */
 VIR_STATIC unsigned int virAtomicIntOr(volatile unsigned int *atomic,
-                                       unsigned int val)
-    ATTRIBUTE_NONNULL(1);
+                                       unsigned int val);

 /**
  * virAtomicIntXor:
@@ -149,8 +141,7 @@ VIR_STATIC unsigned int virAtomicIntOr(volatile unsigned int *atomic,
  * This call acts as a full compiler and hardware memory barrier.
  */
 VIR_STATIC unsigned int virAtomicIntXor(volatile unsigned int *atomic,
-                                        unsigned int val)
-    ATTRIBUTE_NONNULL(1);
+                                        unsigned int val);

 # undef VIR_STATIC

diff --git a/src/util/virbitmap.h b/src/util/virbitmap.h
index 36282af1cddf..9a87e44b2f53 100644
--- a/src/util/virbitmap.h
+++ b/src/util/virbitmap.h
@@ -54,41 +54,40 @@ int virBitmapCopy(virBitmapPtr dst, virBitmapPtr src);
  * Set bit position @b in @bitmap
  */
 int virBitmapSetBit(virBitmapPtr bitmap, size_t b)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virBitmapSetBitExpand(virBitmapPtr bitmap, size_t b)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;


 /*
  * Clear bit position @b in @bitmap
  */
 int virBitmapClearBit(virBitmapPtr bitmap, size_t b)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virBitmapClearBitExpand(virBitmapPtr bitmap, size_t b)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 /*
  * Get bit @b in @bitmap. Returns false if b is out of range.
  */
 bool virBitmapIsBitSet(virBitmapPtr bitmap, size_t b)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 /*
  * Get setting of bit position @b in @bitmap and store in @result
  */
 int virBitmapGetBit(virBitmapPtr bitmap, size_t b, bool *result)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 char *virBitmapString(virBitmapPtr bitmap)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 char *virBitmapFormat(virBitmapPtr bitmap);

 int virBitmapParse(const char *str,
                    virBitmapPtr *bitmap,
-                   size_t bitmapSize)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                   size_t bitmapSize);
 int
 virBitmapParseSeparator(const char *str,
                         char terminator,
@@ -97,53 +96,39 @@ virBitmapParseSeparator(const char *str,
 virBitmapPtr
 virBitmapParseUnlimited(const char *str);

-virBitmapPtr virBitmapNewCopy(virBitmapPtr src) ATTRIBUTE_NONNULL(1);
+virBitmapPtr virBitmapNewCopy(virBitmapPtr src);

-virBitmapPtr virBitmapNewData(const void *data, int len) ATTRIBUTE_NONNULL(1);
+virBitmapPtr virBitmapNewData(const void *data, int len);

-int virBitmapToData(virBitmapPtr bitmap, unsigned char **data, int *dataLen)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+int virBitmapToData(virBitmapPtr bitmap, unsigned char **data, int *dataLen);

-void virBitmapToDataBuf(virBitmapPtr bitmap, unsigned char *data, size_t len)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+void virBitmapToDataBuf(virBitmapPtr bitmap, unsigned char *data, size_t len);

 bool virBitmapEqual(virBitmapPtr b1, virBitmapPtr b2);

-size_t virBitmapSize(virBitmapPtr bitmap)
-    ATTRIBUTE_NONNULL(1);
+size_t virBitmapSize(virBitmapPtr bitmap);

-void virBitmapSetAll(virBitmapPtr bitmap)
-    ATTRIBUTE_NONNULL(1);
+void virBitmapSetAll(virBitmapPtr bitmap);

-void virBitmapClearAll(virBitmapPtr bitmap)
-    ATTRIBUTE_NONNULL(1);
+void virBitmapClearAll(virBitmapPtr bitmap);

-bool virBitmapIsAllSet(virBitmapPtr bitmap)
-    ATTRIBUTE_NONNULL(1);
+bool virBitmapIsAllSet(virBitmapPtr bitmap);

-bool virBitmapIsAllClear(virBitmapPtr bitmap)
-    ATTRIBUTE_NONNULL(1);
+bool virBitmapIsAllClear(virBitmapPtr bitmap);

-ssize_t virBitmapNextSetBit(virBitmapPtr bitmap, ssize_t pos)
-    ATTRIBUTE_NONNULL(1);
+ssize_t virBitmapNextSetBit(virBitmapPtr bitmap, ssize_t pos);

-ssize_t virBitmapLastSetBit(virBitmapPtr bitmap)
-    ATTRIBUTE_NONNULL(1);
+ssize_t virBitmapLastSetBit(virBitmapPtr bitmap);

-ssize_t virBitmapNextClearBit(virBitmapPtr bitmap, ssize_t pos)
-    ATTRIBUTE_NONNULL(1);
+ssize_t virBitmapNextClearBit(virBitmapPtr bitmap, ssize_t pos);

-size_t virBitmapCountBits(virBitmapPtr bitmap)
-    ATTRIBUTE_NONNULL(1);
+size_t virBitmapCountBits(virBitmapPtr bitmap);

 char *virBitmapDataToString(const void *data,
-                            int len)
-    ATTRIBUTE_NONNULL(1);
+                            int len);
 bool virBitmapOverlaps(virBitmapPtr b1,
-                       virBitmapPtr b2)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                       virBitmapPtr b2);

-void virBitmapSubtract(virBitmapPtr a, virBitmapPtr b)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+void virBitmapSubtract(virBitmapPtr a, virBitmapPtr b);

 #endif
diff --git a/src/util/virbuffer.h b/src/util/virbuffer.h
index d1b64ca3a3de..db42bea8c0f6 100644
--- a/src/util/virbuffer.h
+++ b/src/util/virbuffer.h
@@ -58,7 +58,7 @@ int virBufferCheckErrorInternal(const virBuffer *buf,
                                 const char *filename,
                                 const char *funcname,
                                 size_t linenr)
-    ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1);
+    ATTRIBUTE_RETURN_CHECK;
 /**
  * virBufferCheckError
  *
diff --git a/src/util/vircgroup.h b/src/util/vircgroup.h
index 2de1bf2de4ce..2e427bd95fd5 100644
--- a/src/util/vircgroup.h
+++ b/src/util/vircgroup.h
@@ -66,25 +66,21 @@ bool virCgroupAvailable(void);
 int virCgroupNewPartition(const char *path,
                           bool create,
                           int controllers,
-                          virCgroupPtr *group)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
+                          virCgroupPtr *group);

-int virCgroupNewSelf(virCgroupPtr *group)
-    ATTRIBUTE_NONNULL(1);
+int virCgroupNewSelf(virCgroupPtr *group);

 int virCgroupNewDomainPartition(virCgroupPtr partition,
                                 const char *driver,
                                 const char *name,
                                 bool create,
-                                virCgroupPtr *group)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5);
+                                virCgroupPtr *group);

 int virCgroupNewThread(virCgroupPtr domain,
                        virCgroupThreadName nameval,
                        int id,
                        bool create,
-                       virCgroupPtr *group)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(5);
+                       virCgroupPtr *group);

 int virCgroupDelThread(virCgroupPtr cgroup,
                        virCgroupThreadName nameval,
@@ -100,8 +96,7 @@ int virCgroupNewDetectMachine(const char *name,
                               bool privileged,
                               pid_t pid,
                               int controllers,
-                              virCgroupPtr *group)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                              virCgroupPtr *group);

 int virCgroupNewMachine(const char *name,
                         const char *drivername,
@@ -113,12 +108,9 @@ int virCgroupNewMachine(const char *name,
                         int *nicindexes,
                         const char *partition,
                         int controllers,
-                        virCgroupPtr *group)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
-    ATTRIBUTE_NONNULL(3);
+                        virCgroupPtr *group);

-int virCgroupTerminateMachine(const char *name)
-    ATTRIBUTE_NONNULL(1);
+int virCgroupTerminateMachine(const char *name);

 bool virCgroupNewIgnoreError(void);

diff --git a/src/util/vircommand.h b/src/util/vircommand.h
index 99dcdeb541a7..8fd1c8da0e90 100644
--- a/src/util/vircommand.h
+++ b/src/util/vircommand.h
@@ -37,15 +37,14 @@ pid_t virFork(void) ATTRIBUTE_RETURN_CHECK;

 int virRun(const char *const*argv, int *status) ATTRIBUTE_RETURN_CHECK;

-virCommandPtr virCommandNew(const char *binary) ATTRIBUTE_NONNULL(1);
+virCommandPtr virCommandNew(const char *binary);

-virCommandPtr virCommandNewArgs(const char *const*args) ATTRIBUTE_NONNULL(1);
+virCommandPtr virCommandNewArgs(const char *const*args);

 virCommandPtr virCommandNewArgList(const char *binary, ...)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_SENTINEL;
+    ATTRIBUTE_SENTINEL;

-virCommandPtr virCommandNewVAList(const char *binary, va_list list)
-    ATTRIBUTE_NONNULL(1);
+virCommandPtr virCommandNewVAList(const char *binary, va_list list);

 /* All error report from these setup APIs is
  * delayed until the Run/RunAsync methods
@@ -66,7 +65,7 @@ int virCommandPassFDGetFDIndex(virCommandPtr cmd,
                                int fd);

 void virCommandSetPidFile(virCommandPtr cmd,
-                          const char *pidfile) ATTRIBUTE_NONNULL(2);
+                          const char *pidfile);

 void virCommandSetGID(virCommandPtr cmd, gid_t gid);

@@ -96,73 +95,72 @@ void virCommandNonblockingFDs(virCommandPtr cmd);
 void virCommandRawStatus(virCommandPtr cmd);

 void virCommandAddEnvFormat(virCommandPtr cmd, const char *format, ...)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_FMT_PRINTF(2, 3);
+    ATTRIBUTE_FMT_PRINTF(2, 3);

 void virCommandAddEnvPair(virCommandPtr cmd,
                           const char *name,
-                          const char *value) ATTRIBUTE_NONNULL(2);
+                          const char *value);

 void virCommandAddEnvString(virCommandPtr cmd,
-                            const char *str) ATTRIBUTE_NONNULL(2);
+                            const char *str);

 void virCommandAddEnvBuffer(virCommandPtr cmd,
                             virBufferPtr buf);

 void virCommandAddEnvPassBlockSUID(virCommandPtr cmd,
                                    const char *name,
-                                   const char *defvalue) ATTRIBUTE_NONNULL(2);
+                                   const char *defvalue);

 void virCommandAddEnvPassAllowSUID(virCommandPtr cmd,
-                                   const char *name) ATTRIBUTE_NONNULL(2);
+                                   const char *name);

 void virCommandAddEnvPassCommon(virCommandPtr cmd);

 void virCommandAddArg(virCommandPtr cmd,
-                      const char *val) ATTRIBUTE_NONNULL(2);
+                      const char *val);

 void virCommandAddArgBuffer(virCommandPtr cmd,
                             virBufferPtr buf);

 void virCommandAddArgFormat(virCommandPtr cmd,
                             const char *format, ...)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_FMT_PRINTF(2, 3);
+    ATTRIBUTE_FMT_PRINTF(2, 3);

 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);
+                         const char *const*vals);

 void virCommandAddArgList(virCommandPtr cmd,
                           ... /* const char *arg, ..., NULL */)
     ATTRIBUTE_SENTINEL;

 void virCommandSetWorkingDirectory(virCommandPtr cmd,
-                                   const char *pwd) ATTRIBUTE_NONNULL(2);
+                                   const char *pwd);

 void virCommandSetInputBuffer(virCommandPtr cmd,
-                              const char *inbuf) ATTRIBUTE_NONNULL(2);
+                              const char *inbuf);

 void virCommandSetOutputBuffer(virCommandPtr cmd,
-                               char **outbuf) ATTRIBUTE_NONNULL(2);
+                               char **outbuf);

 void virCommandSetErrorBuffer(virCommandPtr cmd,
-                              char **errbuf) ATTRIBUTE_NONNULL(2);
+                              char **errbuf);

 void virCommandSetInputFD(virCommandPtr cmd,
                           int infd);

 void virCommandSetOutputFD(virCommandPtr cmd,
-                           int *outfd) ATTRIBUTE_NONNULL(2);
+                           int *outfd);

 void virCommandSetErrorFD(virCommandPtr cmd,
-                          int *errfd) ATTRIBUTE_NONNULL(2);
+                          int *errfd);

 void virCommandSetPreExecHook(virCommandPtr cmd,
                               virExecHook hook,
-                              void *opaque) ATTRIBUTE_NONNULL(2);
+                              void *opaque);

 void virCommandWriteArgLog(virCommandPtr cmd,
                            int logfd);
diff --git a/src/util/vircrypto.h b/src/util/vircrypto.h
index 52ba3b3ad022..81f401421973 100644
--- a/src/util/vircrypto.h
+++ b/src/util/vircrypto.h
@@ -42,7 +42,6 @@ int
 virCryptoHashString(virCryptoHash hash,
                     const char *input,
                     char **output)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
     ATTRIBUTE_RETURN_CHECK;

 bool virCryptoHaveCipher(virCryptoCipher algorithm);
@@ -52,8 +51,7 @@ int virCryptoEncryptData(virCryptoCipher algorithm,
                          uint8_t *iv, size_t ivlen,
                          uint8_t *data, size_t datalen,
                          uint8_t **ciphertext, size_t *ciphertextlen)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(6)
-    ATTRIBUTE_NONNULL(8) ATTRIBUTE_NONNULL(9) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 uint8_t *virCryptoGenerateRandom(size_t nbytes);

diff --git a/src/util/virfile.h b/src/util/virfile.h
index ba1c57c06a8e..9749d3195a7b 100644
--- a/src/util/virfile.h
+++ b/src/util/virfile.h
@@ -93,7 +93,7 @@ typedef enum {
 virFileWrapperFdPtr virFileWrapperFdNew(int *fd,
                                         const char *name,
                                         unsigned int flags)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virFileWrapperFdClose(virFileWrapperFdPtr dfd);

@@ -128,18 +128,18 @@ int virFileNBDDeviceAssociate(const char *file,
 int virFileDeleteTree(const char *dir);

 int virFileReadHeaderFD(int fd, int maxlen, char **buf)
-    ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(3);
+    ATTRIBUTE_RETURN_CHECK;
 int virFileReadLimFD(int fd, int maxlen, char **buf)
-    ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(3);
+    ATTRIBUTE_RETURN_CHECK;
 int virFileReadAll(const char *path, int maxlen, char **buf)
-    ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
+    ATTRIBUTE_RETURN_CHECK;
 int virFileReadAllQuiet(const char *path, int maxlen, char **buf)
-    ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
+    ATTRIBUTE_RETURN_CHECK;
 int virFileReadBufQuiet(const char *file, char *buf, int len)
-    ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+    ATTRIBUTE_RETURN_CHECK;

 int virFileWriteStr(const char *path, const char *str, mode_t mode)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virFileMatchesNameSuffix(const char *file,
                              const char *name,
@@ -152,12 +152,10 @@ int virFileStripSuffix(char *str,
                        const char *suffix) ATTRIBUTE_RETURN_CHECK;

 int virFileLinkPointsTo(const char *checkLink,
-                        const char *checkDest)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                        const char *checkDest);
 int virFileRelLinkPointsTo(const char *directory,
                            const char *checkLink,
-                           const char *checkDest)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                           const char *checkDest);

 int virFileResolveLink(const char *linkpath,
                        char **resultpath) ATTRIBUTE_RETURN_CHECK;
@@ -165,31 +163,28 @@ int virFileResolveAllLinks(const char *linkpath,
                            char **resultpath) ATTRIBUTE_RETURN_CHECK;

 int virFileIsLink(const char *linkpath)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virFileReadLink(const char *linkpath, char **resultpath)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 char *virFindFileInPath(const char *file);

 char *virFileFindResource(const char *filename,
                           const char *builddir,
-                          const char *installdir)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                          const char *installdir);
 char *virFileFindResourceFull(const char *filename,
                               const char *prefix,
                               const char *suffix,
                               const char *builddir,
                               const char *installdir,
-                              const char *envname)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5);
-void virFileActivateDirOverride(const char *argv0)
-    ATTRIBUTE_NONNULL(1);
+                              const char *envname);
+void virFileActivateDirOverride(const char *argv0);

-off_t virFileLength(const char *path, int fd) ATTRIBUTE_NONNULL(1);
-bool virFileIsDir (const char *file) ATTRIBUTE_NONNULL(1);
-bool virFileExists(const char *file) ATTRIBUTE_NONNULL(1);
-bool virFileIsExecutable(const char *file) ATTRIBUTE_NONNULL(1);
+off_t virFileLength(const char *path, int fd);
+bool virFileIsDir (const char *file);
+bool virFileExists(const char *file);
+bool virFileIsExecutable(const char *file);

 enum {
     VIR_FILE_SHFS_NFS = (1 << 0),
@@ -200,9 +195,9 @@ enum {
     VIR_FILE_SHFS_CIFS = (1 << 5),
 };

-int virFileIsSharedFSType(const char *path, int fstypes) ATTRIBUTE_NONNULL(1);
-int virFileIsSharedFS(const char *path) ATTRIBUTE_NONNULL(1);
-int virFileIsMountPoint(const char *file) ATTRIBUTE_NONNULL(1);
+int virFileIsSharedFSType(const char *path, int fstypes);
+int virFileIsSharedFS(const char *path);
+int virFileIsMountPoint(const char *file);

 int virFileGetMountSubtree(const char *mtabpath,
                            const char *prefix,
@@ -224,11 +219,11 @@ enum {
 };
 int virFileAccessibleAs(const char *path, int mode,
                         uid_t uid, gid_t gid)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virFileOpenAs(const char *path, int openflags, mode_t mode,
                   uid_t uid, gid_t gid,
                   unsigned int flags)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virFileRemove(const char *path, uid_t uid, gid_t gid);

 enum {
@@ -239,15 +234,14 @@ enum {
 int virDirCreate(const char *path, mode_t mode, uid_t uid, gid_t gid,
                  unsigned int flags) ATTRIBUTE_RETURN_CHECK;
 int virDirOpen(DIR **dirp, const char *dirname)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virDirOpenIfExists(DIR **dirp, const char *dirname)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virDirOpenQuiet(DIR **dirp, const char *dirname)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virDirRead(DIR *dirp, struct dirent **ent, const char *dirname)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
-void virDirClose(DIR **dirp)
-    ATTRIBUTE_NONNULL(1);
+    ATTRIBUTE_RETURN_CHECK;
+void virDirClose(DIR **dirp);
 # define VIR_DIR_CLOSE(dir)  virDirClose(&(dir))

 int virFileMakePath(const char *path) ATTRIBUTE_RETURN_CHECK;
diff --git a/src/util/virfirewall.h b/src/util/virfirewall.h
index b04ab4870dba..8df547bdf893 100644
--- a/src/util/virfirewall.h
+++ b/src/util/virfirewall.h
@@ -74,18 +74,16 @@ void virFirewallRemoveRule(virFirewallPtr firewall,

 void virFirewallRuleAddArg(virFirewallPtr firewall,
                            virFirewallRulePtr rule,
-                           const char *arg)
-    ATTRIBUTE_NONNULL(3);
+                           const char *arg);

 void virFirewallRuleAddArgFormat(virFirewallPtr firewall,
                                  virFirewallRulePtr rule,
                                  const char *fmt, ...)
-    ATTRIBUTE_NONNULL(3) ATTRIBUTE_FMT_PRINTF(3, 4);
+    ATTRIBUTE_FMT_PRINTF(3, 4);

 void virFirewallRuleAddArgSet(virFirewallPtr firewall,
                               virFirewallRulePtr rule,
-                              const char *const *args)
-    ATTRIBUTE_NONNULL(3);
+                              const char *const *args);

 void virFirewallRuleAddArgList(virFirewallPtr firewall,
                                virFirewallRulePtr rule,
diff --git a/src/util/virfirmware.h b/src/util/virfirmware.h
index 682a865ee966..583224ccbe73 100644
--- a/src/util/virfirmware.h
+++ b/src/util/virfirmware.h
@@ -38,14 +38,12 @@ void
 virFirmwareFreeList(virFirmwarePtr *firmwares, size_t nfirmwares);

 int
-virFirmwareParse(const char *str, virFirmwarePtr firmware)
-    ATTRIBUTE_NONNULL(2);
+virFirmwareParse(const char *str, virFirmwarePtr firmware);

 int
 virFirmwareParseList(const char *list,
                      virFirmwarePtr **firmwares,
-                     size_t *nfirmwares)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                     size_t *nfirmwares);


 #endif /* __VIR_FIRMWARE_H__ */
diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c
index 02b9fc8eb94f..57c3c4a60e7a 100644
--- a/src/util/virhostcpu.c
+++ b/src/util/virhostcpu.c
@@ -282,10 +282,6 @@ virHostCPUGetSiblingsList(unsigned int cpu)
 /* parses a node entry, returning number of processors in the node and
  * filling arguments */
 static int
-ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3)
-ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(6)
-ATTRIBUTE_NONNULL(7) ATTRIBUTE_NONNULL(8)
-ATTRIBUTE_NONNULL(9)
 virHostCPUParseNode(const char *node,
                     virArch arch,
                     virBitmapPtr present_cpus_map,
diff --git a/src/util/virhostdev.h b/src/util/virhostdev.h
index 54e1c66be36f..35f7c9f319c9 100644
--- a/src/util/virhostdev.h
+++ b/src/util/virhostdev.h
@@ -67,140 +67,117 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
                             const unsigned char *uuid,
                             virDomainHostdevDefPtr *hostdevs,
                             int nhostdevs,
-                            unsigned int flags)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
-    ATTRIBUTE_NONNULL(4);
+                            unsigned int flags);

 int
 virHostdevFindUSBDevice(virDomainHostdevDefPtr hostdev,
                         bool mandatory,
-                        virUSBDevicePtr *usb)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
+                        virUSBDevicePtr *usb);
 int
 virHostdevPrepareUSBDevices(virHostdevManagerPtr hostdev_mgr,
                             const char *drv_name,
                             const char *dom_name,
                             virDomainHostdevDefPtr *hostdevs,
                             int nhostdevs,
-                            unsigned int flags)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                            unsigned int flags);
 int
 virHostdevPrepareSCSIDevices(virHostdevManagerPtr hostdev_mgr,
                              const char *drv_name,
                              const char *dom_name,
                              virDomainHostdevDefPtr *hostdevs,
-                             int nhostdevs)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                             int nhostdevs);
 int
 virHostdevPrepareSCSIVHostDevices(virHostdevManagerPtr hostdev_mgr,
                                   const char *drv_name,
                                   const char *dom_name,
                                   virDomainHostdevDefPtr *hostdevs,
-                                  int nhostdevs)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                                  int nhostdevs);
 int
 virHostdevPrepareMediatedDevices(virHostdevManagerPtr hostdev_mgr,
                                  const char *drv_name,
                                  const char *dom_name,
                                  virDomainHostdevDefPtr *hostdevs,
-                                 int nhostdevs)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                                 int nhostdevs);
 void
 virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr,
                              const char *drv_name,
                              const char *dom_name,
                              virDomainHostdevDefPtr *hostdevs,
                              int nhostdevs,
-                             const char *oldStateDir)
-    ATTRIBUTE_NONNULL(1);
+                             const char *oldStateDir);
 void
 virHostdevReAttachUSBDevices(virHostdevManagerPtr hostdev_mgr,
                               const char *drv_name,
                               const char *dom_name,
                               virDomainHostdevDefPtr *hostdevs,
-                              int nhostdevs)
-    ATTRIBUTE_NONNULL(1);
+                              int nhostdevs);
 void
 virHostdevReAttachSCSIDevices(virHostdevManagerPtr hostdev_mgr,
                               const char *drv_name,
                               const char *dom_name,
                               virDomainHostdevDefPtr *hostdevs,
-                              int nhostdevs)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                              int nhostdevs);
 void
 virHostdevReAttachSCSIVHostDevices(virHostdevManagerPtr hostdev_mgr,
                                    const char *drv_name,
                                    const char *dom_name,
                                    virDomainHostdevDefPtr *hostdevs,
-                                   int nhostdevs)
-    ATTRIBUTE_NONNULL(1);
+                                   int nhostdevs);
 void
 virHostdevReAttachMediatedDevices(virHostdevManagerPtr hostdev_mgr,
                                   const char *drv_name,
                                   const char *dom_name,
                                   virDomainHostdevDefPtr *hostdevs,
-                                  int nhostdevs)
-    ATTRIBUTE_NONNULL(1);
+                                  int nhostdevs);
 int
 virHostdevUpdateActivePCIDevices(virHostdevManagerPtr mgr,
                                  virDomainHostdevDefPtr *hostdevs,
                                  int nhostdevs,
                                  const char *drv_name,
-                                 const char *dom_name)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5);
+                                 const char *dom_name);
 int
 virHostdevUpdateActiveUSBDevices(virHostdevManagerPtr mgr,
                                  virDomainHostdevDefPtr *hostdevs,
                                  int nhostdevs,
                                  const char *drv_name,
-                                 const char *dom_name)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5);
+                                 const char *dom_name);
 int
 virHostdevUpdateActiveSCSIDevices(virHostdevManagerPtr mgr,
                                   virDomainHostdevDefPtr *hostdevs,
                                   int nhostdevs,
                                   const char *drv_name,
-                                  const char *dom_name)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5);
+                                  const char *dom_name);
 int
 virHostdevUpdateActiveMediatedDevices(virHostdevManagerPtr mgr,
                                       virDomainHostdevDefPtr *hostdevs,
                                       int nhostdevs,
                                       const char *drv_name,
-                                      const char *dom_name)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5);
+                                      const char *dom_name);
 int
 virHostdevUpdateActiveDomainDevices(virHostdevManagerPtr mgr,
                                     const char *driver,
                                     virDomainDefPtr def,
-                                    unsigned int flags)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                                    unsigned int flags);
 int
 virHostdevPrepareDomainDevices(virHostdevManagerPtr mgr,
                                const char *driver,
                                virDomainDefPtr def,
-                               unsigned int flags)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                               unsigned int flags);
 void
 virHostdevReAttachDomainDevices(virHostdevManagerPtr mgr,
                                 const char *driver,
                                 virDomainDefPtr def,
                                 unsigned int flags,
-                                const char *oldStateDir)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                                const char *oldStateDir);
 bool
-virHostdevIsSCSIDevice(virDomainHostdevDefPtr hostdev)
-    ATTRIBUTE_NONNULL(1);
+virHostdevIsSCSIDevice(virDomainHostdevDefPtr hostdev);

 /* functions used by NodeDevDetach/Reattach/Reset */
 int virHostdevPCINodeDeviceDetach(virHostdevManagerPtr mgr,
-                                  virPCIDevicePtr pci)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                                  virPCIDevicePtr pci);
 int virHostdevPCINodeDeviceReAttach(virHostdevManagerPtr mgr,
-                                    virPCIDevicePtr pci)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                                    virPCIDevicePtr pci);
 int virHostdevPCINodeDeviceReset(virHostdevManagerPtr mgr,
-                                 virPCIDevicePtr pci)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                                 virPCIDevicePtr pci);

 #endif /* __VIR_HOSTDEV_H__ */
diff --git a/src/util/viridentity.h b/src/util/viridentity.h
index 63aa63d573ca..8ff1d11627ac 100644
--- a/src/util/viridentity.h
+++ b/src/util/viridentity.h
@@ -50,20 +50,14 @@ virIdentityPtr virIdentityNew(void);

 int virIdentitySetAttr(virIdentityPtr ident,
                        unsigned int attr,
-                       const char *value)
-    ATTRIBUTE_NONNULL(1)
-    ATTRIBUTE_NONNULL(3);
+                       const char *value);

 int virIdentityGetAttr(virIdentityPtr ident,
                        unsigned int attr,
-                       const char **value)
-    ATTRIBUTE_NONNULL(1)
-    ATTRIBUTE_NONNULL(3);
+                       const char **value);

 bool virIdentityIsEqual(virIdentityPtr identA,
-                        virIdentityPtr identB)
-    ATTRIBUTE_NONNULL(1)
-    ATTRIBUTE_NONNULL(2);
+                        virIdentityPtr identB);

 int virIdentityGetUNIXUserName(virIdentityPtr ident,
                                const char **username);
diff --git a/src/util/viriscsi.h b/src/util/viriscsi.h
index a44beeaf6796..4db64370e52c 100644
--- a/src/util/viriscsi.h
+++ b/src/util/viriscsi.h
@@ -26,37 +26,33 @@

 char *
 virISCSIGetSession(const char *devpath,
-                   bool probe)
-    ATTRIBUTE_NONNULL(1);
+                   bool probe);

 int
 virISCSIConnectionLogin(const char *portal,
                         const char *initiatoriqn,
                         const char *target)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3)
     ATTRIBUTE_RETURN_CHECK;

 int
 virISCSIConnectionLogout(const char *portal,
                          const char *initiatoriqn,
                          const char *target)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3)
     ATTRIBUTE_RETURN_CHECK;

 int
 virISCSIRescanLUNs(const char *session)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int
 virISCSIScanTargets(const char *portal,
                     size_t *ntargetsret,
                     char ***targetsret)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int
 virISCSINodeNew(const char *portal,
                 const char *target)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
     ATTRIBUTE_RETURN_CHECK;

 int
@@ -64,6 +60,5 @@ virISCSINodeUpdate(const char *portal,
                    const char *target,
                    const char *name,
                    const char *value)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
-    ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 #endif
diff --git a/src/util/virjson.h b/src/util/virjson.h
index 14b74c0617c9..38673191aed9 100644
--- a/src/util/virjson.h
+++ b/src/util/virjson.h
@@ -84,13 +84,11 @@ void virJSONValueFree(virJSONValuePtr value);
 void virJSONValueHashFree(void *opaque, const void *name);

 int virJSONValueObjectCreate(virJSONValuePtr *obj, ...)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_SENTINEL;
-int virJSONValueObjectCreateVArgs(virJSONValuePtr *obj, va_list args)
-    ATTRIBUTE_NONNULL(1);
+    ATTRIBUTE_SENTINEL;
+int virJSONValueObjectCreateVArgs(virJSONValuePtr *obj, va_list args);
 int virJSONValueObjectAdd(virJSONValuePtr obj, ...)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_SENTINEL;
-int virJSONValueObjectAddVArgs(virJSONValuePtr obj, va_list args)
-    ATTRIBUTE_NONNULL(1);
+    ATTRIBUTE_SENTINEL;
+int virJSONValueObjectAddVArgs(virJSONValuePtr obj, va_list args);


 virJSONValuePtr virJSONValueNewString(const char *data);
@@ -136,8 +134,7 @@ int virJSONValueGetNumberLong(virJSONValuePtr object, long long *value);
 int virJSONValueGetNumberUlong(virJSONValuePtr object, unsigned long long *value);
 int virJSONValueGetNumberDouble(virJSONValuePtr object, double *value);
 int virJSONValueGetBoolean(virJSONValuePtr object, bool *value);
-int virJSONValueGetArrayAsBitmap(const virJSONValue *val, virBitmapPtr *bitmap)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+int virJSONValueGetArrayAsBitmap(const virJSONValue *val, virBitmapPtr *bitmap);
 bool virJSONValueIsNull(virJSONValuePtr object);
 virJSONValuePtr virJSONValueObjectGetObject(virJSONValuePtr object,
                                             const char *key);
@@ -165,8 +162,7 @@ int virJSONValueObjectAppendBoolean(virJSONValuePtr object, const char *key, int
 int virJSONValueObjectAppendNull(virJSONValuePtr object, const char *key);

 int virJSONValueObjectRemoveKey(virJSONValuePtr object, const char *key,
-                                virJSONValuePtr *value)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                                virJSONValuePtr *value);

 virJSONValuePtr virJSONValueFromString(const char *jsonstring);
 char *virJSONValueToString(virJSONValuePtr object,
diff --git a/src/util/virkeyfile.h b/src/util/virkeyfile.h
index e6f5ba872dc2..99fea952c6da 100644
--- a/src/util/virkeyfile.h
+++ b/src/util/virkeyfile.h
@@ -37,28 +37,25 @@ virKeyFilePtr virKeyFileNew(void);

 int virKeyFileLoadFile(virKeyFilePtr conf,
                        const char *filename)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virKeyFileLoadData(virKeyFilePtr conf,
                        const char *filename,
                        const char *data,
                        size_t len)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 void virKeyFileFree(virKeyFilePtr conf);

 bool virKeyFileHasGroup(virKeyFilePtr conf,
-                        const char *groupname)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                        const char *groupname);

 bool virKeyFileHasValue(virKeyFilePtr conf,
                         const char *groupname,
-                        const char *valuename)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                        const char *valuename);

 const char *virKeyFileGetValueString(virKeyFilePtr conf,
                                      const char *groupname,
-                                     const char *valuename)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                                     const char *valuename);

 #endif /* __VIR_KEYFILE_H__ */
diff --git a/src/util/virkmod.h b/src/util/virkmod.h
index 608f1b884e7c..fe805078ec6e 100644
--- a/src/util/virkmod.h
+++ b/src/util/virkmod.h
@@ -25,10 +25,7 @@
 # include "internal.h"

 char *virKModConfig(void);
-char *virKModLoad(const char *, bool)
-    ATTRIBUTE_NONNULL(1);
-char *virKModUnload(const char *)
-    ATTRIBUTE_NONNULL(1);
-bool virKModIsBlacklisted(const char *)
-    ATTRIBUTE_NONNULL(1);
+char *virKModLoad(const char *, bool);
+char *virKModUnload(const char *);
+bool virKModIsBlacklisted(const char *);
 #endif /* __VIR_KMOD_H__ */
diff --git a/src/util/virlog.h b/src/util/virlog.h
index cc09f484afe9..c05da1e8d99f 100644
--- a/src/util/virlog.h
+++ b/src/util/virlog.h
@@ -223,20 +223,20 @@ virLogOutputPtr virLogOutputNew(virLogOutputFunc f,
                                 void *data,
                                 virLogPriority priority,
                                 virLogDestination dest,
-                                const char *name) ATTRIBUTE_NONNULL(1);
+                                const char *name);
 virLogFilterPtr virLogFilterNew(const char *match,
                                 virLogPriority priority,
-                                unsigned int flags) ATTRIBUTE_NONNULL(1);
+                                unsigned int flags);
 int virLogFindOutput(virLogOutputPtr *outputs, size_t noutputs,
                      virLogDestination dest, const void *opaque);
 int virLogDefineOutputs(virLogOutputPtr *outputs,
-                        size_t noutputs) ATTRIBUTE_NONNULL(1);
+                        size_t noutputs);
 int virLogDefineFilters(virLogFilterPtr *filters, size_t nfilters);
-virLogOutputPtr virLogParseOutput(const char *src) ATTRIBUTE_NONNULL(1);
-virLogFilterPtr virLogParseFilter(const char *src) ATTRIBUTE_NONNULL(1);
+virLogOutputPtr virLogParseOutput(const char *src);
+virLogFilterPtr virLogParseFilter(const char *src);
 int virLogParseOutputs(const char *src,
-                       virLogOutputPtr **outputs) ATTRIBUTE_NONNULL(1);
+                       virLogOutputPtr **outputs);
 int virLogParseFilters(const char *src,
-                       virLogFilterPtr **filters) ATTRIBUTE_NONNULL(1);
+                       virLogFilterPtr **filters);

 #endif
diff --git a/src/util/virmacaddr.h b/src/util/virmacaddr.h
index ae26867d4d33..f51415e01837 100644
--- a/src/util/virmacaddr.h
+++ b/src/util/virmacaddr.h
@@ -53,7 +53,7 @@ int virMacAddrParse(const char* str,
                     virMacAddrPtr addr) ATTRIBUTE_RETURN_CHECK;
 int virMacAddrParseHex(const char* str,
                        virMacAddrPtr addr)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 bool virMacAddrIsUnicast(const virMacAddr *addr);
 bool virMacAddrIsMulticast(const virMacAddr *addr);
 bool virMacAddrIsBroadcastRaw(const unsigned char s[VIR_MAC_BUFLEN]);
diff --git a/src/util/virnetdev.h b/src/util/virnetdev.h
index 437a776257b6..fa9a0aba85ee 100644
--- a/src/util/virnetdev.h
+++ b/src/util/virnetdev.h
@@ -117,87 +117,84 @@ int virNetDevSetupControl(const char *ifname,
     ATTRIBUTE_RETURN_CHECK;

 int virNetDevExists(const char *brname)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevSetOnline(const char *ifname,
                        bool online)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virNetDevGetOnline(const char *ifname,
                       bool *online)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;


 int virNetDevSetMAC(const char *ifname,
                     const virMacAddr *macaddr)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virNetDevGetMAC(const char *ifname,
                     virMacAddrPtr macaddr)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevReplaceMacAddress(const char *linkdev,
                                const virMacAddr *macaddress,
                                const char *stateDir)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
     ATTRIBUTE_RETURN_CHECK;

 int virNetDevRestoreMacAddress(const char *linkdev,
                                const char *stateDir)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevSetMTU(const char *ifname,
                     int mtu)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virNetDevSetMTUFromDevice(const char *ifname,
                               const char *otherifname)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virNetDevGetMTU(const char *ifname)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virNetDevSetNamespace(const char *ifname, pid_t pidInNs)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virNetDevSetName(const char *ifname, const char *newifname)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 char *virNetDevGetName(int ifindex)
     ATTRIBUTE_RETURN_CHECK;
 int virNetDevGetIndex(const char *ifname, int *ifindex)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevGetVLanID(const char *ifname, int *vlanid)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevGetMaster(const char *ifname, char **master)
-   ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+   ATTRIBUTE_RETURN_CHECK;

 int virNetDevValidateConfig(const char *ifname,
                             const virMacAddr *macaddr, int ifindex)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevIsVirtualFunction(const char *ifname)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevGetVirtualFunctionIndex(const char *pfname, const char *vfname,
                                      int *vf_index)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
     ATTRIBUTE_RETURN_CHECK;

 int virNetDevGetPhysicalFunction(const char *ifname, char **pfname)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevPFGetVF(const char *pfname, int vf, char **vfname)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevGetVirtualFunctions(const char *pfname,
                                  char ***vfname,
                                  virPCIDeviceAddressPtr **virt_fns,
                                  size_t *n_vfname,
                                  unsigned int *max_vfs)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
-    ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevSaveNetConfig(const char *linkdev, int vf,
                            const char *stateDir,
                            bool saveVlan)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int
 virNetDevReadNetConfig(const char *linkdev, int vf,
@@ -205,8 +202,7 @@ virNetDevReadNetConfig(const char *linkdev, int vf,
                        virMacAddrPtr *adminMAC,
                        virNetDevVlanPtr *vlan,
                        virMacAddrPtr *MAC)
-   ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4)
-   ATTRIBUTE_NONNULL(5) ATTRIBUTE_NONNULL(6) ATTRIBUTE_RETURN_CHECK;
+   ATTRIBUTE_RETURN_CHECK;

 int
 virNetDevSetNetConfig(const char *linkdev, int vf,
@@ -214,55 +210,52 @@ virNetDevSetNetConfig(const char *linkdev, int vf,
                       virNetDevVlanPtr vlan,
                       const virMacAddr *MAC,
                       bool setVLan)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevGetVirtualFunctionInfo(const char *vfname, char **pfname,
-                                    int *vf)
-    ATTRIBUTE_NONNULL(1);
+                                    int *vf);

 int virNetDevGetFeatures(const char *ifname,
                          virBitmapPtr *out)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevGetLinkInfo(const char *ifname,
-                         virNetDevIfLinkPtr lnk)
-    ATTRIBUTE_NONNULL(1);
+                         virNetDevIfLinkPtr lnk);

 virNetDevRxFilterPtr virNetDevRxFilterNew(void)
    ATTRIBUTE_RETURN_CHECK;
 void virNetDevRxFilterFree(virNetDevRxFilterPtr filter);
 int virNetDevGetRxFilter(const char *ifname,
                          virNetDevRxFilterPtr *filter)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevAddMulti(const char *ifname,
                       virMacAddrPtr macaddr)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virNetDevDelMulti(const char *ifname,
                       virMacAddrPtr macaddr)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevSetPromiscuous(const char *ifname, bool promiscuous)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virNetDevGetPromiscuous(const char *ifname, bool *promiscuous)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevSetRcvMulti(const char *ifname, bool receive)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virNetDevGetRcvMulti(const char *ifname, bool *receive)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevSetRcvAllMulti(const char *ifname, bool receive)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virNetDevGetRcvAllMulti(const char *ifname, bool *receive)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 # define SYSFS_NET_DIR "/sys/class/net/"
 # define SYSFS_INFINIBAND_DIR "/sys/class/infiniband/"
 int virNetDevSysfsFile(char **pf_sysfs_device_link,
                        const char *ifname,
                        const char *file)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
     ATTRIBUTE_RETURN_CHECK;

 int virNetDevRunEthernetScript(const char *ifname, const char *script);
diff --git a/src/util/virnetdevbandwidth.c b/src/util/virnetdevbandwidth.c
index 4e4ac617beb9..494719dd966c 100644
--- a/src/util/virnetdevbandwidth.c
+++ b/src/util/virnetdevbandwidth.c
@@ -97,7 +97,7 @@ virNetDevBandwidthCmdAddOptimalQuantum(virCommandPtr cmd,
  * Returns: 0 on success,
  *         -1 otherwise (with error reported).
  */
-static int ATTRIBUTE_NONNULL(1)
+static int
 virNetDevBandwidthManipulateFilter(const char *ifname,
                                    const virMacAddr *ifmac_ptr,
                                    unsigned int id,
diff --git a/src/util/virnetdevbandwidth.h b/src/util/virnetdevbandwidth.h
index 64f35372e484..c8c326cd818a 100644
--- a/src/util/virnetdevbandwidth.h
+++ b/src/util/virnetdevbandwidth.h
@@ -50,7 +50,7 @@ int virNetDevBandwidthSet(const char *ifname,
 int virNetDevBandwidthClear(const char *ifname);
 int virNetDevBandwidthCopy(virNetDevBandwidthPtr *dest,
                            const virNetDevBandwidth *src)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 bool virNetDevBandwidthEqual(virNetDevBandwidthPtr a, virNetDevBandwidthPtr b);

@@ -59,22 +59,20 @@ int virNetDevBandwidthPlug(const char *brname,
                            const virMacAddr *ifmac_ptr,
                            virNetDevBandwidthPtr bandwidth,
                            unsigned int id)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4)
     ATTRIBUTE_RETURN_CHECK;

 int virNetDevBandwidthUnplug(const char *brname,
                              unsigned int id)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevBandwidthUpdateRate(const char *ifname,
                                  unsigned int id,
                                  virNetDevBandwidthPtr bandwidth,
                                  unsigned long long new_rate)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevBandwidthUpdateFilter(const char *ifname,
                                    const virMacAddr *ifmac_ptr,
                                    unsigned int id)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
     ATTRIBUTE_RETURN_CHECK;
 #endif /* __VIR_NETDEV_BANDWIDTH_H__ */
diff --git a/src/util/virnetdevbridge.h b/src/util/virnetdevbridge.h
index 141f231c901f..44c9a8f4d251 100644
--- a/src/util/virnetdevbridge.h
+++ b/src/util/virnetdevbridge.h
@@ -27,56 +27,54 @@
 # include "virmacaddr.h"

 int virNetDevBridgeCreate(const char *brname)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virNetDevBridgeDelete(const char *brname)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevBridgeAddPort(const char *brname,
                            const char *ifname)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevBridgeRemovePort(const char *brname,
                               const char *ifname)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevBridgeSetSTPDelay(const char *brname,
                                int delay)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virNetDevBridgeGetSTPDelay(const char *brname,
                                int *delay)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virNetDevBridgeSetSTP(const char *brname,
                           bool enable)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virNetDevBridgeGetSTP(const char *brname,
                           bool *enable)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevBridgeSetVlanFiltering(const char *brname,
                                     bool enable)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virNetDevBridgeGetVlanFiltering(const char *brname,
                                     bool *enable)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevBridgePortGetLearning(const char *brname,
                                    const char *ifname,
                                    bool *enable)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
     ATTRIBUTE_RETURN_CHECK;
 int virNetDevBridgePortSetLearning(const char *brname,
                                    const char *ifname,
                                    bool enable)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virNetDevBridgePortGetUnicastFlood(const char *brname,
                                        const char *ifname,
                                        bool *enable)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
     ATTRIBUTE_RETURN_CHECK;
 int virNetDevBridgePortSetUnicastFlood(const char *brname,
                                        const char *ifname,
                                        bool enable)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 typedef enum {
     VIR_NETDEVBRIDGE_FDB_FLAG_ROUTER    = (1 << 0),
@@ -89,8 +87,8 @@ typedef enum {

 int virNetDevBridgeFDBAdd(const virMacAddr *mac, const char *ifname,
                           unsigned int flags)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virNetDevBridgeFDBDel(const virMacAddr *mac, const char *ifname,
                           unsigned int flags)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 #endif /* __VIR_NETDEV_BRIDGE_H__ */
diff --git a/src/util/virnetdevip.h b/src/util/virnetdevip.h
index cc466ca25969..3d66ddd6b644 100644
--- a/src/util/virnetdevip.h
+++ b/src/util/virnetdevip.h
@@ -67,22 +67,20 @@ int virNetDevIPAddrAdd(const char *ifname,
                        virSocketAddr *addr,
                        virSocketAddr *peer,
                        unsigned int prefix)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virNetDevIPRouteAdd(const char *ifname,
                         virSocketAddrPtr addr,
                         unsigned int prefix,
                         virSocketAddrPtr gateway,
                         unsigned int metric)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4)
     ATTRIBUTE_RETURN_CHECK;
 int virNetDevIPAddrDel(const char *ifname,
                        virSocketAddr *addr,
                        unsigned int prefix)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virNetDevIPAddrGet(const char *ifname, virSocketAddrPtr addr)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
-int virNetDevIPWaitDadFinish(virSocketAddrPtr *addrs, size_t count)
-    ATTRIBUTE_NONNULL(1);
+    ATTRIBUTE_RETURN_CHECK;
+int virNetDevIPWaitDadFinish(virSocketAddrPtr *addrs, size_t count);
 bool virNetDevIPCheckIPv6Forwarding(void);

 /* virNetDevIPRoute object */
diff --git a/src/util/virnetdevmacvlan.h b/src/util/virnetdevmacvlan.h
index c40f23ed2e9a..1fdd860042af 100644
--- a/src/util/virnetdevmacvlan.h
+++ b/src/util/virnetdevmacvlan.h
@@ -42,13 +42,13 @@ typedef enum {
 VIR_ENUM_DECL(virNetDevMacVLanMode)

 typedef enum {
-   VIR_NETDEV_MACVLAN_CREATE_NONE     = 0,
-   /* Create with a tap device */
-   VIR_NETDEV_MACVLAN_CREATE_WITH_TAP = 1 << 0,
-   /* Bring the interface up */
-   VIR_NETDEV_MACVLAN_CREATE_IFUP     = 1 << 1,
-   /* Enable VNET_HDR */
-   VIR_NETDEV_MACVLAN_VNET_HDR          = 1 << 2,
+    VIR_NETDEV_MACVLAN_CREATE_NONE     = 0,
+    /* Create with a tap device */
+    VIR_NETDEV_MACVLAN_CREATE_WITH_TAP = 1 << 0,
+    /* Bring the interface up */
+    VIR_NETDEV_MACVLAN_CREATE_IFUP     = 1 << 1,
+    /* Enable VNET_HDR */
+    VIR_NETDEV_MACVLAN_VNET_HDR          = 1 << 2,
 } virNetDevMacVLanCreateFlags;

 int virNetDevMacVLanReserveName(const char *name, bool quietfail);
@@ -60,11 +60,10 @@ int virNetDevMacVLanCreate(const char *ifname,
                            const char *srcdev,
                            uint32_t macvlan_mode,
                            int *retry)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4)
     ATTRIBUTE_RETURN_CHECK;

 int virNetDevMacVLanDelete(const char *ifname)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevMacVLanCreateWithVPortProfile(const char *ifname,
                                            const virMacAddr *macaddress,
@@ -79,8 +78,7 @@ int virNetDevMacVLanCreateWithVPortProfile(const char *ifname,
                                            int *tapfd,
                                            size_t tapfdSize,
                                            unsigned int flags)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(6)
-    ATTRIBUTE_NONNULL(8) ATTRIBUTE_NONNULL(10) ATTRIBUTE_RETURN_CHECK;
+ATTRIBUTE_RETURN_CHECK;

 int virNetDevMacVLanDeleteWithVPortProfile(const char *ifname,
                                            const virMacAddr *macaddress,
@@ -88,8 +86,7 @@ int virNetDevMacVLanDeleteWithVPortProfile(const char *ifname,
                                            int mode,
                                            virNetDevVPortProfilePtr virtPortProfile,
                                            char *stateDir)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
-    ATTRIBUTE_NONNULL(6) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevMacVLanRestartWithVPortProfile(const char *cr_ifname,
                                             const virMacAddr *macaddress,
@@ -97,8 +94,7 @@ int virNetDevMacVLanRestartWithVPortProfile(const char *cr_ifname,
                                             const unsigned char *vmuuid,
                                             virNetDevVPortProfilePtr virtPortProfile,
                                             virNetDevVPortProfileOp vmOp)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
-    ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevMacVLanVPortProfileRegisterCallback(const char *ifname,
                                                  const virMacAddr *macaddress,
@@ -106,6 +102,5 @@ int virNetDevMacVLanVPortProfileRegisterCallback(const char *ifname,
                                                  const unsigned char *vmuuid,
                                                  virNetDevVPortProfilePtr virtPortProfile,
                                                  virNetDevVPortProfileOp vmOp)
-ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
-ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
+ATTRIBUTE_RETURN_CHECK;
 #endif /* __UTIL_MACVTAP_H__ */
diff --git a/src/util/virnetdevmidonet.h b/src/util/virnetdevmidonet.h
index 3bfc1f6e6790..7e5878e56bfe 100644
--- a/src/util/virnetdevmidonet.h
+++ b/src/util/virnetdevmidonet.h
@@ -28,9 +28,9 @@

 int virNetDevMidonetBindPort(const char *ifname,
                              virNetDevVPortProfilePtr virtualport)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevMidonetUnbindPort(virNetDevVPortProfilePtr virtualport)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 #endif /* __VIR_NETDEV_MIDONET_H__ */
diff --git a/src/util/virnetdevopenvswitch.h b/src/util/virnetdevopenvswitch.h
index 7380a2d84bc3..52d1abd683f7 100644
--- a/src/util/virnetdevopenvswitch.h
+++ b/src/util/virnetdevopenvswitch.h
@@ -41,24 +41,23 @@ int virNetDevOpenvswitchAddPort(const char *brname,
                                 const unsigned char *vmuuid,
                                 virNetDevVPortProfilePtr ovsport,
                                 virNetDevVlanPtr virtVlan)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
     ATTRIBUTE_RETURN_CHECK;

 int virNetDevOpenvswitchRemovePort(const char *brname, const char *ifname)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevOpenvswitchGetMigrateData(char **migrate, const char *ifname)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevOpenvswitchSetMigrateData(char *migrate, const char *ifname)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevOpenvswitchInterfaceStats(const char *ifname,
                                        virDomainInterfaceStatsPtr stats)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevOpenvswitchGetVhostuserIfname(const char *path,
                                            char **ifname)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 #endif /* __VIR_NETDEV_OPENVSWITCH_H__ */
diff --git a/src/util/virnetdevtap.h b/src/util/virnetdevtap.h
index 6bb3b8891c21..25f070231ac8 100644
--- a/src/util/virnetdevtap.h
+++ b/src/util/virnetdevtap.h
@@ -38,17 +38,17 @@ int virNetDevTapCreate(char **ifname,
                        int *tapfd,
                        size_t tapfdSize,
                        unsigned int flags)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevTapDelete(const char *ifname,
                        const char *tunpath)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevTapGetName(int tapfd, char **ifname)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 char* virNetDevTapGetRealDeviceName(char *ifname)
-      ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+      ATTRIBUTE_RETURN_CHECK;

 typedef enum {
    VIR_NETDEV_TAP_CREATE_NONE = 0,
@@ -71,7 +71,6 @@ virNetDevTapAttachBridge(const char *tapname,
                          virNetDevVlanPtr virtVlan,
                          unsigned int mtu,
                          unsigned int *actualMTU)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
     ATTRIBUTE_RETURN_CHECK;

 int virNetDevTapCreateInBridgePort(const char *brname,
@@ -86,11 +85,10 @@ int virNetDevTapCreateInBridgePort(const char *brname,
                                    unsigned int mtu,
                                    unsigned int *actualMTU,
                                    unsigned int flags)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
     ATTRIBUTE_RETURN_CHECK;

 int virNetDevTapInterfaceStats(const char *ifname,
                                virDomainInterfaceStatsPtr stats)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 #endif /* __VIR_NETDEV_TAP_H__ */
diff --git a/src/util/virnetdevveth.h b/src/util/virnetdevveth.h
index 4c220c1b02bc..0892bae1f093 100644
--- a/src/util/virnetdevveth.h
+++ b/src/util/virnetdevveth.h
@@ -28,8 +28,8 @@

 /* Function declarations */
 int virNetDevVethCreate(char **veth1, char **veth2)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virNetDevVethDelete(const char *veth)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 #endif /* __VIR_NETDEV_VETH_H__ */
diff --git a/src/util/virnetdevvportprofile.h b/src/util/virnetdevvportprofile.h
index b706c411934e..f509e6b723d3 100644
--- a/src/util/virnetdevvportprofile.h
+++ b/src/util/virnetdevvportprofile.h
@@ -101,7 +101,7 @@ int virNetDevVPortProfileAssociate(const char *ifname,
                                    const unsigned char *vmuuid,
                                    virNetDevVPortProfileOp vmOp,
                                    bool setlink_only)
-    ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virNetDevVPortProfileDisassociate(const char *ifname,
                                       const virNetDevVPortProfile *virtPort,
@@ -109,7 +109,7 @@ int virNetDevVPortProfileDisassociate(const char *ifname,
                                       const char *linkdev,
                                       int vf,
                                       virNetDevVPortProfileOp vmOp)
-    ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;


 #endif /* __VIR_NETDEV_VPORT_PROFILE_H__ */
diff --git a/src/util/virnuma.h b/src/util/virnuma.h
index f3eef324a497..6357d4dcc12a 100644
--- a/src/util/virnuma.h
+++ b/src/util/virnuma.h
@@ -58,8 +58,7 @@ int virNumaGetPages(int node,
                     unsigned int **pages_size,
                     unsigned int **pages_avail,
                     unsigned int **pages_free,
-                    size_t *npages)
-    ATTRIBUTE_NONNULL(5);
+                    size_t *npages);
 int virNumaSetPagePoolSize(int node,
                            unsigned int page_size,
                            unsigned long long page_count,
diff --git a/src/util/virobject.h b/src/util/virobject.h
index c3ecc1ef672a..d651b1c76eb1 100644
--- a/src/util/virobject.h
+++ b/src/util/virobject.h
@@ -63,41 +63,30 @@ struct _virObjectLockable {
 virClassPtr virClassForObject(void);
 virClassPtr virClassForObjectLockable(void);

-# ifndef VIR_PARENT_REQUIRED
-#  define VIR_PARENT_REQUIRED ATTRIBUTE_NONNULL(1)
-# endif
 virClassPtr virClassNew(virClassPtr parent,
                         const char *name,
                         size_t objectSize,
-                        virObjectDisposeCallback dispose)
-    VIR_PARENT_REQUIRED ATTRIBUTE_NONNULL(2);
+                        virObjectDisposeCallback dispose);

-const char *virClassName(virClassPtr klass)
-    ATTRIBUTE_NONNULL(1);
+const char *virClassName(virClassPtr klass);

 bool virClassIsDerivedFrom(virClassPtr klass,
-                           virClassPtr parent)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                           virClassPtr parent);

-void *virObjectNew(virClassPtr klass)
-    ATTRIBUTE_NONNULL(1);
+void *virObjectNew(virClassPtr klass);
 bool virObjectUnref(void *obj);
 void *virObjectRef(void *obj);

 bool virObjectIsClass(void *obj,
-                      virClassPtr klass)
-    ATTRIBUTE_NONNULL(2);
+                      virClassPtr klass);

 void virObjectFreeCallback(void *opaque);
 void virObjectFreeHashData(void *opaque, const void *name);

-void *virObjectLockableNew(virClassPtr klass)
-    ATTRIBUTE_NONNULL(1);
+void *virObjectLockableNew(virClassPtr klass);

-void virObjectLock(void *lockableobj)
-    ATTRIBUTE_NONNULL(1);
-void virObjectUnlock(void *lockableobj)
-    ATTRIBUTE_NONNULL(1);
+void virObjectLock(void *lockableobj);
+void virObjectUnlock(void *lockableobj);

 void virObjectListFree(void *list);
 void virObjectListFreeCount(void *list, size_t count);
diff --git a/src/util/virpci.h b/src/util/virpci.h
index 8637c2c68513..3d01e9ca9ca7 100644
--- a/src/util/virpci.h
+++ b/src/util/virpci.h
@@ -217,7 +217,7 @@ int virPCIGetAddrString(unsigned int domain,
                         unsigned int slot,
                         unsigned int function,
                         char **pciConfigAddr)
-    ATTRIBUTE_NONNULL(5) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virPCIDeviceAddressParse(char *address, virPCIDeviceAddressPtr bdf);

diff --git a/src/util/virpidfile.h b/src/util/virpidfile.h
index eb6516ca1503..4c4b9ab1825d 100644
--- a/src/util/virpidfile.h
+++ b/src/util/virpidfile.h
@@ -74,6 +74,6 @@ int virPidFileConstructPath(bool privileged,
                             const char *progname,
                             char **pidfile);

-int virPidFileForceCleanupPath(const char *path) ATTRIBUTE_NONNULL(1);
+int virPidFileForceCleanupPath(const char *path);

 #endif /* __VIR_PIDFILE_H__ */
diff --git a/src/util/virqemu.h b/src/util/virqemu.h
index 10aeb67f4ecc..d8e77e59fe28 100644
--- a/src/util/virqemu.h
+++ b/src/util/virqemu.h
@@ -53,7 +53,6 @@ void virQEMUBuildBufferEscapeComma(virBufferPtr buf, const char *str);
 void virQEMUBuildBufferEscape(virBufferPtr buf, const char *str);
 void virQEMUBuildLuksOpts(virBufferPtr buf,
                           virStorageEncryptionInfoDefPtr enc,
-                          const char *alias)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                          const char *alias);

 #endif /* __VIR_QEMU_H_ */
diff --git a/src/util/virrandom.h b/src/util/virrandom.h
index f457d2de66cd..1744fa5b6e6f 100644
--- a/src/util/virrandom.h
+++ b/src/util/virrandom.h
@@ -28,7 +28,7 @@ uint64_t virRandomBits(int nbits);
 double virRandom(void);
 uint32_t virRandomInt(uint32_t max);
 int virRandomBytes(unsigned char *buf, size_t buflen)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virRandomGenerateWWN(char **wwn, const char *virt_type);

 #endif /* __VIR_RANDOM_H__ */
diff --git a/src/util/virscsihost.h b/src/util/virscsihost.h
index c35ccb9f501d..7e1095da13be 100644
--- a/src/util/virscsihost.h
+++ b/src/util/virscsihost.h
@@ -28,8 +28,7 @@ char *virSCSIHostFindByPCI(const char *sysfs_prefix,
                            unsigned int unique_id);

 int virSCSIHostGetNumber(const char *adapter_name,
-                         unsigned int *result)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                         unsigned int *result);

 char *virSCSIHostGetNameByParentaddr(unsigned int domain,
                                      unsigned int bus,
diff --git a/src/util/virseclabel.h b/src/util/virseclabel.h
index 94c4dfc39634..5b13d13fde0a 100644
--- a/src/util/virseclabel.h
+++ b/src/util/virseclabel.h
@@ -62,8 +62,7 @@ virSecurityDeviceLabelDefPtr
 virSecurityDeviceLabelDefNew(const char *model);

 virSecurityDeviceLabelDefPtr
-virSecurityDeviceLabelDefCopy(const virSecurityDeviceLabelDef *src)
-    ATTRIBUTE_NONNULL(1);
+virSecurityDeviceLabelDefCopy(const virSecurityDeviceLabelDef *src);

 void virSecurityLabelDefFree(virSecurityLabelDefPtr def);
 void virSecurityDeviceLabelDefFree(virSecurityDeviceLabelDefPtr def);
diff --git a/src/util/virsocketaddr.h b/src/util/virsocketaddr.h
index 43a370620e71..0c4d456ebf4e 100644
--- a/src/util/virsocketaddr.h
+++ b/src/util/virsocketaddr.h
@@ -142,7 +142,6 @@ bool virSocketAddrIsNumericLocalhost(const char *addr);

 int virSocketAddrPTRDomain(const virSocketAddr *addr,
                            unsigned int prefix,
-                           char **ptr)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
+                           char **ptr);

 #endif /* __VIR_SOCKETADDR_H__ */
diff --git a/src/util/virstorageencryption.h b/src/util/virstorageencryption.h
index fa439fb7237a..564e89ae9f62 100644
--- a/src/util/virstorageencryption.h
+++ b/src/util/virstorageencryption.h
@@ -77,8 +77,7 @@ struct _virStorageEncryption {
     virStorageEncryptionInfoDef encinfo;
 };

-virStorageEncryptionPtr virStorageEncryptionCopy(const virStorageEncryption *src)
-    ATTRIBUTE_NONNULL(1);
+virStorageEncryptionPtr virStorageEncryptionCopy(const virStorageEncryption *src);

 void virStorageEncryptionFree(virStorageEncryptionPtr enc);

diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index 9ebfc1108141..a4a492db30d3 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -292,8 +292,7 @@ int virStorageFileProbeFormat(const char *path, uid_t uid, gid_t gid);
 int virStorageFileGetMetadataInternal(virStorageSourcePtr meta,
                                       char *buf,
                                       size_t len,
-                                      int *backingFormat)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(4);
+                                      int *backingFormat);

 virStorageSourcePtr virStorageFileGetMetadataFromFD(const char *path,
                                                     int fd,
@@ -303,27 +302,23 @@ virStorageSourcePtr virStorageFileGetMetadataFromBuf(const char *path,
                                                      char *buf,
                                                      size_t len,
                                                      int format,
-                                                     int *backingFormat)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                                                     int *backingFormat);
 int virStorageFileChainGetBroken(virStorageSourcePtr chain,
                                  char **broken_file);

 int virStorageFileParseChainIndex(const char *diskTarget,
                                   const char *name,
-                                  unsigned int *chainIndex)
-    ATTRIBUTE_NONNULL(3);
+                                  unsigned int *chainIndex);

 int virStorageFileParseBackingStoreStr(const char *str,
                                        char **target,
-                                       unsigned int *chainIndex)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
+                                       unsigned int *chainIndex);

 virStorageSourcePtr virStorageFileChainLookup(virStorageSourcePtr chain,
                                               virStorageSourcePtr startFrom,
                                               const char *name,
                                               unsigned int idx,
-                                              virStorageSourcePtr *parent)
-    ATTRIBUTE_NONNULL(1);
+                                              virStorageSourcePtr *parent);

 int virStorageFileResize(const char *path,
                          unsigned long long capacity,
@@ -373,12 +368,10 @@ int virStorageSourceUpdateCapacity(virStorageSourcePtr src,

 virStorageSourcePtr virStorageSourceNewFromBacking(virStorageSourcePtr parent);
 virStorageSourcePtr virStorageSourceCopy(const virStorageSource *src,
-                                         bool backingChain)
-    ATTRIBUTE_NONNULL(1);
+                                         bool backingChain);

 int virStorageSourceParseRBDColonString(const char *rbdstr,
-                                        virStorageSourcePtr src)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                                        virStorageSourcePtr src);

 typedef int
 (*virStorageFileSimplifyPathReadlinkCallback)(const char *path,
@@ -390,8 +383,7 @@ char *virStorageFileCanonicalizePath(const char *path,

 int virStorageFileGetRelativeBackingPath(virStorageSourcePtr from,
                                          virStorageSourcePtr to,
-                                         char **relpath)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                                         char **relpath);

 int virStorageFileCheckCompat(const char *compat);

@@ -402,7 +394,6 @@ bool virStorageSourceIsRelative(virStorageSourcePtr src);
 virStorageSourcePtr
 virStorageSourceFindByNodeName(virStorageSourcePtr top,
                                const char *nodeName,
-                               unsigned int *index)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                               unsigned int *index);

 #endif /* __VIR_STORAGE_FILE_H__ */
diff --git a/src/util/virstring.h b/src/util/virstring.h
index a5550e30d2e2..5cc2d73d8711 100644
--- a/src/util/virstring.h
+++ b/src/util/virstring.h
@@ -29,17 +29,14 @@
 char **virStringSplitCount(const char *string,
                            const char *delim,
                            size_t max_tokens,
-                           size_t *tokcount)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                           size_t *tokcount);

 char **virStringSplit(const char *string,
                       const char *delim,
-                      size_t max_tokens)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                      size_t max_tokens);

 char *virStringListJoin(const char **strings,
-                        const char *delim)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                        const char *delim);

 char **virStringListAdd(const char **strings,
                         const char *item);
@@ -53,8 +50,7 @@ void virStringListFreeCount(char **strings,
 bool virStringListHasString(const char **strings,
                             const char *needle);
 char *virStringListGetFirstWithPrefix(char **strings,
-                                      const char *prefix)
-    ATTRIBUTE_NONNULL(2);
+                                      const char *prefix);

 char *virArgvToString(const char *const *argv);

@@ -109,11 +105,10 @@ int virStrToDouble(char const *s,
                    double *result)
     ATTRIBUTE_RETURN_CHECK;

-void virSkipSpaces(const char **str) ATTRIBUTE_NONNULL(1);
-void virSkipSpacesAndBackslash(const char **str) ATTRIBUTE_NONNULL(1);
-void virTrimSpaces(char *str, char **endp) ATTRIBUTE_NONNULL(1);
-void virSkipSpacesBackwards(const char *str, char **endp)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+void virSkipSpaces(const char **str);
+void virSkipSpacesAndBackslash(const char **str);
+void virTrimSpaces(char *str, char **endp);
+void virSkipSpacesBackwards(const char *str, char **endp);

 bool virStringIsEmpty(const char *str);

@@ -126,21 +121,19 @@ char *virStrcpy(char *dest, const char *src, size_t destbytes)
 /* Don't call these directly - use the macros below */
 int virStrdup(char **dest, const char *src, bool report, int domcode,
               const char *filename, const char *funcname, size_t linenr)
-    ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1);
+    ATTRIBUTE_RETURN_CHECK;

 int virStrndup(char **dest, const char *src, ssize_t n, bool report, int domcode,
                const char *filename, const char *funcname, size_t linenr)
-    ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1);
+    ATTRIBUTE_RETURN_CHECK;
 int virAsprintfInternal(bool report, int domcode, const char *filename,
                         const char *funcname, size_t linenr, char **strp,
                         const char *fmt, ...)
-    ATTRIBUTE_NONNULL(6) ATTRIBUTE_NONNULL(7) ATTRIBUTE_FMT_PRINTF(7, 8)
-    ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_FMT_PRINTF(7, 8) ATTRIBUTE_RETURN_CHECK;
 int virVasprintfInternal(bool report, int domcode, const char *filename,
                          const char *funcname, size_t linenr, char **strp,
                          const char *fmt, va_list list)
-    ATTRIBUTE_NONNULL(6) ATTRIBUTE_NONNULL(7) ATTRIBUTE_FMT_PRINTF(7, 0)
-    ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_FMT_PRINTF(7, 0) ATTRIBUTE_RETURN_CHECK;

 /**
  * VIR_STRDUP:
@@ -271,13 +264,11 @@ int virStringToUpper(char **dst, const char *src);
 ssize_t virStringSearch(const char *str,
                         const char *regexp,
                         size_t max_results,
-                        char ***matches)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(4);
+                        char ***matches);

 char *virStringReplace(const char *haystack,
                        const char *oldneedle,
-                       const char *newneedle)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                       const char *newneedle);

 void virStringStripIPv6Brackets(char *str);
 bool virStringHasControlChars(const char *str);
diff --git a/src/util/virsysinfo.h b/src/util/virsysinfo.h
index 1e51d2cafa7e..70f4b3ae96f3 100644
--- a/src/util/virsysinfo.h
+++ b/src/util/virsysinfo.h
@@ -123,8 +123,7 @@ void virSysinfoSystemDefFree(virSysinfoSystemDefPtr def);
 void virSysinfoBaseBoardDefClear(virSysinfoBaseBoardDefPtr def);
 void virSysinfoDefFree(virSysinfoDefPtr def);

-int virSysinfoFormat(virBufferPtr buf, virSysinfoDefPtr def)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+int virSysinfoFormat(virBufferPtr buf, virSysinfoDefPtr def);

 bool virSysinfoIsEqual(virSysinfoDefPtr src,
                        virSysinfoDefPtr dst);
diff --git a/src/util/virthread.h b/src/util/virthread.h
index e466d9bf0184..a3f677ccefa6 100644
--- a/src/util/virthread.h
+++ b/src/util/virthread.h
@@ -125,7 +125,7 @@ unsigned long long virThreadID(virThreadPtr thread);
  * }
  */
 int virOnce(virOnceControlPtr once, virOnceFunc init)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virMutexInit(virMutexPtr m) ATTRIBUTE_RETURN_CHECK;
 int virMutexInitRecursive(virMutexPtr m) ATTRIBUTE_RETURN_CHECK;
diff --git a/src/util/virthreadpool.h b/src/util/virthreadpool.h
index e1f362f5bb60..c3a91ea910fd 100644
--- a/src/util/virthreadpool.h
+++ b/src/util/virthreadpool.h
@@ -41,7 +41,7 @@ virThreadPoolPtr virThreadPoolNewFull(size_t minWorkers,
                                       size_t prioWorkers,
                                       virThreadPoolJobFunc func,
                                       const char *funcName,
-                                      void *opaque) ATTRIBUTE_NONNULL(4);
+                                      void *opaque);

 size_t virThreadPoolGetMinWorkers(virThreadPoolPtr pool);
 size_t virThreadPoolGetMaxWorkers(virThreadPoolPtr pool);
@@ -54,8 +54,7 @@ void virThreadPoolFree(virThreadPoolPtr pool);

 int virThreadPoolSendJob(virThreadPoolPtr pool,
                          unsigned int priority,
-                         void *jobdata) ATTRIBUTE_NONNULL(1)
-                                        ATTRIBUTE_RETURN_CHECK;
+                         void *jobdata) ATTRIBUTE_RETURN_CHECK;

 int virThreadPoolSetParameters(virThreadPoolPtr pool,
                                long long int minWorkers,
diff --git a/src/util/virtime.h b/src/util/virtime.h
index fbcd3ba66768..3492f30211fa 100644
--- a/src/util/virtime.h
+++ b/src/util/virtime.h
@@ -37,32 +37,31 @@
     (4 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 3 + 5 + 1)
 /*   Yr      Mon     Day     Hour    Min     Sec     Ms  TZ  NULL */

-void virTimeFieldsThen(unsigned long long when, struct tm *fields)
-    ATTRIBUTE_NONNULL(2);
+void virTimeFieldsThen(unsigned long long when, struct tm *fields);

 /* These APIs are async signal safe and return -1, setting
  * errno on failure */
 int virTimeMillisNowRaw(unsigned long long *now)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virTimeFieldsNowRaw(struct tm *fields)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virTimeStringNowRaw(char *buf)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virTimeStringThenRaw(unsigned long long when, char *buf)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 /* These APIs are *not* async signal safe and return -1,
  * raising a libvirt error on failure
  */
 int virTimeMillisNow(unsigned long long *now)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int virTimeFieldsNow(struct tm *fields)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 char *virTimeStringNow(void);
 char *virTimeStringThen(unsigned long long when);

 int virTimeLocalOffsetFromUTC(long *offset)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 typedef struct {
     unsigned long long start_t;
diff --git a/src/util/viruri.h b/src/util/viruri.h
index 1e53abb0bc21..553cb7bbd971 100644
--- a/src/util/viruri.h
+++ b/src/util/viruri.h
@@ -52,10 +52,8 @@ struct _virURI {
     virURIParamPtr params;
 };

-virURIPtr virURIParse(const char *uri)
-    ATTRIBUTE_NONNULL(1);
-char *virURIFormat(virURIPtr uri)
-    ATTRIBUTE_NONNULL(1);
+virURIPtr virURIParse(const char *uri);
+char *virURIFormat(virURIPtr uri);

 char *virURIFormatParams(virURIPtr uri);

diff --git a/src/util/virutil.h b/src/util/virutil.h
index e097b77212fc..46a3339f4a01 100644
--- a/src/util/virutil.h
+++ b/src/util/virutil.h
@@ -55,7 +55,7 @@ void virWaitForDevices(void);

 int virScaleInteger(unsigned long long *value, const char *suffix,
                     unsigned long long scale, unsigned long long limit)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virHexToBin(unsigned char c);

@@ -64,10 +64,10 @@ int virParseVersionString(const char *str, unsigned long *version,
                           bool allowMissing);

 int virDoubleToStr(char **strp, double number)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 char *virFormatIntDecimal(char *buf, size_t buflen, int val)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 int virDiskNameParse(const char *name, int *disk, int *partition);
 int virDiskNameToIndex(const char* str);
@@ -144,14 +144,13 @@ char *virGetUserRuntimeDirectory(void);
 char *virGetUserShell(uid_t uid);
 char *virGetUserName(uid_t uid);
 char *virGetGroupName(gid_t gid);
-int virGetGroupList(uid_t uid, gid_t group, gid_t **groups)
-    ATTRIBUTE_NONNULL(3);
+int virGetGroupList(uid_t uid, gid_t group, gid_t **groups);
 int virGetUserID(const char *name,
                  uid_t *uid) ATTRIBUTE_RETURN_CHECK;
 int virGetGroupID(const char *name,
                   gid_t *gid) ATTRIBUTE_RETURN_CHECK;

-bool virIsDevMapperDevice(const char *dev_name) ATTRIBUTE_NONNULL(1);
+bool virIsDevMapperDevice(const char *dev_name);

 bool virValidateWWN(const char *wwn);

diff --git a/src/util/viruuid.h b/src/util/viruuid.h
index 5790a173648e..d60754d810f0 100644
--- a/src/util/viruuid.h
+++ b/src/util/viruuid.h
@@ -45,7 +45,7 @@


 int virSetHostUUIDStr(const char *host_uuid);
-int virGetHostUUID(unsigned char *host_uuid) ATTRIBUTE_NONNULL(1);
+int virGetHostUUID(unsigned char *host_uuid);

 int virUUIDIsValid(unsigned char *uuid);

@@ -53,9 +53,9 @@ int virUUIDGenerate(unsigned char *uuid);

 int virUUIDParse(const char *uuidstr,
                  unsigned char *uuid)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 const char *virUUIDFormat(const unsigned char *uuid,
-                          char *uuidstr) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+                          char *uuidstr);

 #endif /* __VIR_UUID_H__ */
diff --git a/src/util/virvhba.h b/src/util/virvhba.h
index 67b1fa5376a0..46a2e8d38cfd 100644
--- a/src/util/virvhba.h
+++ b/src/util/virvhba.h
@@ -35,8 +35,7 @@ virVHBAIsVportCapable(const char *sysfs_prefix, int host);
 char *
 virVHBAGetConfig(const char *sysfs_prefix,
                  int host,
-                 const char *entry)
-    ATTRIBUTE_NONNULL(3);
+                 const char *entry);

 char *
 virVHBAFindVportHost(const char *sysfs_prefix);
@@ -45,18 +44,15 @@ int
 virVHBAManageVport(const int parent_host,
                    const char *wwpn,
                    const char *wwnn,
-                   int operation)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                   int operation);

 char *
 virVHBAGetHostByWWN(const char *sysfs_prefix,
                     const char *wwnn,
-                    const char *wwpn)
-    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
+                    const char *wwpn);

 char *
 virVHBAGetHostByFabricWWN(const char *sysfs_prefix,
-                          const char *fabric_wwn)
-    ATTRIBUTE_NONNULL(2);
+                          const char *fabric_wwn);

 #endif /* __VIR_VBHA_H__ */
diff --git a/src/vz/vz_utils.h b/src/vz/vz_utils.h
index ea2e2da684cf..66435e594584 100644
--- a/src/vz/vz_utils.h
+++ b/src/vz/vz_utils.h
@@ -123,7 +123,7 @@ virDomainObjPtr vzDomObjFromDomain(virDomainPtr domain);
 virDomainObjPtr vzDomObjFromDomainRef(virDomainPtr domain);

 char * vzGetOutput(const char *binary, ...)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_SENTINEL;
+    ATTRIBUTE_SENTINEL;

 vzDriverPtr
 vzGetDriverConnection(void);
diff --git a/src/xen/xen_hypervisor.h b/src/xen/xen_hypervisor.h
index f59847ff144c..04636bed84f0 100644
--- a/src/xen/xen_hypervisor.h
+++ b/src/xen/xen_hypervisor.h
@@ -73,64 +73,53 @@ int     xenHypervisorGetMaxVcpus        (virConnectPtr conn,
                                          const char *type);
 int     xenHypervisorGetDomainInfo        (virConnectPtr conn,
                                            virDomainDefPtr def,
-                                           virDomainInfoPtr info)
-          ATTRIBUTE_NONNULL (1);
+                                           virDomainInfoPtr info);
 int     xenHypervisorGetDomainState     (virConnectPtr conn,
                                          virDomainDefPtr def,
                                          int *state,
-                                         int *reason)
-          ATTRIBUTE_NONNULL (1);
+                                         int *reason);
 int     xenHypervisorGetDomInfo         (virConnectPtr conn,
                                          int id,
                                          virDomainInfoPtr info);
 int     xenHypervisorSetMaxMemory       (virConnectPtr conn,
                                          virDomainDefPtr def,
-                                         unsigned long memory)
-          ATTRIBUTE_NONNULL (1);
+                                         unsigned long memory);
 int     xenHypervisorCheckID            (virConnectPtr conn,
                                          int id);
 int     xenHypervisorPinVcpu            (virConnectPtr conn,
                                          virDomainDefPtr def,
                                          unsigned int vcpu,
                                          unsigned char *cpumap,
-                                         int maplen)
-          ATTRIBUTE_NONNULL (1);
+                                         int maplen);
 int     xenHypervisorGetVcpus           (virConnectPtr conn,
                                          virDomainDefPtr def,
                                          virVcpuInfoPtr info,
                                          int maxinfo,
                                          unsigned char *cpumaps,
-                                         int maplen)
-          ATTRIBUTE_NONNULL (1);
+                                         int maplen);
 int     xenHypervisorGetVcpuMax         (virConnectPtr conn,
-                                         virDomainDefPtr def)
-          ATTRIBUTE_NONNULL (1);
+                                         virDomainDefPtr def);

 char *  xenHypervisorGetSchedulerType   (virConnectPtr conn,
-                                         int *nparams)
-          ATTRIBUTE_NONNULL (1);
+                                         int *nparams);

 int     xenHypervisorGetSchedulerParameters(virConnectPtr conn,
                                             virDomainDefPtr def,
                                             virTypedParameterPtr params,
-                                            int *nparams)
-          ATTRIBUTE_NONNULL (1);
+                                            int *nparams);

 int     xenHypervisorSetSchedulerParameters(virConnectPtr conn,
                                             virDomainDefPtr def,
                                             virTypedParameterPtr params,
-                                            int nparams)
-          ATTRIBUTE_NONNULL (1);
+                                            int nparams);

 int     xenHypervisorDomainBlockStats   (virConnectPtr conn,
                                          virDomainDefPtr def,
                                          const char *path,
-                                         virDomainBlockStatsPtr stats)
-          ATTRIBUTE_NONNULL (1);
+                                         virDomainBlockStatsPtr stats);
 int     xenHypervisorDomainInterfaceStats (virDomainDefPtr def,
                                            const char *path,
-                                           virDomainInterfaceStatsPtr stats)
-          ATTRIBUTE_NONNULL (1);
+                                           virDomainInterfaceStatsPtr stats);

 int     xenHypervisorNodeGetCellsFreeMemory(virConnectPtr conn,
                                           unsigned long long *freeMems,
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index 605c3cdccf2a..23aca667e5e5 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -275,7 +275,7 @@ istartswith(const char *haystack, const char *needle)
  * Returns the HTTP return code and @content is set to the
  * allocated memory containing HTTP content.
  */
-static int ATTRIBUTE_NONNULL(2)
+static int
 xend_req(int fd, char **content)
 {
     char *buffer;
@@ -344,7 +344,7 @@ xend_req(int fd, char **content)
  *
  * Returns the HTTP return code or -1 in case or error.
  */
-static int ATTRIBUTE_NONNULL(3)
+static int
 xend_get(virConnectPtr xend, const char *path, char **content)
 {
     int ret;
@@ -873,7 +873,6 @@ xenDaemonDomainLookupByName_ids(virConnectPtr xend,
  * Returns domain's state.
  */
 static int
-ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
 sexpr_to_xend_domain_state(virDomainDefPtr def, const struct sexpr *root)
 {
     const char *flags;
diff --git a/tools/virsh-domain-monitor.h b/tools/virsh-domain-monitor.h
index 08ccab59029a..3aad579afbb0 100644
--- a/tools/virsh-domain-monitor.h
+++ b/tools/virsh-domain-monitor.h
@@ -30,7 +30,7 @@

 char *virshGetDomainDescription(vshControl *ctl, virDomainPtr dom,
                                 bool title, unsigned int flags)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;

 extern const vshCmdDef domMonitoringCmds[];

diff --git a/tools/vsh.c b/tools/vsh.c
index d2024be9188a..0c25c21d91e9 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -1577,7 +1577,7 @@ vshCommandParse(vshControl *ctl, vshCommandParser *parser)
  * --------------------
  */

-static vshCommandToken ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
+static vshCommandToken
 vshCommandArgvGetArg(vshControl *ctl, vshCommandParser *parser, char **res,
                      bool report ATTRIBUTE_UNUSED)
 {
@@ -1610,7 +1610,7 @@ vshCommandArgvParse(vshControl *ctl, int nargs, char **argv)
  * ----------------------
  */

-static vshCommandToken ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
+static vshCommandToken
 vshCommandStringGetArg(vshControl *ctl, vshCommandParser *parser, char **res,
                        bool report)
 {
diff --git a/tools/vsh.h b/tools/vsh.h
index 8f5d1a69f712..d9edeab7a7e9 100644
--- a/tools/vsh.h
+++ b/tools/vsh.h
@@ -259,40 +259,38 @@ const vshCmdGrp *vshCmdGrpSearch(const char *grpname);
 bool vshCmdGrpHelp(vshControl *ctl, const char *name);

 int vshCommandOptInt(vshControl *ctl, const vshCmd *cmd,
-                     const char *name, int *value)
-    ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
+                     const char *name, int *value);
 int vshCommandOptUInt(vshControl *ctl, const vshCmd *cmd,
                       const char *name, unsigned int *value)
-    ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int vshCommandOptUIntWrap(vshControl *ctl, const vshCmd *cmd,
                           const char *name, unsigned int *value)
-    ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int vshCommandOptUL(vshControl *ctl, const vshCmd *cmd,
                     const char *name, unsigned long *value)
-    ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int vshCommandOptULWrap(vshControl *ctl, const vshCmd *cmd,
                         const char *name, unsigned long *value)
-    ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int vshCommandOptStringQuiet(vshControl *ctl, const vshCmd *cmd,
                              const char *name, const char **value)
-    ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int vshCommandOptStringReq(vshControl *ctl, const vshCmd *cmd,
                            const char *name, const char **value)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
-    ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int vshCommandOptLongLong(vshControl *ctl, const vshCmd *cmd,
                           const char *name, long long *value)
-    ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int vshCommandOptULongLong(vshControl *ctl, const vshCmd *cmd,
                            const char *name, unsigned long long *value)
-    ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int vshCommandOptULongLongWrap(vshControl *ctl, const vshCmd *cmd,
                                const char *name, unsigned long long *value)
-    ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int vshCommandOptScaledInt(vshControl *ctl, const vshCmd *cmd,
                            const char *name, unsigned long long *value,
                            int scale, unsigned long long max)
-    ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
+    ATTRIBUTE_RETURN_CHECK;
 int vshBlockJobOptionBandwidth(vshControl *ctl,
                                const vshCmd *cmd,
                                bool bytes,
@@ -323,8 +321,7 @@ int vshNameSorter(const void *a, const void *b);
 virTypedParameterPtr vshFindTypedParamByName(const char *name,
                                              virTypedParameterPtr list,
                                              int count);
-char *vshGetTypedParamValue(vshControl *ctl, virTypedParameterPtr item)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+char *vshGetTypedParamValue(vshControl *ctl, virTypedParameterPtr item);

 double vshPrettyCapacity(unsigned long long val, const char **unit);
 int vshStringToArray(const char *str, char ***array);
--
2.12.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH (RFC?)] Remove usage of __attribute__((nonnull))

Posted by Daniel P. Berrange 140 weeks ago
On Tue, Mar 28, 2017 at 01:46:31PM +0200, Martin Kletzander wrote:
> The attribute (defined as ATTRIBUTE_NONNULL) was added long time
> ago (2009), but in 2012 (commit eefb881d4683) it was disabled for
> normal build, making it used only when coverity was building libvirt
> or on special request.  It was disabled because it was being misused
> and misunderstood -- the attribute is there as an optimization hint
> for the compiler, not to enhance static analysis.

Actually the attribute does both and the primary intention of the attribute
*is* build time warnings and/or static analysis warnings:

[quote]
  'nonnull (ARG-INDEX, ...)'
     The 'nonnull' attribute specifies that some function parameters
     should be non-null pointers.  For instance, the declaration:

          extern void *
          my_memcpy (void *dest, const void *src, size_t len)
                  __attribute__((nonnull (1, 2)));

     causes the compiler to check that, in calls to 'my_memcpy',
     arguments DEST and SRC are non-null.  If the compiler determines
     that a null pointer is passed in an argument slot marked as
     non-null, and the '-Wnonnull' option is enabled, a warning is
     issued.  The compiler may also choose to make optimizations based
     on the knowledge that certain function arguments will never be
     null.
[/quote]

IIRC, the problem we had was that we marked some methods as non-null,
but still passed NULL values into them. The compiler had optimized
away the code paths that if 'if (arg == NULL) { return 0 }', meaning
the later '*arg' de-reference would fail.

The use of nonnull attribute would help the compiler report
mistakes, but the compiler only catches some easy cases at build
time. 

So the key issue is whether we have enough confidence in fact that
our calling methods really will be passing a non-NULL value or not.

If we're not confident in our callers for a method, then we should
remove nonnull, and have an explicit 'if (arg == NULL)' check in
the code instead.

Some projects might use asserts() against args being non-NULL, but
libvirt tends to try to return soft errors. Given this, it could be
better use to 'if (arg == NULL)' checks in general, over nonnull,
unless we have high confidence in callers.

> However, it is used until today in many places and since it is
> disabled by default, it just screws up builds with STATIC_ANALYSIS
> enabled.

Screws them up in what way ?

> Remove that attribute and all its usages.

Do we not use '-DSTATIC_ANLYSIS' when running through coverity, so
that coverity sees the nonnull annotations and thus is able to do
more advanced checks for NULL args ? If so, removing it would make
coverity miss bugs.

> Signed-off-by: Martin Kletzander <mkletzan@redhat.com>


> diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
> index 891238bcbe0d..5cd3fa4ebccb 100644
> --- a/daemon/libvirtd.c
> +++ b/daemon/libvirtd.c
> @@ -410,7 +410,7 @@ static void daemonInitialize(void)
>  #undef VIR_DAEMON_LOAD_MODULE
> 
> 
> -static int ATTRIBUTE_NONNULL(3)
> +static int
>  daemonSetupNetworking(virNetServerPtr srv,
>                        virNetServerPtr srvAdm,
>                        struct daemonConfig *config,

If we do decide to remove ATTRIBUTE_NONNULL annotations, then we need to
make sure the method impls have suitable 'if (args == NULL) ....' checks
that handle this safely.


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH (RFC?)] Remove usage of __attribute__((nonnull))

Posted by Daniel P. Berrange 140 weeks ago
On Tue, Apr 04, 2017 at 04:10:59PM +0100, Daniel P. Berrange wrote:
> On Tue, Mar 28, 2017 at 01:46:31PM +0200, Martin Kletzander wrote:
> > The attribute (defined as ATTRIBUTE_NONNULL) was added long time
> > ago (2009), but in 2012 (commit eefb881d4683) it was disabled for
> > normal build, making it used only when coverity was building libvirt
> > or on special request.  It was disabled because it was being misused
> > and misunderstood -- the attribute is there as an optimization hint
> > for the compiler, not to enhance static analysis.
> 
> Actually the attribute does both and the primary intention of the attribute
> *is* build time warnings and/or static analysis warnings:

Oh, and it is also informally a guide to developers as to whether they
are permited to pass NULL to a method or not. ie if i see ATTRIBUTE_NONNULL,
then I know I must make sure the caller i'm working on doesn't pass NULL.
So if we removed the annotation, we'd want to make sure we document this
in some other way rather than make people read the method impl to try to
figure it out.


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH (RFC?)] Remove usage of __attribute__((nonnull))

Posted by Martin Kletzander 140 weeks ago
On Tue, Apr 04, 2017 at 04:10:59PM +0100, Daniel P. Berrange wrote:
>On Tue, Mar 28, 2017 at 01:46:31PM +0200, Martin Kletzander wrote:
>> The attribute (defined as ATTRIBUTE_NONNULL) was added long time
>> ago (2009), but in 2012 (commit eefb881d4683) it was disabled for
>> normal build, making it used only when coverity was building libvirt
>> or on special request.  It was disabled because it was being misused
>> and misunderstood -- the attribute is there as an optimization hint
>> for the compiler, not to enhance static analysis.
>
>Actually the attribute does both and the primary intention of the attribute
>*is* build time warnings and/or static analysis warnings:
>
>[quote]
>  'nonnull (ARG-INDEX, ...)'
>     The 'nonnull' attribute specifies that some function parameters
>     should be non-null pointers.  For instance, the declaration:
>
>          extern void *
>          my_memcpy (void *dest, const void *src, size_t len)
>                  __attribute__((nonnull (1, 2)));
>
>     causes the compiler to check that, in calls to 'my_memcpy',
>     arguments DEST and SRC are non-null.  If the compiler determines

This, however, happens only if we pass NULL directly.  There's not much
of a deeper analysis involved IIRC.

>     that a null pointer is passed in an argument slot marked as
>     non-null, and the '-Wnonnull' option is enabled, a warning is
>     issued.  The compiler may also choose to make optimizations based
>     on the knowledge that certain function arguments will never be
>     null.
>[/quote]
>
>IIRC, the problem we had was that we marked some methods as non-null,
>but still passed NULL values into them. The compiler had optimized
>away the code paths that if 'if (arg == NULL) { return 0 }', meaning
>the later '*arg' de-reference would fail.
>

Yes, sure, this corresponds to the last sentence of the documentation
for the attribute.

>The use of nonnull attribute would help the compiler report
>mistakes, but the compiler only catches some easy cases at build
>time.
>

It would.  But for now it is only enabled if STATIC_ANALYSIS=1 and that
is only set if you are running in coverity (or explicitly specify that
during configure, which almost nobody does).

>So the key issue is whether we have enough confidence in fact that
>our calling methods really will be passing a non-NULL value or not.
>

Well, I definitely don't.  But from what I see on the list, people only
add these attributes to function declarations if they are added (read:
copy-pasted) near other functions that have this attribute.  That is
what sparked this attribute removal idea.  So there are *lot of*
functions that don't fail gracefully on NULL parameters because nobody
added (or fixed) the attributes when modifying the code.

>If we're not confident in our callers for a method, then we should
>remove nonnull, and have an explicit 'if (arg == NULL)' check in
>the code instead.
>

We already behave like that.  Except John (and me for a while), everyone
has ATTRIBUTE_NONNULL defined as nothing.  And I believe no distribution
is defining STATIC_ANALYSIS when building their packages.  However that
leads to unnecessary late removals of ATTRIBUTE_NONNULL specifications
for some functions later on, which in turn might cause problems with
backports and from my point of view it just causes mess and unnecessary
time spent on it.  What's worse, if you decide to compile with the
static analysis turned on, you don't get a check for the fact that all
devices are handled in virDomainDefCheckABIStabilityFlags() and
virDomainDeviceInfoIterateInternal().

>Some projects might use asserts() against args being non-NULL, but
>libvirt tends to try to return soft errors. Given this, it could be
>better use to 'if (arg == NULL)' checks in general, over nonnull,
>unless we have high confidence in callers.
>
>> However, it is used until today in many places and since it is
>> disabled by default, it just screws up builds with STATIC_ANALYSIS
>> enabled.
>
>Screws them up in what way ?
>

As said before, the warnings are found out only by some, so it needs to
be fixed in a separate patch and so on.

>> Remove that attribute and all its usages.
>
>Do we not use '-DSTATIC_ANLYSIS' when running through coverity, so
>that coverity sees the nonnull annotations and thus is able to do
>more advanced checks for NULL args ? If so, removing it would make
>coverity miss bugs.
>

STATIC_ANALYSIS is automatically set if configure realizes it's running
under coverity.  However we don't run coverity that often.  More often
we run some build with STATIC_ANALYSIS turned on explicitly.

>> Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
>
>
>> diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
>> index 891238bcbe0d..5cd3fa4ebccb 100644
>> --- a/daemon/libvirtd.c
>> +++ b/daemon/libvirtd.c
>> @@ -410,7 +410,7 @@ static void daemonInitialize(void)
>>  #undef VIR_DAEMON_LOAD_MODULE
>>
>>
>> -static int ATTRIBUTE_NONNULL(3)
>> +static int
>>  daemonSetupNetworking(virNetServerPtr srv,
>>                        virNetServerPtr srvAdm,
>>                        struct daemonConfig *config,
>
>If we do decide to remove ATTRIBUTE_NONNULL annotations, then we need to
>make sure the method impls have suitable 'if (args == NULL) ....' checks
>that handle this safely.
>

As said above, I believe there are many functions that do not use
ATTRIBUTE_NONNULL and would segfault on a NULL argument.  Let's see how
long it takes me to find one.

... (10 seconds later)

Look, the one I mentioned (virDomainDefCheckABIStabilityFlags) is one of
them.  It dereferences both pointers immediately.  I bet there are lot
of those.  It's good that most of them would be caught in tests if it
was obvious.

So the other thing to do would be to ditch commit eefb881d4683 and the
whole STATIC_ANALYSIS and just add a comment for making coverity happy
on those two aforementioned occasions.

>
>Regards,
>Daniel
>--
>|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
>|: http://libvirt.org              -o-             http://virt-manager.org :|
>|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH (RFC?)] Remove usage of __attribute__((nonnull))

Posted by Daniel P. Berrange 140 weeks ago
On Tue, Apr 04, 2017 at 09:51:47PM +0200, Martin Kletzander wrote:
> On Tue, Apr 04, 2017 at 04:10:59PM +0100, Daniel P. Berrange wrote:
> > On Tue, Mar 28, 2017 at 01:46:31PM +0200, Martin Kletzander wrote:
> > > The attribute (defined as ATTRIBUTE_NONNULL) was added long time
> > > ago (2009), but in 2012 (commit eefb881d4683) it was disabled for
> > > normal build, making it used only when coverity was building libvirt
> > > or on special request.  It was disabled because it was being misused
> > > and misunderstood -- the attribute is there as an optimization hint
> > > for the compiler, not to enhance static analysis.
> > 
> > Actually the attribute does both and the primary intention of the attribute
> > *is* build time warnings and/or static analysis warnings:
> > 
> > [quote]
> >  'nonnull (ARG-INDEX, ...)'
> >     The 'nonnull' attribute specifies that some function parameters
> >     should be non-null pointers.  For instance, the declaration:
> > 
> >          extern void *
> >          my_memcpy (void *dest, const void *src, size_t len)
> >                  __attribute__((nonnull (1, 2)));
> > 
> >     causes the compiler to check that, in calls to 'my_memcpy',
> >     arguments DEST and SRC are non-null.  If the compiler determines
> 
> This, however, happens only if we pass NULL directly.  There's not much
> of a deeper analysis involved IIRC.

Yep, coverity is needed to do most deeper analysis of NULL handling

> > The use of nonnull attribute would help the compiler report
> > mistakes, but the compiler only catches some easy cases at build
> > time.
> > 
> 
> It would.  But for now it is only enabled if STATIC_ANALYSIS=1 and that
> is only set if you are running in coverity (or explicitly specify that
> during configure, which almost nobody does).

Easily solvable by enabling it in CI.

> > So the key issue is whether we have enough confidence in fact that
> > our calling methods really will be passing a non-NULL value or not.
> > 
> 
> Well, I definitely don't.  But from what I see on the list, people only
> add these attributes to function declarations if they are added (read:
> copy-pasted) near other functions that have this attribute.  That is
> what sparked this attribute removal idea.  So there are *lot of*
> functions that don't fail gracefully on NULL parameters because nobody
> added (or fixed) the attributes when modifying the code.
> 
> > If we're not confident in our callers for a method, then we should
> > remove nonnull, and have an explicit 'if (arg == NULL)' check in
> > the code instead.
> > 
> 
> We already behave like that.  Except John (and me for a while), everyone
> has ATTRIBUTE_NONNULL defined as nothing.  And I believe no distribution
> is defining STATIC_ANALYSIS when building their packages.  However that
> leads to unnecessary late removals of ATTRIBUTE_NONNULL specifications
g> for some functions later on, which in turn might cause problems with
> backports and from my point of view it just causes mess and unnecessary
> time spent on it.  What's worse, if you decide to compile with the
> static analysis turned on, you don't get a check for the fact that all
> devices are handled in virDomainDefCheckABIStabilityFlags() and
> virDomainDeviceInfoIterateInternal().

I don't see the virDomainDefCheckABIStabilityFlags thing as a real problem. That code is
there to check for some silly mistakes at build time, so it is not something that needs to
be enable by everyone. It really just needs to be run once by someone/something - IOW as
long as our CI triggers that codepath the sanity check is serving its purpose.

> 
> > Some projects might use asserts() against args being non-NULL, but
> > libvirt tends to try to return soft errors. Given this, it could be
> > better use to 'if (arg == NULL)' checks in general, over nonnull,
> > unless we have high confidence in callers.
> > 
> > > However, it is used until today in many places and since it is
> > > disabled by default, it just screws up builds with STATIC_ANALYSIS
> > > enabled.
> > 
> > Screws them up in what way ?
> > 
> 
> As said before, the warnings are found out only by some, so it needs to
> be fixed in a separate patch and so on.

I don't see that as a real problem. It is no different situation to fact that someone writes
and patch on Linux and doesn't test Windows or BSD, or a different older version of Linux,
etc. We never expect developers to test all situations. The key is to ensure that we have
CI coverage of the option. I thought that John still had a nightly coverity job running that
would trigger the -DSTATIC_ANALYSIS codepaths. If that's not the case, then we'd wnat to look
at enabling that in one of the centos CI jobs.

> 
> > > Remove that attribute and all its usages.
> > 
> > Do we not use '-DSTATIC_ANLYSIS' when running through coverity, so
> > that coverity sees the nonnull annotations and thus is able to do
> > more advanced checks for NULL args ? If so, removing it would make
> > coverity miss bugs.
> > 
> 
> STATIC_ANALYSIS is automatically set if configure realizes it's running
> under coverity.  However we don't run coverity that often.  More often
> we run some build with STATIC_ANALYSIS turned on explicitly.
> 
> > > Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
> > 
> > 
> > > diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
> > > index 891238bcbe0d..5cd3fa4ebccb 100644
> > > --- a/daemon/libvirtd.c
> > > +++ b/daemon/libvirtd.c
> > > @@ -410,7 +410,7 @@ static void daemonInitialize(void)
> > >  #undef VIR_DAEMON_LOAD_MODULE
> > > 
> > > 
> > > -static int ATTRIBUTE_NONNULL(3)
> > > +static int
> > >  daemonSetupNetworking(virNetServerPtr srv,
> > >                        virNetServerPtr srvAdm,
> > >                        struct daemonConfig *config,
> > 
> > If we do decide to remove ATTRIBUTE_NONNULL annotations, then we need to
> > make sure the method impls have suitable 'if (args == NULL) ....' checks
> > that handle this safely.
> > 
> 
> As said above, I believe there are many functions that do not use
> ATTRIBUTE_NONNULL and would segfault on a NULL argument.  Let's see how
> long it takes me to find one.
> 
> ... (10 seconds later)
> 
> Look, the one I mentioned (virDomainDefCheckABIStabilityFlags) is one of
> them.  It dereferences both pointers immediately.  I bet there are lot
> of those.  It's good that most of them would be caught in tests if it
> was obvious.

Sure, and adding / removing ATTRIBUTE_NONNULL doesn't really make any
difference to whether that is a bug or not. ie if we do have some code
somewhere that could cause NULL to be passed, then we have a bug regardless
of whether we add ATTRIBUTE_NONNULL annotation to that method or not. If we
did add the annotation though, we might get a notification of the bug from
coverity. So from this POV, ATTRIBUTE_NONNULL feels beneficial to me and
rather than removing it, we should instead make an effort to look for any
methods which defererence pointer args and add more ATTRIBUTE_NONNULL
annotations to them.

In fact we could go as far to say that every single method which takes a
pointer arg should have ATTRIBUTE_NONNULL unless there's a clear valid
use case for it to accept NULL. 

> So the other thing to do would be to ditch commit eefb881d4683 and the
> whole STATIC_ANALYSIS and just add a comment for making coverity happy
> on those two aforementioned occasions.



Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH (RFC?)] Remove usage of __attribute__((nonnull))

Posted by Martin Kletzander 140 weeks ago
On Wed, Apr 05, 2017 at 10:06:22AM +0100, Daniel P. Berrange wrote:
>On Tue, Apr 04, 2017 at 09:51:47PM +0200, Martin Kletzander wrote:
>> On Tue, Apr 04, 2017 at 04:10:59PM +0100, Daniel P. Berrange wrote:
>> > On Tue, Mar 28, 2017 at 01:46:31PM +0200, Martin Kletzander wrote:
>> > > The attribute (defined as ATTRIBUTE_NONNULL) was added long time
>> > > ago (2009), but in 2012 (commit eefb881d4683) it was disabled for
>> > > normal build, making it used only when coverity was building libvirt
>> > > or on special request.  It was disabled because it was being misused
>> > > and misunderstood -- the attribute is there as an optimization hint
>> > > for the compiler, not to enhance static analysis.
>> >
>> > Actually the attribute does both and the primary intention of the attribute
>> > *is* build time warnings and/or static analysis warnings:
>> >
>> > [quote]
>> >  'nonnull (ARG-INDEX, ...)'
>> >     The 'nonnull' attribute specifies that some function parameters
>> >     should be non-null pointers.  For instance, the declaration:
>> >
>> >          extern void *
>> >          my_memcpy (void *dest, const void *src, size_t len)
>> >                  __attribute__((nonnull (1, 2)));
>> >
>> >     causes the compiler to check that, in calls to 'my_memcpy',
>> >     arguments DEST and SRC are non-null.  If the compiler determines
>>
>> This, however, happens only if we pass NULL directly.  There's not much
>> of a deeper analysis involved IIRC.
>
>Yep, coverity is needed to do most deeper analysis of NULL handling
>
>> > The use of nonnull attribute would help the compiler report
>> > mistakes, but the compiler only catches some easy cases at build
>> > time.
>> >
>>
>> It would.  But for now it is only enabled if STATIC_ANALYSIS=1 and that
>> is only set if you are running in coverity (or explicitly specify that
>> during configure, which almost nobody does).
>
>Easily solvable by enabling it in CI.
>

How about we enable it by default for build with new enough GCC (so that
it reports these errors without silently dropping the non-NULL checks)?

>> > So the key issue is whether we have enough confidence in fact that
>> > our calling methods really will be passing a non-NULL value or not.
>> >
>>
>> Well, I definitely don't.  But from what I see on the list, people only
>> add these attributes to function declarations if they are added (read:
>> copy-pasted) near other functions that have this attribute.  That is
>> what sparked this attribute removal idea.  So there are *lot of*
>> functions that don't fail gracefully on NULL parameters because nobody
>> added (or fixed) the attributes when modifying the code.
>>
>> > If we're not confident in our callers for a method, then we should
>> > remove nonnull, and have an explicit 'if (arg == NULL)' check in
>> > the code instead.
>> >
>>
>> We already behave like that.  Except John (and me for a while), everyone
>> has ATTRIBUTE_NONNULL defined as nothing.  And I believe no distribution
>> is defining STATIC_ANALYSIS when building their packages.  However that
>> leads to unnecessary late removals of ATTRIBUTE_NONNULL specifications
>g> for some functions later on, which in turn might cause problems with
>> backports and from my point of view it just causes mess and unnecessary
>> time spent on it.  What's worse, if you decide to compile with the
>> static analysis turned on, you don't get a check for the fact that all
>> devices are handled in virDomainDefCheckABIStabilityFlags() and
>> virDomainDeviceInfoIterateInternal().
>
>I don't see the virDomainDefCheckABIStabilityFlags thing as a real problem. That code is
>there to check for some silly mistakes at build time, so it is not something that needs to
>be enable by everyone. It really just needs to be run once by someone/something - IOW as
>long as our CI triggers that codepath the sanity check is serving its purpose.
>

I should've picked a better example.  My point was that if someone wants
to pass NULL to any of our functions, they have to look at its
implementation IMHO.  I don't believe the attributes due to the reason
mentioned before (with people only adding the attribute to functions
only if other nearby functions have it).

>>
>> > Some projects might use asserts() against args being non-NULL, but
>> > libvirt tends to try to return soft errors. Given this, it could be
>> > better use to 'if (arg == NULL)' checks in general, over nonnull,
>> > unless we have high confidence in callers.
>> >
>> > > However, it is used until today in many places and since it is
>> > > disabled by default, it just screws up builds with STATIC_ANALYSIS
>> > > enabled.
>> >
>> > Screws them up in what way ?
>> >
>>
>> As said before, the warnings are found out only by some, so it needs to
>> be fixed in a separate patch and so on.
>
>I don't see that as a real problem. It is no different situation to fact that someone writes
>and patch on Linux and doesn't test Windows or BSD, or a different older version of Linux,
>etc. We never expect developers to test all situations. The key is to ensure that we have
>CI coverage of the option. I thought that John still had a nightly coverity job running that
>would trigger the -DSTATIC_ANALYSIS codepaths. If that's not the case, then we'd wnat to look
>at enabling that in one of the centos CI jobs.
>

Sure, but isn't it better to have those in a same patch?  We should
avoid breaking as much as possible.  Every little thing helps.  At least
I'm trying to break as less as possible with every patch, similar to
being able to build and pass all tests between individual patches.

>>
>> > > Remove that attribute and all its usages.
>> >
>> > Do we not use '-DSTATIC_ANLYSIS' when running through coverity, so
>> > that coverity sees the nonnull annotations and thus is able to do
>> > more advanced checks for NULL args ? If so, removing it would make
>> > coverity miss bugs.
>> >
>>
>> STATIC_ANALYSIS is automatically set if configure realizes it's running
>> under coverity.  However we don't run coverity that often.  More often
>> we run some build with STATIC_ANALYSIS turned on explicitly.
>>
>> > > Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
>> >
>> >
>> > > diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
>> > > index 891238bcbe0d..5cd3fa4ebccb 100644
>> > > --- a/daemon/libvirtd.c
>> > > +++ b/daemon/libvirtd.c
>> > > @@ -410,7 +410,7 @@ static void daemonInitialize(void)
>> > >  #undef VIR_DAEMON_LOAD_MODULE
>> > >
>> > >
>> > > -static int ATTRIBUTE_NONNULL(3)
>> > > +static int
>> > >  daemonSetupNetworking(virNetServerPtr srv,
>> > >                        virNetServerPtr srvAdm,
>> > >                        struct daemonConfig *config,
>> >
>> > If we do decide to remove ATTRIBUTE_NONNULL annotations, then we need to
>> > make sure the method impls have suitable 'if (args == NULL) ....' checks
>> > that handle this safely.
>> >
>>
>> As said above, I believe there are many functions that do not use
>> ATTRIBUTE_NONNULL and would segfault on a NULL argument.  Let's see how
>> long it takes me to find one.
>>
>> ... (10 seconds later)
>>
>> Look, the one I mentioned (virDomainDefCheckABIStabilityFlags) is one of
>> them.  It dereferences both pointers immediately.  I bet there are lot
>> of those.  It's good that most of them would be caught in tests if it
>> was obvious.
>
>Sure, and adding / removing ATTRIBUTE_NONNULL doesn't really make any
>difference to whether that is a bug or not. ie if we do have some code
>somewhere that could cause NULL to be passed, then we have a bug regardless
>of whether we add ATTRIBUTE_NONNULL annotation to that method or not. If we
>did add the annotation though, we might get a notification of the bug from
>coverity. So from this POV, ATTRIBUTE_NONNULL feels beneficial to me and
>rather than removing it, we should instead make an effort to look for any
>methods which defererence pointer args and add more ATTRIBUTE_NONNULL
>annotations to them.
>
>In fact we could go as far to say that every single method which takes a
>pointer arg should have ATTRIBUTE_NONNULL unless there's a clear valid
>use case for it to accept NULL.
>

Yeah, we can, but that requires a) enabling the attributes for normal
builds and b) educating all libvirt devs what actually the attribute
does (that could come over time side by side with when (a)).

>> So the other thing to do would be to ditch commit eefb881d4683 and the
>> whole STATIC_ANALYSIS and just add a comment for making coverity happy
>> on those two aforementioned occasions.
>
>
>
>Regards,
>Daniel
>--
>|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
>|: http://libvirt.org              -o-             http://virt-manager.org :|
>|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH (RFC?)] Remove usage of __attribute__((nonnull))

Posted by Daniel P. Berrange 140 weeks ago
On Wed, Apr 05, 2017 at 12:38:23PM +0200, Martin Kletzander wrote:
> On Wed, Apr 05, 2017 at 10:06:22AM +0100, Daniel P. Berrange wrote:
> > On Tue, Apr 04, 2017 at 09:51:47PM +0200, Martin Kletzander wrote:
> > > On Tue, Apr 04, 2017 at 04:10:59PM +0100, Daniel P. Berrange wrote:
> > > > On Tue, Mar 28, 2017 at 01:46:31PM +0200, Martin Kletzander wrote:
> > > > > The attribute (defined as ATTRIBUTE_NONNULL) was added long time
> > > > > ago (2009), but in 2012 (commit eefb881d4683) it was disabled for
> > > > > normal build, making it used only when coverity was building libvirt
> > > > > or on special request.  It was disabled because it was being misused
> > > > > and misunderstood -- the attribute is there as an optimization hint
> > > > > for the compiler, not to enhance static analysis.
> > > >
> > > > Actually the attribute does both and the primary intention of the attribute
> > > > *is* build time warnings and/or static analysis warnings:
> > > >
> > > > [quote]
> > > >  'nonnull (ARG-INDEX, ...)'
> > > >     The 'nonnull' attribute specifies that some function parameters
> > > >     should be non-null pointers.  For instance, the declaration:
> > > >
> > > >          extern void *
> > > >          my_memcpy (void *dest, const void *src, size_t len)
> > > >                  __attribute__((nonnull (1, 2)));
> > > >
> > > >     causes the compiler to check that, in calls to 'my_memcpy',
> > > >     arguments DEST and SRC are non-null.  If the compiler determines
> > > 
> > > This, however, happens only if we pass NULL directly.  There's not much
> > > of a deeper analysis involved IIRC.
> > 
> > Yep, coverity is needed to do most deeper analysis of NULL handling
> > 
> > > > The use of nonnull attribute would help the compiler report
> > > > mistakes, but the compiler only catches some easy cases at build
> > > > time.
> > > >
> > > 
> > > It would.  But for now it is only enabled if STATIC_ANALYSIS=1 and that
> > > is only set if you are running in coverity (or explicitly specify that
> > > during configure, which almost nobody does).
> > 
> > Easily solvable by enabling it in CI.
> > 
> 
> How about we enable it by default for build with new enough GCC (so that
> it reports these errors without silently dropping the non-NULL checks)?

Yes, it seems that we can use -fno-delete-null-pointer-checks to prevent
GCC from optimizing away the NULL pointer checks, while having nonnull
attributes enabled all the time.


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH (RFC?)] Remove usage of __attribute__((nonnull))

Posted by Martin Kletzander 140 weeks ago
On Wed, Apr 05, 2017 at 12:29:03PM +0100, Daniel P. Berrange wrote:
>On Wed, Apr 05, 2017 at 12:38:23PM +0200, Martin Kletzander wrote:

[...]

>> How about we enable it by default for build with new enough GCC (so that
>> it reports these errors without silently dropping the non-NULL checks)?
>
>Yes, it seems that we can use -fno-delete-null-pointer-checks to prevent
>GCC from optimizing away the NULL pointer checks, while having nonnull
>attributes enabled all the time.
>

Or that, yes.  So I'll drop this one.

>
>Regards,
>Daniel
>--
>|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
>|: http://libvirt.org              -o-             http://virt-manager.org :|
>|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH (RFC?)] Remove usage of __attribute__((nonnull))

Posted by John Ferlan 140 weeks ago

On 04/05/2017 05:06 AM, Daniel P. Berrange wrote:
> On Tue, Apr 04, 2017 at 09:51:47PM +0200, Martin Kletzander wrote:
>> On Tue, Apr 04, 2017 at 04:10:59PM +0100, Daniel P. Berrange wrote:
>>> On Tue, Mar 28, 2017 at 01:46:31PM +0200, Martin Kletzander wrote:
>>>> The attribute (defined as ATTRIBUTE_NONNULL) was added long time
>>>> ago (2009), but in 2012 (commit eefb881d4683) it was disabled for
>>>> normal build, making it used only when coverity was building libvirt
>>>> or on special request.  It was disabled because it was being misused
>>>> and misunderstood -- the attribute is there as an optimization hint
>>>> for the compiler, not to enhance static analysis.
>>>
>>> Actually the attribute does both and the primary intention of the attribute
>>> *is* build time warnings and/or static analysis warnings:
>>>
>>> [quote]
>>>  'nonnull (ARG-INDEX, ...)'
>>>     The 'nonnull' attribute specifies that some function parameters
>>>     should be non-null pointers.  For instance, the declaration:
>>>
>>>          extern void *
>>>          my_memcpy (void *dest, const void *src, size_t len)
>>>                  __attribute__((nonnull (1, 2)));
>>>
>>>     causes the compiler to check that, in calls to 'my_memcpy',
>>>     arguments DEST and SRC are non-null.  If the compiler determines
>>
>> This, however, happens only if we pass NULL directly.  There's not much
>> of a deeper analysis involved IIRC.
> 
> Yep, coverity is needed to do most deeper analysis of NULL handling
> 
>>> The use of nonnull attribute would help the compiler report
>>> mistakes, but the compiler only catches some easy cases at build
>>> time.
>>>
>>
>> It would.  But for now it is only enabled if STATIC_ANALYSIS=1 and that
>> is only set if you are running in coverity (or explicitly specify that
>> during configure, which almost nobody does).
> 
> Easily solvable by enabling it in CI.
> 
>>> So the key issue is whether we have enough confidence in fact that
>>> our calling methods really will be passing a non-NULL value or not.
>>>
>>
>> Well, I definitely don't.  But from what I see on the list, people only
>> add these attributes to function declarations if they are added (read:
>> copy-pasted) near other functions that have this attribute.  That is
>> what sparked this attribute removal idea.  So there are *lot of*
>> functions that don't fail gracefully on NULL parameters because nobody
>> added (or fixed) the attributes when modifying the code.
>>
>>> If we're not confident in our callers for a method, then we should
>>> remove nonnull, and have an explicit 'if (arg == NULL)' check in
>>> the code instead.
>>>
>>
>> We already behave like that.  Except John (and me for a while), everyone
>> has ATTRIBUTE_NONNULL defined as nothing.  And I believe no distribution
>> is defining STATIC_ANALYSIS when building their packages.  However that
>> leads to unnecessary late removals of ATTRIBUTE_NONNULL specifications
> g> for some functions later on, which in turn might cause problems with
>> backports and from my point of view it just causes mess and unnecessary
>> time spent on it.  What's worse, if you decide to compile with the
>> static analysis turned on, you don't get a check for the fact that all
>> devices are handled in virDomainDefCheckABIStabilityFlags() and
>> virDomainDeviceInfoIterateInternal().
> 
> I don't see the virDomainDefCheckABIStabilityFlags thing as a real problem. That code is
> there to check for some silly mistakes at build time, so it is not something that needs to
> be enable by everyone. It really just needs to be run once by someone/something - IOW as
> long as our CI triggers that codepath the sanity check is serving its purpose.
> 
>>
>>> Some projects might use asserts() against args being non-NULL, but
>>> libvirt tends to try to return soft errors. Given this, it could be
>>> better use to 'if (arg == NULL)' checks in general, over nonnull,
>>> unless we have high confidence in callers.
>>>
>>>> However, it is used until today in many places and since it is
>>>> disabled by default, it just screws up builds with STATIC_ANALYSIS
>>>> enabled.
>>>
>>> Screws them up in what way ?
>>>
>>
>> As said before, the warnings are found out only by some, so it needs to
>> be fixed in a separate patch and so on.
> 
> I don't see that as a real problem. It is no different situation to fact that someone writes
> and patch on Linux and doesn't test Windows or BSD, or a different older version of Linux,
> etc. We never expect developers to test all situations. The key is to ensure that we have
> CI coverage of the option. I thought that John still had a nightly coverity job running that
> would trigger the -DSTATIC_ANALYSIS codepaths. If that's not the case, then we'd wnat to look
> at enabling that in one of the centos CI jobs.
> 

I still have a run of Coverity every night although I have been less
diligent about checking errors lately. Mainly because generally things
that are considered a false positive were being rejected when I posted
patches. I keep about 20 patches in a local branch.

There was a point quite a few months ago where my nightly build started
failing because either I changed the Coverity version or the compiler
version on my laptop - cannot recall exactly. That resulted in a bunch
more local patches until I finally had too many and posted that pile
late last month.  Enabling static analysis in CI builds was something I
suggested in my cover - although now I've done it for my every day work
environment so I will see the problems much sooner.

John

>>
>>>> Remove that attribute and all its usages.
>>>
>>> Do we not use '-DSTATIC_ANLYSIS' when running through coverity, so
>>> that coverity sees the nonnull annotations and thus is able to do
>>> more advanced checks for NULL args ? If so, removing it would make
>>> coverity miss bugs.
>>>
>>
>> STATIC_ANALYSIS is automatically set if configure realizes it's running
>> under coverity.  However we don't run coverity that often.  More often
>> we run some build with STATIC_ANALYSIS turned on explicitly.
>>
>>>> Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
>>>
>>>
>>>> diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
>>>> index 891238bcbe0d..5cd3fa4ebccb 100644
>>>> --- a/daemon/libvirtd.c
>>>> +++ b/daemon/libvirtd.c
>>>> @@ -410,7 +410,7 @@ static void daemonInitialize(void)
>>>>  #undef VIR_DAEMON_LOAD_MODULE
>>>>
>>>>
>>>> -static int ATTRIBUTE_NONNULL(3)
>>>> +static int
>>>>  daemonSetupNetworking(virNetServerPtr srv,
>>>>                        virNetServerPtr srvAdm,
>>>>                        struct daemonConfig *config,
>>>
>>> If we do decide to remove ATTRIBUTE_NONNULL annotations, then we need to
>>> make sure the method impls have suitable 'if (args == NULL) ....' checks
>>> that handle this safely.
>>>
>>
>> As said above, I believe there are many functions that do not use
>> ATTRIBUTE_NONNULL and would segfault on a NULL argument.  Let's see how
>> long it takes me to find one.
>>
>> ... (10 seconds later)
>>
>> Look, the one I mentioned (virDomainDefCheckABIStabilityFlags) is one of
>> them.  It dereferences both pointers immediately.  I bet there are lot
>> of those.  It's good that most of them would be caught in tests if it
>> was obvious.
> 
> Sure, and adding / removing ATTRIBUTE_NONNULL doesn't really make any
> difference to whether that is a bug or not. ie if we do have some code
> somewhere that could cause NULL to be passed, then we have a bug regardless
> of whether we add ATTRIBUTE_NONNULL annotation to that method or not. If we
> did add the annotation though, we might get a notification of the bug from
> coverity. So from this POV, ATTRIBUTE_NONNULL feels beneficial to me and
> rather than removing it, we should instead make an effort to look for any
> methods which defererence pointer args and add more ATTRIBUTE_NONNULL
> annotations to them.
> 
> In fact we could go as far to say that every single method which takes a
> pointer arg should have ATTRIBUTE_NONNULL unless there's a clear valid
> use case for it to accept NULL. 
> 
>> So the other thing to do would be to ditch commit eefb881d4683 and the
>> whole STATIC_ANALYSIS and just add a comment for making coverity happy
>> on those two aforementioned occasions.
> 
> 
> 
> Regards,
> Daniel
> 

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH (RFC?)] Remove usage of __attribute__((nonnull))

Posted by Martin Kletzander 140 weeks ago
On Wed, Apr 05, 2017 at 06:53:10AM -0400, John Ferlan wrote:
>
>
>On 04/05/2017 05:06 AM, Daniel P. Berrange wrote:
>> On Tue, Apr 04, 2017 at 09:51:47PM +0200, Martin Kletzander wrote:
>>> On Tue, Apr 04, 2017 at 04:10:59PM +0100, Daniel P. Berrange wrote:
>>>> On Tue, Mar 28, 2017 at 01:46:31PM +0200, Martin Kletzander wrote:
>>>>> The attribute (defined as ATTRIBUTE_NONNULL) was added long time
>>>>> ago (2009), but in 2012 (commit eefb881d4683) it was disabled for
>>>>> normal build, making it used only when coverity was building libvirt
>>>>> or on special request.  It was disabled because it was being misused
>>>>> and misunderstood -- the attribute is there as an optimization hint
>>>>> for the compiler, not to enhance static analysis.
>>>>
>>>> Actually the attribute does both and the primary intention of the attribute
>>>> *is* build time warnings and/or static analysis warnings:
>>>>
>>>> [quote]
>>>>  'nonnull (ARG-INDEX, ...)'
>>>>     The 'nonnull' attribute specifies that some function parameters
>>>>     should be non-null pointers.  For instance, the declaration:
>>>>
>>>>          extern void *
>>>>          my_memcpy (void *dest, const void *src, size_t len)
>>>>                  __attribute__((nonnull (1, 2)));
>>>>
>>>>     causes the compiler to check that, in calls to 'my_memcpy',
>>>>     arguments DEST and SRC are non-null.  If the compiler determines
>>>
>>> This, however, happens only if we pass NULL directly.  There's not much
>>> of a deeper analysis involved IIRC.
>>
>> Yep, coverity is needed to do most deeper analysis of NULL handling
>>
>>>> The use of nonnull attribute would help the compiler report
>>>> mistakes, but the compiler only catches some easy cases at build
>>>> time.
>>>>
>>>
>>> It would.  But for now it is only enabled if STATIC_ANALYSIS=1 and that
>>> is only set if you are running in coverity (or explicitly specify that
>>> during configure, which almost nobody does).
>>
>> Easily solvable by enabling it in CI.
>>
>>>> So the key issue is whether we have enough confidence in fact that
>>>> our calling methods really will be passing a non-NULL value or not.
>>>>
>>>
>>> Well, I definitely don't.  But from what I see on the list, people only
>>> add these attributes to function declarations if they are added (read:
>>> copy-pasted) near other functions that have this attribute.  That is
>>> what sparked this attribute removal idea.  So there are *lot of*
>>> functions that don't fail gracefully on NULL parameters because nobody
>>> added (or fixed) the attributes when modifying the code.
>>>
>>>> If we're not confident in our callers for a method, then we should
>>>> remove nonnull, and have an explicit 'if (arg == NULL)' check in
>>>> the code instead.
>>>>
>>>
>>> We already behave like that.  Except John (and me for a while), everyone
>>> has ATTRIBUTE_NONNULL defined as nothing.  And I believe no distribution
>>> is defining STATIC_ANALYSIS when building their packages.  However that
>>> leads to unnecessary late removals of ATTRIBUTE_NONNULL specifications
>> g> for some functions later on, which in turn might cause problems with
>>> backports and from my point of view it just causes mess and unnecessary
>>> time spent on it.  What's worse, if you decide to compile with the
>>> static analysis turned on, you don't get a check for the fact that all
>>> devices are handled in virDomainDefCheckABIStabilityFlags() and
>>> virDomainDeviceInfoIterateInternal().
>>
>> I don't see the virDomainDefCheckABIStabilityFlags thing as a real problem. That code is
>> there to check for some silly mistakes at build time, so it is not something that needs to
>> be enable by everyone. It really just needs to be run once by someone/something - IOW as
>> long as our CI triggers that codepath the sanity check is serving its purpose.
>>
>>>
>>>> Some projects might use asserts() against args being non-NULL, but
>>>> libvirt tends to try to return soft errors. Given this, it could be
>>>> better use to 'if (arg == NULL)' checks in general, over nonnull,
>>>> unless we have high confidence in callers.
>>>>
>>>>> However, it is used until today in many places and since it is
>>>>> disabled by default, it just screws up builds with STATIC_ANALYSIS
>>>>> enabled.
>>>>
>>>> Screws them up in what way ?
>>>>
>>>
>>> As said before, the warnings are found out only by some, so it needs to
>>> be fixed in a separate patch and so on.
>>
>> I don't see that as a real problem. It is no different situation to fact that someone writes
>> and patch on Linux and doesn't test Windows or BSD, or a different older version of Linux,
>> etc. We never expect developers to test all situations. The key is to ensure that we have
>> CI coverage of the option. I thought that John still had a nightly coverity job running that
>> would trigger the -DSTATIC_ANALYSIS codepaths. If that's not the case, then we'd wnat to look
>> at enabling that in one of the centos CI jobs.
>>
>
>I still have a run of Coverity every night although I have been less
>diligent about checking errors lately. Mainly because generally things
>that are considered a false positive were being rejected when I posted
>patches. I keep about 20 patches in a local branch.
>
>There was a point quite a few months ago where my nightly build started
>failing because either I changed the Coverity version or the compiler
>version on my laptop - cannot recall exactly. That resulted in a bunch
>more local patches until I finally had too many and posted that pile
>late last month.  Enabling static analysis in CI builds was something I
>suggested in my cover - although now I've done it for my every day work
>environment so I will see the problems much sooner.
>

Yeah, but my points were: a) why only CI? b) we need not to enable
static_analysis flag, but rather not define ATTRIBUTE_NONNULL to nothing
if STATIC_ANALYSIS is set.  The STATIC_ANALYSIS macro is used to disable
some code that we want to be using in both CI and local builds.

>John
>
>>>
>>>>> Remove that attribute and all its usages.
>>>>
>>>> Do we not use '-DSTATIC_ANLYSIS' when running through coverity, so
>>>> that coverity sees the nonnull annotations and thus is able to do
>>>> more advanced checks for NULL args ? If so, removing it would make
>>>> coverity miss bugs.
>>>>
>>>
>>> STATIC_ANALYSIS is automatically set if configure realizes it's running
>>> under coverity.  However we don't run coverity that often.  More often
>>> we run some build with STATIC_ANALYSIS turned on explicitly.
>>>
>>>>> Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
>>>>
>>>>
>>>>> diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
>>>>> index 891238bcbe0d..5cd3fa4ebccb 100644
>>>>> --- a/daemon/libvirtd.c
>>>>> +++ b/daemon/libvirtd.c
>>>>> @@ -410,7 +410,7 @@ static void daemonInitialize(void)
>>>>>  #undef VIR_DAEMON_LOAD_MODULE
>>>>>
>>>>>
>>>>> -static int ATTRIBUTE_NONNULL(3)
>>>>> +static int
>>>>>  daemonSetupNetworking(virNetServerPtr srv,
>>>>>                        virNetServerPtr srvAdm,
>>>>>                        struct daemonConfig *config,
>>>>
>>>> If we do decide to remove ATTRIBUTE_NONNULL annotations, then we need to
>>>> make sure the method impls have suitable 'if (args == NULL) ....' checks
>>>> that handle this safely.
>>>>
>>>
>>> As said above, I believe there are many functions that do not use
>>> ATTRIBUTE_NONNULL and would segfault on a NULL argument.  Let's see how
>>> long it takes me to find one.
>>>
>>> ... (10 seconds later)
>>>
>>> Look, the one I mentioned (virDomainDefCheckABIStabilityFlags) is one of
>>> them.  It dereferences both pointers immediately.  I bet there are lot
>>> of those.  It's good that most of them would be caught in tests if it
>>> was obvious.
>>
>> Sure, and adding / removing ATTRIBUTE_NONNULL doesn't really make any
>> difference to whether that is a bug or not. ie if we do have some code
>> somewhere that could cause NULL to be passed, then we have a bug regardless
>> of whether we add ATTRIBUTE_NONNULL annotation to that method or not. If we
>> did add the annotation though, we might get a notification of the bug from
>> coverity. So from this POV, ATTRIBUTE_NONNULL feels beneficial to me and
>> rather than removing it, we should instead make an effort to look for any
>> methods which defererence pointer args and add more ATTRIBUTE_NONNULL
>> annotations to them.
>>
>> In fact we could go as far to say that every single method which takes a
>> pointer arg should have ATTRIBUTE_NONNULL unless there's a clear valid
>> use case for it to accept NULL.
>>
>>> So the other thing to do would be to ditch commit eefb881d4683 and the
>>> whole STATIC_ANALYSIS and just add a comment for making coverity happy
>>> on those two aforementioned occasions.
>>
>>
>>
>> Regards,
>> Daniel
>>
>
>--
>libvir-list mailing list
>libvir-list@redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH (RFC?)] Remove usage of __attribute__((nonnull))

Posted by Andrea Bolognani 140 weeks ago
On Wed, 2017-04-05 at 06:53 -0400, John Ferlan wrote:
> > I thought that John still had a nightly coverity job running that
> > would trigger the -DSTATIC_ANALYSIS codepaths. If that's not the case, then we'd wnat to look
> > at enabling that in one of the centos CI jobs.
> 
> I still have a run of Coverity every night although I have been less
> diligent about checking errors lately. Mainly because generally things
> that are considered a false positive were being rejected when I posted
> patches. I keep about 20 patches in a local branch.
> 
> There was a point quite a few months ago where my nightly build started
> failing because either I changed the Coverity version or the compiler
> version on my laptop - cannot recall exactly. That resulted in a bunch
> more local patches until I finally had too many and posted that pile
> late last month.  Enabling static analysis in CI builds was something I
> suggested in my cover - although now I've done it for my every day work
> environment so I will see the problems much sooner.

Did we ever get in touch with the Coverity folks about
enabling Coverity Scan[1] for libvirt? QEMU is already
part of the program.


[1] https://scan.coverity.com/
-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH (RFC?)] Remove usage of __attribute__((nonnull))

Posted by Martin Kletzander 140 weeks ago
On Thu, Apr 06, 2017 at 04:27:25PM +0200, Andrea Bolognani wrote:
>On Wed, 2017-04-05 at 06:53 -0400, John Ferlan wrote:
>> > I thought that John still had a nightly coverity job running that
>> > would trigger the -DSTATIC_ANALYSIS codepaths. If that's not the case, then we'd wnat to look
>> > at enabling that in one of the centos CI jobs.
>> 
>> I still have a run of Coverity every night although I have been less
>> diligent about checking errors lately. Mainly because generally things
>> that are considered a false positive were being rejected when I posted
>> patches. I keep about 20 patches in a local branch.
>> 
>> There was a point quite a few months ago where my nightly build started
>> failing because either I changed the Coverity version or the compiler
>> version on my laptop - cannot recall exactly. That resulted in a bunch
>> more local patches until I finally had too many and posted that pile
>> late last month.  Enabling static analysis in CI builds was something I
>> suggested in my cover - although now I've done it for my every day work
>> environment so I will see the problems much sooner.
>
>Did we ever get in touch with the Coverity folks about
>enabling Coverity Scan[1] for libvirt? QEMU is already
>part of the program.
>

No idea, but we can register there ourselves, can't we?  They have
integration with GitHub where we have the read-only copy anyway, we can
even run in on TravisCI and have the whole bundle without changing
much internally (just committing settings file into the repository).

I think we would get 2 builds per day, depending on how the github repo
is updated.  Is that done automatically or every X minutes or something?

Anyway it could be nice to have that.

>
>[1] https://scan.coverity.com/
>-- 
>Andrea Bolognani / Red Hat / Virtualization
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH (RFC?)] Remove usage of __attribute__((nonnull))

Posted by Daniel P. Berrange 140 weeks ago
On Thu, Apr 06, 2017 at 05:40:09PM +0200, Martin Kletzander wrote:
> On Thu, Apr 06, 2017 at 04:27:25PM +0200, Andrea Bolognani wrote:
> > On Wed, 2017-04-05 at 06:53 -0400, John Ferlan wrote:
> > > > I thought that John still had a nightly coverity job running that
> > > > would trigger the -DSTATIC_ANALYSIS codepaths. If that's not the case, then we'd wnat to look
> > > > at enabling that in one of the centos CI jobs.
> > >  
> > > I still have a run of Coverity every night although I have been less
> > > diligent about checking errors lately. Mainly because generally things
> > > that are considered a false positive were being rejected when I posted
> > > patches. I keep about 20 patches in a local branch.
> > >  
> > > There was a point quite a few months ago where my nightly build started
> > > failing because either I changed the Coverity version or the compiler
> > > version on my laptop - cannot recall exactly. That resulted in a bunch
> > > more local patches until I finally had too many and posted that pile
> > > late last month.  Enabling static analysis in CI builds was something I
> > > suggested in my cover - although now I've done it for my every day work
> > > environment so I will see the problems much sooner.
> > 
> > Did we ever get in touch with the Coverity folks about
> > enabling Coverity Scan[1] for libvirt? QEMU is already
> > part of the program.
> > 
> 
> No idea, but we can register there ourselves, can't we?  They have
> integration with GitHub where we have the read-only copy anyway, we can
> even run in on TravisCI and have the whole bundle without changing
> much internally (just committing settings file into the repository).

Yep, I'd be in favour of using the public coverity scan service. For the
sake of community inclusivity / transparency, it is always preferrable to
have project infrastructure visible to the full commnunity where possible.

We could certainly setup a travis CI build too. In particular that would
give us build testing on several versions of Ubuntu, as well as ability
to do OS-X builds which is a notable platform we lack any automated testing
of.

> I think we would get 2 builds per day, depending on how the github repo
> is updated.  Is that done automatically or every X minutes or something?

We only do one build a day right now, so the 2 builds a day limt is no
big deal. Their FAQ is fuzzy on just how builds a triggered...

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list