bhyve: fix bhyve warning CTASSERT

2015-08-13 Thread Stefano Garzarella
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
@@ -32,7 +32,8 @@
 #ifndef CTASSERT   /* Allow lint to override */
 #defineCTASSERT(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
___
freebsd-virtualization@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"


Re: bhyve: fix bhyve warning CTASSERT

2015-08-13 Thread Conrad Meyer
Better to just replace CTASSERT() with _Static_assert() while you're here.

Best,
Conrad

On Thu, Aug 13, 2015 at 5:05 AM, Stefano Garzarella
 wrote:
> 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
> @@ -32,7 +32,8 @@
>  #ifndef CTASSERT   /* Allow lint to override */
>  #defineCTASSERT(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
> ___
> freebsd-curr...@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
___
freebsd-virtualization@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"


Re: bhyve: fix bhyve warning CTASSERT

2015-08-13 Thread John-Mark Gurney
Conrad Meyer wrote this message on Thu, Aug 13, 2015 at 08:12 -0700:
> Better to just replace CTASSERT() with _Static_assert() while you're here.

And make sure that sys/cdefs.h is included for compatibility w/ pre-C11
compilers...

> On Thu, Aug 13, 2015 at 5:05 AM, Stefano Garzarella
>  wrote:
> > 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
> > @@ -32,7 +32,8 @@
> >  #ifndef CTASSERT   /* Allow lint to override */
> >  #defineCTASSERT(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

-- 
  John-Mark Gurney  Voice: +1 415 225 5579

 "All that I will do, has been done, All that I have, has not."
___
freebsd-virtualization@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"