[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7acde2e5-60dd-f384-fda7-1d018608f8e7@pobox.com>
Date: Tue, 31 Mar 2020 17:30:30 -0500
From: Daniel Santos <daniel.santos@...ox.com>
To: Rasmus Villemoes <rasmus.villemoes@...vas.dk>,
Joe Perches <joe@...ches.com>,
Vegard Nossum <vegard.nossum@...cle.com>,
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 1:56 PM, Rasmus Villemoes wrote:
> On 31/03/2020 20.20, Joe Perches wrote:
>> On Tue, 2020-03-31 at 13:26 +0200, Vegard Nossum wrote:
>>> #define compiletime_assert(condition, msg) \
>>> - _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
>>> + _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
>> This might be better using something like __LINE__ ## _ ## __COUNTER__
>>
>> as line # is somewhat useful to identify the specific assert in a file.
>>
> Eh, if the assert fires, doesn't the compiler's diagnostics already
> contain all kinds of location information?
>
> Rasmus
Yes, the diagnostic contains the file name and line in a far more useful
format that every IDE knows how to read. __LINE__ is only used for
uniqueness and was chosen when __COUNTER__ (introduced in gcc 4.3) was
still somewhat new.
Daniel
Powered by blists - more mailing lists