From owner-svn-src-head@FreeBSD.ORG Wed May 15 05:00:41 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id CD27D779; Wed, 15 May 2013 05:00:41 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from mail1.ozon.ru (mx4.ozon.ru [194.186.179.140]) by mx1.freebsd.org (Postfix) with ESMTP id 6593694D; Wed, 15 May 2013 05:00:41 +0000 (UTC) Received: from intmail03msk.ozon (intmail03msk.ozon [10.18.18.171]) by mail1.ozon.ru (Postfix) with ESMTP id A91F1719B59; Wed, 15 May 2013 09:00:40 +0400 (MSK) Received: from mail pickup service by intmail03msk.ozon with Microsoft SMTPSVC; Wed, 15 May 2013 08:56:18 +0400 Received: from intmail03msk.ozon ([10.18.18.171]) by intmail02msk.ozon with Microsoft SMTPSVC(6.0.3790.4675); Tue, 14 May 2013 01:47:48 +0400 Received: from mail1.ozon.ru ([194.186.179.140]) by intmail03msk.ozon with Microsoft SMTPSVC(6.0.3790.4675); Tue, 14 May 2013 01:47:44 +0400 Received: from localhost (localhost [127.0.0.1]) by mail1.ozon.ru (Postfix) with ESMTP id 683C871A8FF for ; Tue, 14 May 2013 01:47:44 +0400 (MSK) X-Virus-Scanned: amavisd-new at ozon.ru Received: from mail1.ozon.ru ([127.0.0.1]) by localhost (mx4.ozon.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id faS-hog+mDFD for ; Tue, 14 May 2013 01:47:36 +0400 (MSK) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received-SPF: pass (freebsd.org: 8.8.178.116 is authorized to use 'owner-svn-src-all@freebsd.org' in 'mfrom' identity (mechanism 'ip4:8.8.178.116' matched)) receiver=mx4.ozon.ru; identity=mfrom; envelope-from="owner-svn-src-all@freebsd.org"; helo=mx2.freebsd.org; client-ip=8.8.178.116 Received: from mx2.freebsd.org (mx2.FreeBSD.org [8.8.178.116]) by mail1.ozon.ru (Postfix) with ESMTP id 62D1471A8FE for ; Tue, 14 May 2013 01:47:36 +0400 (MSK) Received: from hub.freebsd.org (hub.freebsd.org [IPv6:2001:1900:2254:206c::16:88]) by mx2.freebsd.org (Postfix) with ESMTP id E3D8218F6; Mon, 13 May 2013 21:47:32 +0000 (UTC) Received: from hub.freebsd.org (hub.freebsd.org [IPv6:2001:1900:2254:206c::16:88]) by hub.freebsd.org (Postfix) with ESMTP id E12C5C78; Mon, 13 May 2013 21:47:30 +0000 (UTC) (envelope-from owner-svn-src-all@freebsd.org) Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4C758B18; Mon, 13 May 2013 21:47:18 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 23863CFA; Mon, 13 May 2013 21:47:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r4DLlIm1004253; Mon, 13 May 2013 21:47:18 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r4DLlHBr004251; Mon, 13 May 2013 21:47:17 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201305132147.r4DLlHBr004251@svn.freebsd.org> From: Ed Schouten Date: Mon, 13 May 2013 21:47:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r250624 - in head/sys: amd64/amd64 i386/i386 X-SVN-Group: head MIME-Version: 1.0 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: owner-svn-src-all@freebsd.org Sender: owner-svn-src-all@freebsd.org X-OriginalArrivalTime: 13 May 2013 21:47:44.0314 (UTC) FILETIME=[801329A0:01CE5023] X-BeenThere: svn-src-head@freebsd.org 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, 15 May 2013 05:00:41 -0000 Author: ed Date: Mon May 13 21:47:17 2013 New Revision: 250624 URL: http://svnweb.freebsd.org/changeset/base/250624 Log: Improve readability of static assertions for OFFSET_* macros. Instead of doing all sorts of weird casting of constants to pointer-pointers, simply use the standard C offsetof() macro to obtain the offset of the respective fields in the structures. Modified: head/sys/amd64/amd64/vm_machdep.c head/sys/i386/i386/vm_machdep.c Modified: head/sys/amd64/amd64/vm_machdep.c ============================================================================== --- head/sys/amd64/amd64/vm_machdep.c Mon May 13 21:46:07 2013 (r250623) +++ head/sys/amd64/amd64/vm_machdep.c Mon May 13 21:47:17 2013 (r250624) @@ -90,9 +90,10 @@ static u_int cpu_reset_proxyid; static volatile u_int cpu_reset_proxy_active; #endif -CTASSERT((struct thread **)OFFSETOF_CURTHREAD == - &((struct pcpu *)NULL)->pc_curthread); -CTASSERT((struct pcb **)OFFSETOF_CURPCB == &((struct pcpu *)NULL)->pc_curpcb); +_Static_assert(OFFSETOF_CURTHREAD == offsetof(struct pcpu, pc_curthread), + "OFFSETOF_CURTHREAD does not correspond with offset of pc_curthread."); +_Static_assert(OFFSETOF_CURPCB == offsetof(struct pcpu, pc_curpcb), + "OFFSETOF_CURPCB does not correspond with offset of pc_curpcb."); struct savefpu * get_pcb_user_save_td(struct thread *td) Modified: head/sys/i386/i386/vm_machdep.c ============================================================================== --- head/sys/i386/i386/vm_machdep.c Mon May 13 21:46:07 2013 (r250623) +++ head/sys/i386/i386/vm_machdep.c Mon May 13 21:47:17 2013 (r250624) @@ -106,9 +106,10 @@ __FBSDID("$FreeBSD$"); #define NSFBUFS (512 + maxusers * 16) #endif -CTASSERT((struct thread **)OFFSETOF_CURTHREAD == - &((struct pcpu *)NULL)->pc_curthread); -CTASSERT((struct pcb **)OFFSETOF_CURPCB == &((struct pcpu *)NULL)->pc_curpcb); +_Static_assert(OFFSETOF_CURTHREAD == offsetof(struct pcpu, pc_curthread), + "OFFSETOF_CURTHREAD does not correspond with offset of pc_curthread."); +_Static_assert(OFFSETOF_CURPCB == offsetof(struct pcpu, pc_curpcb), + "OFFSETOF_CURPCB does not correspond with offset of pc_curpcb."); static void cpu_reset_real(void); #ifdef SMP _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"