[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4AAD51C5.3050803@kernel.org>
Date: Sun, 13 Sep 2009 13:10:45 -0700
From: "H. Peter Anvin" <hpa@...nel.org>
To: Jakub Jelinek <jakub@...hat.com>
CC: Andrew Morton <akpm@...ux-foundation.org>,
Arjan van de Ven <arjan@...radead.org>,
Roland McGrath <roland@...hat.com>,
torvalds@...ux-foundation.org, linux-kernel@...r.kernel.org,
linux-arch@...r.kernel.org, x86@...nel.org
Subject: Re: [PATCH 1/2] UNREACHABLE() macro
On 09/11/2009 11:38 PM, Jakub Jelinek wrote:
>>>
>>> That works for flags, but not for the presence of builtin functions.
>>> You can't even just try compiling something, since it will turn into an
>>> ordinary function if not present... not obvious until link.
>>
>> Use -Wall -Werror and if the compiler doesn't know about
>> __builtin_unreachable() it will error out.
>
> Yeah, e.g. checking exit status of:
> echo '__attribute__((noreturn)) void foo (void) { asm volatile ("" : : : "memory"); __builtin_unreachable (); }' | gcc -S -O2 -W -Wall -Werror -xc - -o /dev/null > /dev/null 2>/dev/null
> works.
>
OK, that makes sense... although perhaps it would be cleaner to use
something that could work for other builtins.
One advantage of using "nm" would be that it could answer the general
question "does this version of gcc support __builtin_X() without
resorting to libgcc", which matters quite a bit for functions like
__builtin_ctzl() and so on.
-hpa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists