From owner-svn-src-all@freebsd.org Wed Jul 6 16:02:17 2016 Return-Path: Delivered-To: svn-src-all@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 71E88B7594D; Wed, 6 Jul 2016 16:02:17 +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 4DD281F51; Wed, 6 Jul 2016 16:02:17 +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 u66G2GB4080767; Wed, 6 Jul 2016 16:02:16 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u66G2GXq080763; Wed, 6 Jul 2016 16:02:16 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201607061602.u66G2GXq080763@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 16:02:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302373 - 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-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jul 2016 16:02:17 -0000 Author: ngie Date: Wed Jul 6 16:02:15 2016 New Revision: 302373 URL: https://svnweb.freebsd.org/changeset/base/302373 Log: Fix CTASSERT issue in a more clean way - Replace all CTASSERT macro instances with static_assert's. - Remove the WRAPPED_CTASSERT macro; it's now an unnecessary obfuscation. - Localize all static_assert's to the structures being tested. - Sort some headers per-style(9). Approved by: re (hrs) Differential Revision: https://reviews.freebsd.org/D7130 MFC after: 1 week X-MFC with: r302364 Reviewed by: ed, grehan (maintainer) Submitted by: ed Sponsored by: EMC / Isilon Storage Division Modified: head/usr.sbin/bhyve/bhyverun.h head/usr.sbin/bhyve/pci_emul.c head/usr.sbin/bhyve/pci_emul.h head/usr.sbin/bhyve/task_switch.c Modified: head/usr.sbin/bhyve/bhyverun.h ============================================================================== --- head/usr.sbin/bhyve/bhyverun.h Wed Jul 6 14:09:49 2016 (r302372) +++ head/usr.sbin/bhyve/bhyverun.h Wed Jul 6 16:02:15 2016 (r302373) @@ -29,12 +29,6 @@ #ifndef _FBSDRUN_H_ #define _FBSDRUN_H_ -#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] -#endif - #define VMEXIT_CONTINUE (0) #define VMEXIT_ABORT (-1) Modified: head/usr.sbin/bhyve/pci_emul.c ============================================================================== --- head/usr.sbin/bhyve/pci_emul.c Wed Jul 6 14:09:49 2016 (r302372) +++ head/usr.sbin/bhyve/pci_emul.c Wed Jul 6 16:02:15 2016 (r302373) @@ -31,9 +31,9 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include +#include #include #include #include @@ -755,16 +755,6 @@ 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) { Modified: head/usr.sbin/bhyve/pci_emul.h ============================================================================== --- head/usr.sbin/bhyve/pci_emul.h Wed Jul 6 14:09:49 2016 (r302372) +++ head/usr.sbin/bhyve/pci_emul.h Wed Jul 6 16:02:15 2016 (r302373) @@ -160,6 +160,7 @@ struct msicap { uint32_t addrhi; uint16_t msgdata; } __packed; +static_assert(sizeof(struct msicap) == 14, "compile-time assertion failed"); struct msixcap { uint8_t capid; @@ -168,6 +169,7 @@ struct msixcap { uint32_t table_info; /* bar index and offset within it */ uint32_t pba_info; /* bar index and offset within it */ } __packed; +static_assert(sizeof(struct msixcap) == 12, "compile-time assertion failed"); struct pciecap { uint8_t capid; @@ -202,6 +204,7 @@ struct pciecap { uint16_t slot_control2; uint16_t slot_status2; } __packed; +static_assert(sizeof(struct pciecap) == 60, "compile-time assertion failed"); typedef void (*pci_lintr_cb)(int b, int s, int pin, int pirq_pin, int ioapic_irq, void *arg); Modified: head/usr.sbin/bhyve/task_switch.c ============================================================================== --- head/usr.sbin/bhyve/task_switch.c Wed Jul 6 14:09:49 2016 (r302372) +++ head/usr.sbin/bhyve/task_switch.c Wed Jul 6 16:02:15 2016 (r302373) @@ -37,11 +37,11 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include -#include -#include #include @@ -91,7 +91,7 @@ struct tss32 { uint16_t tss_trap; uint16_t tss_iomap; }; -CTASSERT(sizeof(struct tss32) == 104); +static_assert(sizeof(struct tss32) == 104, "compile-time assertion failed"); #define SEL_START(sel) (((sel) & ~0x7)) #define SEL_LIMIT(sel) (((sel) | 0x7))