From owner-freebsd-arch@FreeBSD.ORG Thu Feb 7 22:33:03 2013 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B0BD6C20 for ; Thu, 7 Feb 2013 22:33:03 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by mx1.freebsd.org (Postfix) with ESMTP id 4EB29291 for ; Thu, 7 Feb 2013 22:33:03 +0000 (UTC) Received: from mailout-de.gmx.net ([10.1.76.33]) by mrigmx.server.lan (mrigmx001) with ESMTP (Nemesis) id 0MQ9JV-1U01Fd1x91-005JoG for ; Thu, 07 Feb 2013 23:33:02 +0100 Received: (qmail invoked by alias); 07 Feb 2013 22:32:57 -0000 Received: from p5B132387.dip.t-dialin.net (EHLO rotluchs.lokal) [91.19.35.135] by mail.gmx.net (mp033) with SMTP; 07 Feb 2013 23:32:57 +0100 X-Authenticated: #1673122 X-Provags-ID: V01U2FsdGVkX18AuFBDDFcAlE1LxpBL4rGuMgGc8cA1XyJF0PV5Yy ScTGBy4Gn3sfMB Message-ID: <51142B42.4020909@gmx.de> Date: Thu, 07 Feb 2013 23:31:30 +0100 From: Christoph Mallon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130129 Thunderbird/17.0.2 MIME-Version: 1.0 To: Hans Petter Selasky Subject: Re: Proposal: Unify printing the function name in panic messages() References: <51141E33.4080103@gmx.de> <201302072247.26167.hselasky@c2i.net> In-Reply-To: <201302072247.26167.hselasky@c2i.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 Cc: Kirk McKusick , freebsd-arch@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 22:33:03 -0000 On 07.02.2013 22:47, Hans Petter Selasky wrote: > On Thursday 07 February 2013 22:35:47 Christoph Mallon wrote: >> /* >> * Panic and automatically prepend the name of the function to the panic >> * message. If NAMED_PANIC is not set, the name is omitted. >> */ >> #ifdef NAMED_PANIC >> # define PANIC(fmt, ...) panic("%s: " fmt, __func__, ##__VA_ARGS__) >> #else >> # define PANIC(fmt) panic(__VA_ARGS__) >> #endif >> > > You mean: > > #define PANIC(...) panic(__VA_ARGS__) Yes, stupid typo. >> Do you have suggestions to improve this proposal? > > Why not make two variants to avoid the #ifdef ? > > PANIC_NAMED(fmt, ...) > > and > > PANIC(...) NAMED_PANIC is intended to be a global option (think WITNESS or INVARIANTS), not to be set at before including systm.h. All panics should either show the function name or not. This way you can shrink the kernel a bit at the flip of a switch. Christoph