mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Santos <daniel.santos@pobox.com>
To: Vegard Nossum <vegard.nossum@oracle.com>,
	Joe Perches <joe@perches.com>,
	Rasmus Villemoes <rasmus.villemoes@prevas.dk>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Ian Abbott <abbotti@mev.co.uk>
Subject: Re: [PATCH] compiler.h: fix error in BUILD_BUG_ON() reporting
Date: Tue, 31 Mar 2020 20:12:30 -0500	[thread overview]
Message-ID: <c5bf64f2-fac9-ccc5-c65e-f187e55c3aba@pobox.com> (raw)
In-Reply-To: <f3b392d2-d8a4-6788-91b9-d74d98f035a5@oracle.com>

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

  reply	other threads:[~2020-04-01  1:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-31 11:26 Vegard Nossum
2020-03-31 17:31 ` Masahiro Yamada
2020-03-31 18:20 ` Joe Perches
2020-03-31 18:56   ` Rasmus Villemoes
2020-03-31 19:00     ` Joe Perches
2020-03-31 19:05       ` Rasmus Villemoes
2020-03-31 19:08       ` Vegard Nossum
2020-04-01  1:12         ` Daniel Santos [this message]
2020-03-31 22:30     ` Daniel Santos
2020-03-31 22:25 ` Daniel Santos
2020-03-31 22:36   ` Nathan Chancellor
2020-04-01  0:53     ` Daniel Santos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c5bf64f2-fac9-ccc5-c65e-f187e55c3aba@pobox.com \
    --to=daniel.santos@pobox.com \
    --cc=abbotti@mev.co.uk \
    --cc=akpm@linux-foundation.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=rasmus.villemoes@prevas.dk \
    --cc=vegard.nossum@oracle.com \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®