diff options
author | ngie <ngie@FreeBSD.org> | 2016-07-06 05:02:59 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2016-07-06 05:02:59 +0000 |
commit | a9629fc1279369243f13b28d45d202f82e720778 (patch) | |
tree | db67792a1eec79c0f32399c6610c7a8e95a57935 /usr.sbin | |
parent | 67d615a1f296347408f41984ec2671d975031716 (diff) | |
download | FreeBSD-src-a9629fc1279369243f13b28d45d202f82e720778.zip FreeBSD-src-a9629fc1279369243f13b28d45d202f82e720778.tar.gz |
Fix gcc warnings
Add `WRAPPED_CTASSERT` macro by annotating CTASSERTs with __unused
to deal with -Wunused-local-typedefs warnings from gcc 4.8+.
All other compilers (clang, etc) use CTASSERT as-is. A more generic
solution for this issue will be proposed after ^/stable/11 is forked.
Consolidate all CTASSERTs under one block instead of inlining them in
functions.
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D7119
MFC after: 1 week
Reported by: Jenkins
Reviewed by: grehan (maintainer)
Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/bhyve/pci_emul.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/usr.sbin/bhyve/pci_emul.c b/usr.sbin/bhyve/pci_emul.c index 523d7b0..45253e8 100644 --- a/usr.sbin/bhyve/pci_emul.c +++ b/usr.sbin/bhyve/pci_emul.c @@ -755,13 +755,21 @@ pci_emul_init(struct vmctx *ctx, struct pci_devemu *pde, int bus, int slot, return (err); } +#ifdef __GNU_C__ +#define WRAPPED_CTASSERT(x) CTASSERT(x) __unused +#else +#define WRAPPED_CTASSERT(x) CTASSERT(x) +#endif + +WRAPPED_CTASSERT(sizeof(struct msicap) == 14); +WRAPPED_CTASSERT(sizeof(struct msixcap) == 12); +WRAPPED_CTASSERT(sizeof(struct pciecap) == 60); + void pci_populate_msicap(struct msicap *msicap, int msgnum, int nextptr) { int mmc; - CTASSERT(sizeof(struct msicap) == 14); - /* Number of msi messages must be a power of 2 between 1 and 32 */ assert((msgnum & (msgnum - 1)) == 0 && msgnum >= 1 && msgnum <= 32); mmc = ffs(msgnum) - 1; @@ -786,7 +794,6 @@ static void pci_populate_msixcap(struct msixcap *msixcap, int msgnum, int barnum, uint32_t msix_tab_size) { - CTASSERT(sizeof(struct msixcap) == 12); assert(msix_tab_size % 4096 == 0); @@ -937,8 +944,6 @@ pci_emul_add_pciecap(struct pci_devinst *pi, int type) int err; struct pciecap pciecap; - CTASSERT(sizeof(struct pciecap) == 60); - if (type != PCIEM_TYPE_ROOT_PORT) return (-1); |