Proposal: Unify printing the function name in panic messages()

Christoph Mallon christoph.mallon at gmx.de
Thu Feb 7 22:33:03 UTC 2013


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


More information about the freebsd-arch mailing list