[lkml]   [2011]   [Oct]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH 1/7] Add assertion support with annotated oopsing
    Ingo Molnar <> wrote:

    > Looks useful, but i'd suggest to make this a variant of the standard
    > BUG_ON()/WARN_ON() checks we already have, not an explicit assert().
    > BUG_ON_VERBOSE() or such.

    I personally prefer the positive check (ASSERT() saying that this expression
    must be true) as opposed to the negative check (BUG_ON() saying that this must
    be false). I find it easier to think about the logic (I expect value X to be
    like this, value Y to be like that, etc.).

    That said, I could make the base bit BUG_VERBOSE(FMT, ...) and wrap ASSERT*()
    around that.

    However, I'd _much_ rather make it so that I can post the "cut here" message
    early - but, IIRC, Linus hated that idea.

    > I find assert()'s inversion confusing when mixed with WARN_ON()/BUG_ON().

    Why did we do it this way originally, rather than using assert, I wonder?
    Especially since the concept of assert already exists in userspace.

    > Likewise, the message of:
    > ASSERTION FAILED at fs/dcache.c:863!
    > is rather confusing to me (i never know how the condition printed is
    > to be interpreted) - why not use the usual 'BUG: ...' message
    > convention?

    I don't see why it should be confusing. Something bad happened at file:line.

    I could make it print "BUG" instead. That's a minor matter. The ASSERT
    macros in patch 2 could then generate a report that looks like this:

    ------------[ cut here ]------------
    kernel BUG at fs/fscache/main.c:109!
    Assertion failed: 2 > c is false
    invalid opcode: 0000 [#1] SMP


     \ /
      Last update: 2011-10-12 19:27    [W:0.026 / U:10.804 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site