From owner-freebsd-current@FreeBSD.ORG Wed May 13 16:09:45 2015 Return-Path: Delivered-To: freebsd-current@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 C42F0E16; Wed, 13 May 2015 16:09:45 +0000 (UTC) Received: from ppsw-50.csi.cam.ac.uk (ppsw-50.csi.cam.ac.uk [131.111.8.150]) (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 8A58B11D6; Wed, 13 May 2015 16:09:45 +0000 (UTC) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Received: from dhcp-172-17-153-228.eduroam.wireless.private.cam.ac.uk ([172.17.153.228]:61074) by ppsw-50.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.158]:25) with esmtpsa (PLAIN:dc552) (TLSv1:DHE-RSA-AES256-SHA:256) id 1YsZE7-0005DY-rd (Exim 4.82_3-c0e5623) (return-path ); Wed, 13 May 2015 17:09:43 +0100 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2098\)) Subject: Re: CFR: a new __unreachable() builtin From: David Chisnall In-Reply-To: <5553764A.9010202@FreeBSD.org> Date: Wed, 13 May 2015 17:09:43 +0100 Cc: FreeBSD Current Content-Transfer-Encoding: quoted-printable Message-Id: References: <5553764A.9010202@FreeBSD.org> To: Pedro Giffuni X-Mailer: Apple Mail (2.2098) Sender: "Dr D. Chisnall" X-Mailman-Approved-At: Wed, 13 May 2015 16:28:54 +0000 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2015 16:09:45 -0000 On 13 May 2015, at 17:05, Pedro Giffuni wrote: >=20 > Hello; >=20 > I am looking at the cdefs in other BSDs hoping to avoid adopting the > same definitions with incompatible names and I noticed NetBSD is using > a new __builtin_unreachable (void) function from gcc 4.6: >=20 > https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html >=20 > Apparently it was interesting enough that clang implemented it too so > I created a code review differential for it. >=20 > https://reviews.freebsd.org/D2536 >=20 > I don't want to add new C definitions unless they are going to be used > so feel free to comment on the convenience or not of having it. LLVM uses this quite heavily, in a macro that expands to something = equivalent to assert(0 && "unreachable reached!=E2=80=9D) in debug mode = and __builtin_unreachable() in release mode. When you=E2=80=99re = debugging, you get errors if you reach unreachable code and in = deployment the compiler gets a useful hint for optimisation. David