Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Nov 2017 21:26:24 +0100
From:      Mateusz Guzik <mjguzik@gmail.com>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        Ian Lepore <ian@freebsd.org>, src-committers <src-committers@freebsd.org>,  "Conrad E. Meyer" <cem@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>,  Andriy Gapon <avg@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>, Warner Losh <imp@bsdimp.com>
Subject:   Re: svn commit: r325386 - head/sys/kern
Message-ID:  <CAGudoHGN498vQ2NrbKd9wGJjCV-0WV7ESs3-x5YQyTvoOejbmA@mail.gmail.com>
In-Reply-To: <20171105201503.GH2566@kib.kiev.ua>
References:  <CAG6CVpUaXSX26Bc839kn96EXnUjtGyQ3_eNJPhsRB%2Bv6G6gH1Q@mail.gmail.com> <20171105130607.GA2566@kib.kiev.ua> <CAG6CVpV3SfV8VuNeMJEuN%2BMSu3424mK=HO_-YW9vRt9HEdcJZQ@mail.gmail.com> <20171105173032.GE2566@kib.kiev.ua> <CAG6CVpVQ4RSgz883ezsdExVDQ4RbSiR_y%2BZ5XWDNFeYBpMS-cQ@mail.gmail.com> <CANCZdfqApxd99G-HqVfe4x8EysYJVCAcHksqTeUuBAaYR1OjEA@mail.gmail.com> <20171105190214.GG2566@kib.kiev.ua> <20f694b3-c60c-1b6d-76a1-2ef14cbdd698@FreeBSD.org> <CAG6CVpUuQ-LP9P0ckkkv4Y07aowEhT3qj8e45AK-Nnzhh_LnMA@mail.gmail.com> <1509910670.99235.70.camel@freebsd.org> <20171105201503.GH2566@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Nov 5, 2017 at 9:15 PM, Konstantin Belousov <kostikbel@gmail.com>
wrote:

> On Sun, Nov 05, 2017 at 12:37:50PM -0700, Ian Lepore wrote:
> > IMO, the only reason ASSERT-style macros exist is to hide the
> > conditional-on-build-type part of the operation.  That is, to avoid
> > having #ifdef INVARIANTS scattered everywhere.
> bde' point is that KASSERT() is badly designed, and I agree with him.
> Now we could at least remove the () around the message formatting part,
> but it is too late.
>
> >
> > Creating a macro to generate always-on error detection and reporting
> > code just because there exists a macro to do so conditionally seems to
> > turn the world on its head.
> I agree with this statement.  if()panic(); construct is good enough, IMO.
>

I don't like our panic messages whatsoever, they are quite often not
informative.

For instance consider:
if (obj->foo < bar)
    panic("bad foo %d, have fun looking for bar");

Instead a macro akin to PASS(obj->foo, <, bar, "obj %p", obj); can
expand itself to stringify the first 3 terms and also show the compared
values. Saves on boiler-plate written by hand.

I think *all* panics should be accompanied with a linux's oops-like dump.

I'm not volunteering for any of it though.

-- 
Mateusz Guzik <mjguzik gmail.com>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGudoHGN498vQ2NrbKd9wGJjCV-0WV7ESs3-x5YQyTvoOejbmA>