All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Gortmaker <paul.gortmaker@windriver.com>
To: Ingo Molnar <mingo@kernel.org>,
	Richard Weinberger <richard.weinberger@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH/RFC] Deprecate BUG/BUG_ON in favour of BUG_AND_HALT/BUG_AND_HALT_ON
Date: Tue, 6 May 2014 10:35:15 -0400	[thread overview]
Message-ID: <5368F323.7070407@windriver.com> (raw)
In-Reply-To: <20140506073500.GA26303@gmail.com>

On 14-05-06 03:35 AM, Ingo Molnar wrote:
> 
> * Richard Weinberger <richard.weinberger@gmail.com> wrote:
> 
>> On Wed, Apr 30, 2014 at 5:03 PM, Paul Gortmaker
>> <paul.gortmaker@windriver.com> wrote:
>>> A long standing problem for us has been the misuse of BUG/BUG_ON.
>>> The typical misuse is someone only thinking of what represents
>>> a bug in their local code, and especially for people relatively
>>> new to Linux, starting out in device drivers, the appeal of using
>>> BUG w/o knowing what it really does is too great.
>>>

[...]

>>>
>>> +# Dont use BUG/BUG_ON; use WARN/WARN_ON or BUG_AND_HALT/BUG_AND_HALT_ON
>>> +               if ($rawline =~ /^\+.*BUG\(/ || $rawline =~ /^\+.*BUG_ON\(/) {
>>> +                       my $herevet = "$here\n" . cat_vet($rawline) . "\n";
>>> +                       WARN("BUG/BUG_ON",
>>> +                            "Use of BUG/BUG_ON is deprecated. Use WARN/WARN_ON or BUG_AND_HALT/BUG_AND_HALT_ON\n" . $herevet);
>>> +               }
>>> +
>>>  # Check for FSF mailing addresses.
>>>                 if ($rawline =~ /\bwrite to the Free/i ||
>>>                     $rawline =~ /\b59\s+Temple\s+Pl/i ||
>>> --
>>
>> I like the idea but not the name.
>> What about DIE() and DIE_ON()?
> 
> CRASH_ON() might be a suggestive name as well, as from the user's 
> point of view we are crashing her system.

I'd considered HALT_AND_CATCH_FIRE_ON(...) but it was too much typing
and the PC police already forced us to remove that from the lpr driver
decades ago.  So CRASH_ON works for me.  If nobody dislikes the idea,
and we are only bikeshedding over the names, then that is a good thing.

I'll let the idea stew for another day or two and send a renamed v2.

Thanks,
Paul.
--

> 
> Thanks,
> 
> 	Ingo
> 

      parent reply	other threads:[~2014-05-06 14:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-30 15:03 [PATCH/RFC] Deprecate BUG/BUG_ON in favour of BUG_AND_HALT/BUG_AND_HALT_ON Paul Gortmaker
2014-05-03 18:33 ` Richard Weinberger
2014-05-06  7:35   ` Ingo Molnar
2014-05-06  8:08     ` Richard Weinberger
2014-05-06  9:35       ` Ingo Molnar
2014-05-06  9:41         ` Richard Weinberger
2014-05-06 14:35     ` Paul Gortmaker [this message]

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=5368F323.7070407@windriver.com \
    --to=paul.gortmaker@windriver.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=richard.weinberger@gmail.com \
    --cc=torvalds@linux-foundation.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.