From owner-svn-src-head@freebsd.org Wed Jul 6 05:03:01 2016 Return-Path: Delivered-To: svn-src-head@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 127F0B71C28; Wed, 6 Jul 2016 05:03:01 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B334E1833; Wed, 6 Jul 2016 05:03:00 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6652xbq036954; Wed, 6 Jul 2016 05:02:59 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6652xEK036953; Wed, 6 Jul 2016 05:02:59 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201607060502.u6652xEK036953@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Wed, 6 Jul 2016 05:02:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302364 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jul 2016 05:03:01 -0000 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__ +#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 int err; struct pciecap pciecap; - CTASSERT(sizeof(struct pciecap) == 60); - if (type != PCIEM_TYPE_ROOT_PORT) return (-1);