linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@kernel.org>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Arjan van de Ven <arjan@infradead.org>,
	Roland McGrath <roland@redhat.com>,
	torvalds@linux-foundation.org, linux-kernel@vger.kernel.org,
	linux-arch@vger.kernel.org, x86@kernel.org
Subject: Re: [PATCH 1/2] UNREACHABLE() macro
Date: Sun, 13 Sep 2009 13:10:45 -0700	[thread overview]
Message-ID: <4AAD51C5.3050803@kernel.org> (raw)
In-Reply-To: <20090912063840.GR14664@tyan-ft48-01.lab.bos.redhat.com>

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

  parent reply	other threads:[~2009-09-13 20:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-10  1:59 [PATCH 0/2] __builtin_unreachable Roland McGrath
2009-09-10  2:00 ` [PATCH 1/2] UNREACHABLE() macro Roland McGrath
2009-09-11 20:45   ` Andrew Morton
2009-09-11 20:59     ` Kyle McMartin
2009-09-11 20:59       ` Kyle McMartin
2009-09-11 21:55     ` Roland McGrath
2009-09-12  3:49       ` Arjan van de Ven
2009-09-12  4:43         ` H. Peter Anvin
2009-09-12  5:30           ` Arjan van de Ven
2009-09-12  5:30             ` Arjan van de Ven
2009-09-12  5:52           ` Andrew Morton
2009-09-12  6:38             ` Jakub Jelinek
2009-09-12  6:38               ` Jakub Jelinek
2009-09-13 20:10               ` H. Peter Anvin [this message]
2009-09-10  2:01 ` [PATCH 2/2] x86: BUG(): use UNREACHABLE() Roland McGrath
2009-09-10  2:01   ` Roland McGrath
2009-09-10  4:42 ` [PATCH 0/2] __builtin_unreachable Américo Wang
2009-09-10  6:42   ` H. Peter Anvin
2009-09-10  6:13 ` Jakub Jelinek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AAD51C5.3050803@kernel.org \
    --to=hpa@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@infradead.org \
    --cc=jakub@redhat.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roland@redhat.com \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).