Date: Wed, 13 May 2015 17:09:43 +0100 From: David Chisnall <David.Chisnall@cl.cam.ac.uk> To: Pedro Giffuni <pfg@FreeBSD.org> Cc: FreeBSD Current <freebsd-current@freebsd.org> Subject: Re: CFR: a new __unreachable() builtin Message-ID: <B452A3E8-DCC6-46B4-8066-17E8799072C3@cl.cam.ac.uk> In-Reply-To: <5553764A.9010202@FreeBSD.org> References: <5553764A.9010202@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 13 May 2015, at 17:05, Pedro Giffuni <pfg@FreeBSD.org> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B452A3E8-DCC6-46B4-8066-17E8799072C3>