Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Aug 2015 08:12:23 -0700
From:      Conrad Meyer <cem@FreeBSD.org>
To:        Stefano Garzarella <stefanogarzarella@gmail.com>
Cc:        freebsd-current <freebsd-current@freebsd.org>,  "freebsd-virtualization@freebsd.org" <freebsd-virtualization@freebsd.org>, Neel Natu <neel@freebsd.org>, Peter Grehan <grehan@freebsd.org>
Subject:   Re: bhyve: fix bhyve warning CTASSERT
Message-ID:  <CAG6CVpWZ0j39Meg1OQsmFLuxssBB5xh0G4rcSOvm8OHKmoKPaQ@mail.gmail.com>
In-Reply-To: <CAO0mX5aVtF6EjO=LMb4pfSzUtXweuhVPt85-iK%2BCCYP%2BO6Ue9A@mail.gmail.com>
References:  <CAO0mX5aVtF6EjO=LMb4pfSzUtXweuhVPt85-iK%2BCCYP%2BO6Ue9A@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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
<stefanogarzarella@gmail.com> 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 */
>  #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
> _______________________________________________
> freebsd-current@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG6CVpWZ0j39Meg1OQsmFLuxssBB5xh0G4rcSOvm8OHKmoKPaQ>