Author: ngie
Date: Wed Jul 6 05:02:59 2016
New Revision: 302364
URL: https://svnweb.freebsd.org/changeset/base/302364
Log:
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
Modified:
head/usr.sbin/bhyve/pci_emul.c
Modified: head/usr.sbin/bhyve/pci_emul.c
==
--- head/usr.sbin/bhyve/pci_emul.c Wed Jul 6 04:58:42 2016
(r302363)
+++ head/usr.sbin/bhyve/pci_emul.c Wed Jul 6 05:02:59 2016
(r302364)
@@ -755,13 +755,21 @@ pci_emul_init(struct vmctx *ctx, struct
return (err);
}
+#ifdef __GNU_C__
+#defineWRAPPED_CTASSERT(x) CTASSERT(x) __unused
+#else
+#defineWRAPPED_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
int err;
struct pciecap pciecap;
- CTASSERT(sizeof(struct pciecap) == 60);
-
if (type != PCIEM_TYPE_ROOT_PORT)
return (-1);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"