All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Daney <ddaney@caviumnetworks.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Michael Buesch <mb@bu3sch.de>,
	linuxppc-dev@lists.ozlabs.org, torvalds@linux-foundation.org,
	akpm@linux-foundation.org, linux-mips@linux-mips.org,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	linuxppc-dev@ozlabs.org, Paul Mackerras <paulus@samba.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	linux-s390@vger.kernel.org, linux-am33-list@redhat.com,
	Helge Deller <deller@gmx.de>,
	x86@kernel.org, Ingo Molnar <mingo@redhat.com>,
	Mike Frysinger <vapier@gentoo.org>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	uclinux-dist-devel@blackfin.uclinux.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Richard Henderson <rth@twiddle.net>,
	Haavard Skinnemoen <hskinnemoen@atmel.com>,
	linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org,
	ralf@linux-mips.org, Kyle McMartin <kyle@mcmartin.ca>,
	linux-alpha@vger.kernel.org,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	linux390@de.ibm.com, Koichi Y
Subject: Re: [PATCH 01/10] Add support for GCC-4.5's __builtin_unreachable() to compiler.h
Date: Mon, 14 Sep 2009 08:40:23 -0700	[thread overview]
Message-ID: <4AAE63E7.90909@caviumnetworks.com> (raw)
In-Reply-To: <10f740e80909120022m72ad5ea7t692fba93cd3114e9@mail.gmail.com>

Geert Uytterhoeven wrote:
> On Fri, Sep 11, 2009 at 17:58, David Daney<ddaney@caviumnetworks.com> wrote:
>> Michael Buesch wrote:
>>> On Friday 11 September 2009 01:56:42 David Daney wrote:
>>>> +/* Unreachable code */
>>>> +#ifndef unreachable
>>>> +# define unreachable() do { for (;;) ; } while (0)
>>>> +#endif
>>> # define unreachable() do { } while (1)
>>>
>>> ? :)
>> Clearly I was not thinking clearly when I wrote that part.  RTH noted the
>> same thing.  I will fix it.
> 
> However, people are so used to seeing the `do { } while (0)' idiom,
> that they might miss
> there's a `1' here, not a `0'.
> 
> So perhaps it's better to use plain `for (;;)' for infinite loops?
> 

I don't think so.  The only valid token that can follow 'do { } while 
(1)' is ';', any statement may follow 'for (;;)', so there is a greater 
possibility to silently screw things up with the for(;;) form.

David Daney


WARNING: multiple messages have this Message-ID (diff)
From: David Daney <ddaney@caviumnetworks.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Michael Buesch <mb@bu3sch.de>,
	linuxppc-dev@lists.ozlabs.org, torvalds@linux-foundation.org,
	akpm@linux-foundation.org, linux-mips@linux-mips.org,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	linuxppc-dev@ozlabs.org, Paul Mackerras <paulus@samba.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	linux-s390@vger.kernel.org, linux-am33-list@redhat.com,
	Helge Deller <deller@gmx.de>,
	x86@kernel.org, Ingo Molnar <mingo@redhat.com>,
	Mike Frysinger <vapier@gentoo.org>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	uclinux-dist-devel@blackfin.uclinux.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Richard Henderson <rth@twiddle.net>,
	Haavard Skinnemoen <hskinnemoen@atmel.com>,
	linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org,
	ralf@linux-mips.org, Kyle McMartin <kyle@mcmartin.ca>,
	linux-alpha@vger.kernel.org,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	linux390@de.ibm.com,
	Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
Subject: Re: [PATCH 01/10] Add support for GCC-4.5's __builtin_unreachable() to compiler.h
Date: Mon, 14 Sep 2009 08:40:23 -0700	[thread overview]
Message-ID: <4AAE63E7.90909@caviumnetworks.com> (raw)
In-Reply-To: <10f740e80909120022m72ad5ea7t692fba93cd3114e9@mail.gmail.com>

Geert Uytterhoeven wrote:
> On Fri, Sep 11, 2009 at 17:58, David Daney<ddaney@caviumnetworks.com> wrote:
>> Michael Buesch wrote:
>>> On Friday 11 September 2009 01:56:42 David Daney wrote:
>>>> +/* Unreachable code */
>>>> +#ifndef unreachable
>>>> +# define unreachable() do { for (;;) ; } while (0)
>>>> +#endif
>>> # define unreachable() do { } while (1)
>>>
>>> ? :)
>> Clearly I was not thinking clearly when I wrote that part.  RTH noted the
>> same thing.  I will fix it.
> 
> However, people are so used to seeing the `do { } while (0)' idiom,
> that they might miss
> there's a `1' here, not a `0'.
> 
> So perhaps it's better to use plain `for (;;)' for infinite loops?
> 

I don't think so.  The only valid token that can follow 'do { } while 
(1)' is ';', any statement may follow 'for (;;)', so there is a greater 
possibility to silently screw things up with the for(;;) form.

David Daney


WARNING: multiple messages have this Message-ID (diff)
From: David Daney <ddaney@caviumnetworks.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Michael Buesch <mb@bu3sch.de>,
	linuxppc-dev@lists.ozlabs.org, torvalds@linux-foundation.org,
	akpm@linux-foundation.org, linux-mips@linux-mips.org,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	linuxppc-dev@ozlabs.org, Paul Mackerras <paulus@samba.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	linux-s390@vger.kernel.org, linux-am33-list@redhat.com,
	Helge Deller <deller@gmx.de>,
	x86@kernel.org, Ingo Molnar <mingo@redhat.com>,
	Mike Frysinger <vapier@gentoo.org>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	uclinux-dist-devel@blackfin.uclinux.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Richard Henderson <rth@twiddle.net>,
	Haavard Skinnemoen <hskinnemoen@atmel.com>,
	linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org,
	ralf@linux-mips.org, Kyle McMartin <kyle@mcmartin.ca>,
	linux-alpha@vger.kernel.org,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	linux390@de.ibm.com, Koichi
Subject: Re: [PATCH 01/10] Add support for GCC-4.5's __builtin_unreachable() to compiler.h
Date: Mon, 14 Sep 2009 08:40:23 -0700	[thread overview]
Message-ID: <4AAE63E7.90909@caviumnetworks.com> (raw)
In-Reply-To: <10f740e80909120022m72ad5ea7t692fba93cd3114e9@mail.gmail.com>

Geert Uytterhoeven wrote:
> On Fri, Sep 11, 2009 at 17:58, David Daney<ddaney@caviumnetworks.com> wrote:
>> Michael Buesch wrote:
>>> On Friday 11 September 2009 01:56:42 David Daney wrote:
>>>> +/* Unreachable code */
>>>> +#ifndef unreachable
>>>> +# define unreachable() do { for (;;) ; } while (0)
>>>> +#endif
>>> # define unreachable() do { } while (1)
>>>
>>> ? :)
>> Clearly I was not thinking clearly when I wrote that part.  RTH noted the
>> same thing.  I will fix it.
> 
> However, people are so used to seeing the `do { } while (0)' idiom,
> that they might miss
> there's a `1' here, not a `0'.
> 
> So perhaps it's better to use plain `for (;;)' for infinite loops?
> 

I don't think so.  The only valid token that can follow 'do { } while 
(1)' is ';', any statement may follow 'for (;;)', so there is a greater 
possibility to silently screw things up with the for(;;) form.

David Daney

WARNING: multiple messages have this Message-ID (diff)
From: David Daney <ddaney@caviumnetworks.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-mips@linux-mips.org,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	linuxppc-dev@ozlabs.org, Paul Mackerras <paulus@samba.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	linux-s390@vger.kernel.org, linux-am33-list@redhat.com,
	Helge Deller <deller@gmx.de>,
	x86@kernel.org, Ingo Molnar <mingo@redhat.com>,
	Mike Frysinger <vapier@gentoo.org>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	linux390@de.ibm.com, Thomas Gleixner <tglx@linutronix.de>,
	Richard Henderson <rth@twiddle.net>,
	Haavard Skinnemoen <hskinnemoen@atmel.com>,
	linux-parisc@vger.kernel.org, torvalds@linux-foundation.org,
	linux-kernel@vger.kernel.org, ralf@linux-mips.org,
	Kyle McMartin <kyle@mcmartin.ca>,
	linux-alpha@vger.kernel.org,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	uclinux-dist-devel@blackfin.uclinux.org,
	akpm@linux-foundation.org,
	Koichi Yasutake <yasutake.koichi@jp.panasonic.com>,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 01/10] Add support for GCC-4.5's __builtin_unreachable() to compiler.h
Date: Mon, 14 Sep 2009 08:40:23 -0700	[thread overview]
Message-ID: <4AAE63E7.90909@caviumnetworks.com> (raw)
In-Reply-To: <10f740e80909120022m72ad5ea7t692fba93cd3114e9@mail.gmail.com>

Geert Uytterhoeven wrote:
> On Fri, Sep 11, 2009 at 17:58, David Daney<ddaney@caviumnetworks.com> wrote:
>> Michael Buesch wrote:
>>> On Friday 11 September 2009 01:56:42 David Daney wrote:
>>>> +/* Unreachable code */
>>>> +#ifndef unreachable
>>>> +# define unreachable() do { for (;;) ; } while (0)
>>>> +#endif
>>> # define unreachable() do { } while (1)
>>>
>>> ? :)
>> Clearly I was not thinking clearly when I wrote that part.  RTH noted the
>> same thing.  I will fix it.
> 
> However, people are so used to seeing the `do { } while (0)' idiom,
> that they might miss
> there's a `1' here, not a `0'.
> 
> So perhaps it's better to use plain `for (;;)' for infinite loops?
> 

I don't think so.  The only valid token that can follow 'do { } while 
(1)' is ';', any statement may follow 'for (;;)', so there is a greater 
possibility to silently screw things up with the for(;;) form.

David Daney

  reply	other threads:[~2009-09-14 15:40 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-10 23:54 [PATCH 00/10] Add support for GCC's __builtin_unreachable() and use it in BUG David Daney
2009-09-10 23:54 ` David Daney
2009-09-10 23:56 ` [PATCH 01/10] Add support for GCC-4.5's __builtin_unreachable() to compiler.h David Daney
2009-09-10 23:56   ` David Daney
2009-09-10 23:56   ` David Daney
2009-09-10 23:56   ` David Daney
2009-09-11  0:14   ` Richard Henderson
2009-09-11  0:14     ` Richard Henderson
2009-09-11  0:14     ` Richard Henderson
2009-09-11 14:32   ` Michael Buesch
2009-09-11 14:32     ` Michael Buesch
2009-09-11 14:32     ` Michael Buesch
2009-09-11 15:58     ` David Daney
2009-09-11 15:58       ` David Daney
2009-09-11 15:58       ` David Daney
2009-09-11 15:58       ` David Daney
2009-09-12  7:22       ` Geert Uytterhoeven
2009-09-12  7:22         ` Geert Uytterhoeven
2009-09-12  7:22         ` Geert Uytterhoeven
2009-09-12  7:22         ` Geert Uytterhoeven
2009-09-12  7:22         ` Geert Uytterhoeven
2009-09-12  7:22         ` Geert Uytterhoeven
2009-09-14 15:40         ` David Daney [this message]
2009-09-14 15:40           ` David Daney
2009-09-14 15:40           ` David Daney
2009-09-14 15:40           ` David Daney
2009-09-10 23:56 ` [PATCH 02/10] x86: Convert BUG() to use unreachable() David Daney
2009-09-11  0:56   ` H. Peter Anvin
2009-09-11  1:09     ` Roland McGrath
2009-09-11  1:13     ` Linus Torvalds
2009-09-11  1:33       ` H. Peter Anvin
2009-09-11  1:37       ` Roland McGrath
2009-09-11  1:42         ` H. Peter Anvin
2009-09-11  6:07       ` Ingo Molnar
2009-09-11 15:55         ` David Daney
2009-09-13 20:12           ` H. Peter Anvin
2009-09-10 23:56 ` [PATCH 03/10] MIPS: " David Daney
2009-09-10 23:56 ` [PATCH 04/10] s390: " David Daney
2009-09-11 12:18   ` Martin Schwidefsky
2009-09-11 12:18     ` Martin Schwidefsky
2009-09-10 23:56 ` [PATCH 05/10] mn10300: " David Daney
2009-09-10 23:56 ` [PATCH 06/10] parisc: " David Daney
2009-09-28  3:20   ` Kyle McMartin
2009-09-10 23:56 ` [PATCH 07/10] powerpc: " David Daney
2009-09-10 23:56   ` David Daney
2009-09-10 23:56 ` [PATCH 08/10] alpha: " David Daney
2009-09-10 23:56 ` [PATCH 09/10] avr32: " David Daney
2009-09-11  7:31   ` Haavard Skinnemoen
2009-09-10 23:56 ` [PATCH 10/10] blackfin: " David Daney
2009-09-24  3:37 ` [PATCH 00/10] Add support for GCC's __builtin_unreachable() and use it in BUG Benjamin Herrenschmidt

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=4AAE63E7.90909@caviumnetworks.com \
    --to=ddaney@caviumnetworks.com \
    --cc=akpm@linux-foundation.org \
    --cc=deller@gmx.de \
    --cc=geert@linux-m68k.org \
    --cc=heiko.carstens@de.ibm.com \
    --cc=hpa@zytor.com \
    --cc=hskinnemoen@atmel.com \
    --cc=ink@jurassic.park.msu.ru \
    --cc=kyle@mcmartin.ca \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-am33-list@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux390@de.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mb@bu3sch.de \
    --cc=mingo@redhat.com \
    --cc=paulus@samba.org \
    --cc=ralf@linux-mips.org \
    --cc=rth@twiddle.net \
    --cc=schwidefsky@de.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=uclinux-dist-devel@blackfin.uclinux.org \
    --cc=vapier@gentoo.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.