What policy for BUG_ON()?

From: Adrian Bunk (bunk_at_fs.tum.de)
Date: 08/30/04

  • Next message: Pavel Machek: "Re: Fw: x86 build issue with software suspend code"
    Date:	Mon, 30 Aug 2004 22:15:19 +0200
    To: Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>, Jens Axboe <axboe@suse.de>, Matt Mackall <mpm@selenic.com>
    
    

    Let me try to summarize the different options regarding BUG_ON,
    concerning whether the argument to BUG_ON might contain side effects,
    and whether it should be allowed in some "do this only if you _really_
    know what you are doing" situations to let BUG_ON do nothing.

    Options:
    1. BUG_ON must not be defined to do nothing
    1a. side effects are allowed in the argument of BUG_ON
    1b. side effects are not allowed in the argument of BUG_ON
    2. BUG_ON is allowed to be defined to do nothing
    2a. side effects are allowed in the argument of BUG_ON
    2b. side effects are not allowed in the argument of BUG_ON

    It would be good if there was a decision which of the four choices
    should become documented policy.

    <-- snip -->

    My personal opinions:

    IMHO, 1b doesn't make much sense, since in the case of 1. side effects
    are never a problem.

    IMHO, 2b is bad since it might cause nasty heisenbugs if BUG_ON does
    nothing, and preserving the side effects is easy.

    <-- snip -->

    cu
    Adrian

    -- 
           "Is there not promise of rain?" Ling Tan asked suddenly out
            of the darkness. There had been need of rain for many days.
           "Only a promise," Lao Er said.
                                           Pearl S. Buck - Dragon Seed
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at  http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at  http://www.tux.org/lkml/
    

  • Next message: Pavel Machek: "Re: Fw: x86 build issue with software suspend code"

    Relevant Pages

    • [patch] 2.6.0-test5-mm2: ISTALLION UP compile is fixed
      ... Ling Tan asked suddenly out ... There had been need of rain for many days. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • 2.6.9-rc4-mm1: CRASH_DUMP compile error with PROC_FS=n
      ... : undefined reference to `proc_vmcore' ... Ling Tan asked suddenly out ... There had been need of rain for many days. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: linux-2.6.2 Kernel Problem
      ... Please tell your mail client about line breaks. ... Ling Tan asked suddenly out ... There had been need of rain for many days. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • 2.6.6-mm2: EFI_VARS=m is broken
      ... This patch broke EFI_VARS=m: ... Ling Tan asked suddenly out ... There had been need of rain for many days. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: error compiling linux-2.6.6 and 2.6.7-cr1
      ... Networking support ... Ling Tan asked suddenly out ... There had been need of rain for many days. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)