bhyve: fix bhyve warning CTASSERT

From: Stefano Garzarella <stefanogarzarella_at_gmail.com>
Date: Thu, 13 Aug 2015 14:05:00 +0200
Hi all,
when I compile bhyve, I have the following errors from clang:
pci_emul.c:750:2: error: unused typedef '__assert750'
[-Werror,-Wunused-local-typedef]
        CTASSERT(sizeof(struct msicap) == 14);
pci_emul.c:776:2: error: unused typedef '__assert776'
[-Werror,-Wunused-local-typedef]
        CTASSERT(sizeof(struct msixcap) == 12);
pci_emul.c:928:2: error: unused typedef '__assert928'
[-Werror,-Wunused-local-typedef]
        CTASSERT(sizeof(struct pciecap) == 60);

I fixed them in this simple way:

diff --git a/bhyverun.h b/bhyverun.h
index 87824ef..7ac3aa9 100644
--- a/bhyverun.h
+++ b/bhyverun.h
_at__at_ -32,7 +32,8 _at__at_
 #ifndef CTASSERT               /* Allow lint to override */
 #define        CTASSERT(x)             _CTASSERT(x, __LINE__)
 #define        _CTASSERT(x, y)         __CTASSERT(x, y)
-#define        __CTASSERT(x, y)        typedef char __assert ## y[(x) ? 1
: -1]
+#define        __CTASSERT(x, y)        typedef char __assert ## y[(x) ? 1
: -1] \
+                                                           __unused
 #endif

Cheers,
Stefano
Received on Thu Aug 13 2015 - 10:05:22 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:59 UTC