From owner-svn-src-head@FreeBSD.ORG Fri May 15 10:34:41 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 44DDD2D3; Fri, 15 May 2015 10:34:41 +0000 (UTC) Received: from mailrelay105.isp.belgacom.be (mailrelay105.isp.belgacom.be [195.238.20.132]) by mx1.freebsd.org (Postfix) with ESMTP id 5687B1788; Fri, 15 May 2015 10:34:39 +0000 (UTC) X-Belgacom-Dynamic: yes X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.1 cv=KjSUzZxnmGSQ+6+vr4Kd0OSSUs/Ia9ciENKrYVIfwLU= c=1 sm=2 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=sqNYIKBhKFaNiZG62HEA:9 a=CjuIK1q_8ugA:10 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2B0BgB9ylVV//KPsFtcgw9UUQ23PY59hXYCgTtNAQEBAQEBgQuEIwEBBDocIxALFAQJJQ8qHgYTiDABCNYfAQEBAQEBAQMBAQEBAQEBFwSLOoRSMweELQEElwqGSZcAI4IKHIFUPDGCRgEBAQ Received: from 242.143-176-91.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([91.176.143.242]) by relay.skynet.be with ESMTP; 15 May 2015 12:33:31 +0200 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.14.9/8.14.9) with ESMTP id t4FAXRub091613; Fri, 15 May 2015 12:33:28 +0200 (CEST) (envelope-from tijl@FreeBSD.org) Date: Fri, 15 May 2015 12:33:27 +0200 From: Tijl Coosemans To: "Pedro F. Giffuni" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r282907 - head/sys/sys Message-ID: <20150515123327.45621037@kalimero.tijl.coosemans.org> In-Reply-To: <201505141549.t4EFnnQg094250@svn.freebsd.org> References: <201505141549.t4EFnnQg094250@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 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: Fri, 15 May 2015 10:34:41 -0000 On Thu, 14 May 2015 15:49:49 +0000 (UTC) "Pedro F. Giffuni" wrote: > Author: pfg > Date: Thu May 14 15:49:48 2015 > New Revision: 282907 > URL: https://svnweb.freebsd.org/changeset/base/282907 > > Log: > Add new __unreachable() builtin > > This is one of the few post gcc4.2 builtins that has been implemented by > clang: > > __builtin_unreachable is used to indicate that a specific point in the > program cannot be reached, even if the compiler might otherwise think it > can. This is useful to improve optimization and eliminates certain > warnings. > > Hinted by: NetBSD > Differential Revision: https://reviews.freebsd.org/D2536 > > Modified: > head/sys/sys/cdefs.h > > Modified: head/sys/sys/cdefs.h > ============================================================================== > --- head/sys/sys/cdefs.h Thu May 14 15:14:03 2015 (r282906) > +++ head/sys/sys/cdefs.h Thu May 14 15:49:48 2015 (r282907) > @@ -388,6 +388,12 @@ > #define __alloc_size(x) > #endif > > +#if __has_builtin(__builtin_unreachable) || __GNUC_PREREQ__(4, 6) > +#define __unreachable() __builtin_unreachable() > +#else > +#define __unreachable() do {} while (/*CONSTCOND*/0) __builtin_unreachable() can be used in expressions so I think it's better to replace do-while with ((void)0). You can then do things like this: #define assume(e) ((e) ? (void)0 : __unreachable()) (like assert(e) but without error)