[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090912063840.GR14664@tyan-ft48-01.lab.bos.redhat.com>
Date: Sat, 12 Sep 2009 08:38:40 +0200
From: Jakub Jelinek <jakub@...hat.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: "H. Peter Anvin" <hpa@...nel.org>,
Arjan van de Ven <arjan@...radead.org>,
Roland McGrath <roland@...hat.com>,
torvalds@...ux-foundation.org, jakub@...hat.com,
linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org,
x86@...nel.org
Subject: Re: [PATCH 1/2] UNREACHABLE() macro
On Fri, Sep 11, 2009 at 10:52:28PM -0700, Andrew Morton wrote:
> On Fri, 11 Sep 2009 21:43:42 -0700 "H. Peter Anvin" <hpa@...nel.org> wrote:
>
> > On 09/11/2009 08:49 PM, Arjan van de Ven wrote:
> > > On Fri, 11 Sep 2009 14:55:25 -0700 (PDT)
> > > Roland McGrath <roland@...hat.com> wrote:
> > >
> > >>> That's a bit of a mouthful. Did you consider a runtime probe with
> > >>> scripts/Kbuild.include's try-run, cc-option, etc?
> > >>
> > >> I did not see any precedent in the sources for using those to test for
> > >> features by compiling particular test sources (i.e. in autoconf
> > >
> > > look at the stackprotector flags.. they work this way already.
> > > It gets done once per kernel build...
> > >
> >
> > 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.
Jakub
--
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