From owner-freebsd-virtualization@freebsd.org Thu Aug 13 15:37:24 2015 Return-Path: Delivered-To: freebsd-virtualization@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38CA59A0D10; Thu, 13 Aug 2015 15:37:24 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-yk0-f173.google.com (mail-yk0-f173.google.com [209.85.160.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F1FCFA03; Thu, 13 Aug 2015 15:37:23 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by ykay144 with SMTP id y144so44270195yka.3; Thu, 13 Aug 2015 08:37:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=ohOJSFwvFUhHop6mN5V9iKdspjwyxxdsT8OyPZQEqEM=; b=LUJacndxdpXB8auLjOCWrt8Bc08/NAnPxoN3LpZ5t6qvAAbJJ7GQkUEbiRQcfS9fpv KeiGqKQ2OM9wDzsc0St3k+JS/+kxJ7Pg0m/Z/xrPZuP0+r0mgecUxDMBAUyNtYarUx1z 7JJZv2LgkEhh3Hn5cUuYWNp5jG1vr3LjvH5PpPR+Q5QN3gR05FAWSmGCIoH2mnLG+iwE QT9W0E2NP+yI6gLks9jrH3469Huam6iEgCxSN/8CmWe8yiHOgZRD5ub6KuSElBleYs2o /Gpl7L29KKA1l07j5sIGN+y77XILdzRCuHlI2O0eR2TzQ7HUx3nsPAKi8w7+CVFSwFSV dV5A== X-Received: by 10.129.83.131 with SMTP id h125mr40644308ywb.101.1439478744209; Thu, 13 Aug 2015 08:12:24 -0700 (PDT) Received: from mail-yk0-f176.google.com (mail-yk0-f176.google.com. [209.85.160.176]) by smtp.gmail.com with ESMTPSA id l68sm2260309ywd.49.2015.08.13.08.12.23 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Aug 2015 08:12:23 -0700 (PDT) Received: by ykdz80 with SMTP id z80so43699181ykd.2; Thu, 13 Aug 2015 08:12:23 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.170.142.132 with SMTP id j126mr40139570ykc.117.1439478743484; Thu, 13 Aug 2015 08:12:23 -0700 (PDT) Reply-To: cem@FreeBSD.org Received: by 10.37.10.67 with HTTP; Thu, 13 Aug 2015 08:12:23 -0700 (PDT) In-Reply-To: References: Date: Thu, 13 Aug 2015 08:12:23 -0700 Message-ID: Subject: Re: bhyve: fix bhyve warning CTASSERT From: Conrad Meyer To: Stefano Garzarella Cc: freebsd-current , "freebsd-virtualization@freebsd.org" , Neel Natu , Peter Grehan Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Aug 2015 15:37:24 -0000 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 */ > #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"