Re: [PATCH 4/5] bugs/x86: Augment warnings output by concatenating 'cond_str' with the regular __FILE__ string in _BUG_FLAGS()
From: Peter Zijlstra
Date: Thu Mar 27 2025 - 08:41:49 EST
On Thu, Mar 27, 2025 at 10:36:32AM +0100, Ingo Molnar wrote:
> > > diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h
> > > index aff1c6b7a7f3..e966199c8ef7 100644
> > > --- a/arch/x86/include/asm/bug.h
> > > +++ b/arch/x86/include/asm/bug.h
> > > @@ -50,7 +50,7 @@ do { \
> > > "\t.org 2b+%c3\n" \
> > > ".popsection\n" \
> > > extra \
> > > - : : "i" (__FILE__), "i" (__LINE__), \
> > > + : : "i" (cond_str __FILE__), "i" (__LINE__), \
> > > "i" (flags), \
> > > "i" (sizeof(struct bug_entry))); \
> > > } while (0)
> >
> > Sneaky :-)
>
> BTW., any reason why we go all the trouble with the bug_entry::line u16
> number, instead of storing it in the bug_entry::file string with a
> :__LINE__ postfix or so?
I have no clue; this is well before my time. But yes, that seems a
viable option indeed.