All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Knutsson <ricknu-0@student.ltu.se>
To: kernel-janitors@vger.kernel.org
Subject: Re: [KJ] is there a kernel standard for assertions?
Date: Sun, 18 Mar 2007 14:15:58 +0000	[thread overview]
Message-ID: <45FD499E.8060001@student.ltu.se> (raw)
In-Reply-To: <Pine.LNX.4.64.0703171550100.8121@CPE00045a9c397f-CM001225dbafb6>

Randy Dunlap wrote:
> On Sun, 18 Mar 2007 04:39:39 +0100 Richard Knutsson wrote:
>
>   
>> Robert P. J. Day wrote:
>>     
>>> On Sat, 17 Mar 2007, Adrian Bunk wrote:
>>>
>>>   
>>>       
>>>> On Sat, Mar 17, 2007 at 02:39:25PM -0600, Matthew Wilcox wrote:
>>>>     
>>>>         
>>>>> On Sat, Mar 17, 2007 at 03:51:49PM -0400, Robert P. J. Day wrote:
>>>>>       
>>>>>           
>>>>>>   it seems like lots of kernel code is re-inventing the idea of an
>>>>>> assertion.  is there no single basic standard for assertions in the
>>>>>> kernel?
>>>>>>         
>>>>>>             
>>>>> BUG_ON().
>>>>>       
>>>>>           
>>>> Or WARN_ON() if it's considered non-fatal.
>>>>     
>>>>         
>>> i'm aware of both of those macros, which is why i'm wondering why so
>>> many developers insist on inventing their own version of an "assert"
>>> routine.  given all of the *existing* debugging routines, shouldn't
>>> inventing your own be discouraged?  is that something that could be
>>> turned into a KJ project of some kind?
>>>   
>>>       
>> Is there any way to just enable the debugging for one sub-system and not 
>> the whole tree?
>>     
>
> A few subsystems have specific debug-enabling config symbols,
> like USB and ACPI and KOBJECT and PM (Power Management) and PCI,
> PCMCIA, NETFILTER, IRDA, IEEE80211, DRIVERS, MTD, PNP, SCSI,
> SPI, SOUND, HID, MMC, EDAC, JBD, JFS, NTFS, UFS, CIFS, DLM,
> and KOBJECTS (just to name some of the big ones).
>
> But BUG_ON() and WARN_ON() are often used without the aid (i.e.,
> enabling) of those DEBUG config symbols.
>   
"Often used without"? Is it possible to enable BUG_ON() and WARN_ON() 
with those config symbols? I can see how to disable ex BUG_ON by:
<in header>

#ifndef DEBUG_CONFIG_SYMBOL

#undef BUG_ON

#define BUG_ON(x)    do {} while(0);

#endif

or

<in code>

#ifdef DEBUG_CONFIG_SYMBOL
	BUG_ON(...)
#endif


But how to enable them when DEBUG is not defined? Otherwise I can 
understand if maintainers do not want to use BUG_ON/WARN_ON and get the 
debugging-info from the whole system.
Would something like SUBSYS_BUG_ON() be acceptable, who are just like 
BUG_ON() but is (en/dis)abled by the subsystems debug-config-symbol? 
(Would require some SUBSYS_BUG_ON_INIT() to define the debug-symbol)

Just my 2c
Richard Knutsson

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors

      parent reply	other threads:[~2007-03-18 14:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-17 19:51 [KJ] is there a kernel standard for assertions? Robert P. J. Day
2007-03-17 20:39 ` Matthew Wilcox
2007-03-17 21:24 ` Adrian Bunk
2007-03-17 21:46 ` Robert P. J. Day
2007-03-17 21:55 ` Arnd Bergmann
2007-03-18  3:39 ` Richard Knutsson
2007-03-18  4:38 ` Randy Dunlap
2007-03-18 14:15 ` Richard Knutsson [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=45FD499E.8060001@student.ltu.se \
    --to=ricknu-0@student.ltu.se \
    --cc=kernel-janitors@vger.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.