[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c5bf64f2-fac9-ccc5-c65e-f187e55c3aba@pobox.com>
Date: Tue, 31 Mar 2020 20:12:30 -0500
From: Daniel Santos <daniel.santos@...ox.com>
To: Vegard Nossum <vegard.nossum@...cle.com>,
Joe Perches <joe@...ches.com>,
Rasmus Villemoes <rasmus.villemoes@...vas.dk>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
Ian Abbott <abbotti@....co.uk>
Subject: Re: [PATCH] compiler.h: fix error in BUILD_BUG_ON() reporting
On 3/31/20 2:08 PM, Vegard Nossum wrote:
>
> __LINE__ is only used currently for creating a unique identifier, as far
> as I can tell.
>
> The way it works is that it creates a function declaration with the
> attribute __attribute__((error(message))), which makes gcc throw an
> error if the function is ever used (i.e. calls are not compiled out).
Back before __attribute__((error())), these macros used to just declare
a function that isn't defined and you only got an error at link-time --
the line number did matter then. Then there was the negative array
index thing.
>
> The number does appear in the output, but it's not even really obvious
> that it's a line number. And the compiler's diagnostics are pretty good
> at showing the whole "stack trace" of where the call came from
> (including the proper line numbers).
>
>
> Vegard
And the stack trace used to be useless without -g or -g3, but I believe
gcc gives the macro expansion back trace without it now. But imo, the
macro expansion back trace is a lot of noise that we can eliminate with
a direct gcc mechanism to break the build on some __builtin_constant_p()
expression.
Daniel
Powered by blists - more mailing lists