[Mesa-dev] [PATCH 1/7] util: add MAYBE_UNUSED for config dependent variables

Ian Romanick idr at freedesktop.org
Tue Apr 19 19:16:57 UTC 2016


On 04/19/2016 11:47 AM, Emil Velikov wrote:
> On 19 April 2016 at 19:38, Ian Romanick <idr at freedesktop.org> wrote:
>> The only things in macros.h that are related and use lower case are
>> likely, unlikely, unreachable, and assume.  All four of those are lower
>> case because they mimic keywords in some compiler.  We don't need a new
>> spelling (or capitalization) of a name for a thing that already has a
>> name.
> That's the reason for my confusion - how come the likely and friends
> "mimic some compiler" while ATTRIBUTE_CONST and co. do not ? I don't
> mean to inspire a ragewar/etc. just wondering about where one draws
> the line. Can you please shed a light ?

What compiler has a keyword for that?  In GCC (and clang?) it's a big
pile of __attribute__((herpaderp)) junk, and MSVC has nothing.  That was
definitely true years ago when the various ATTRIBUTE_* were added.  If
there are compiler keywords (especially ones part of future C++XYZ or
CXYZ), I would entertain patches to globally change them.

There are some things in
https://github.com/philipaconrad/compiler-annotations/blob/master/nota.h...
but it looks like we already do the ones supported by both compilers.

http://stackoverflow.com/questions/2354784/attribute-formatprintf-1-2-for-msvc
suggests that we could support PRINTFLIKE for MSVC, but the syntax is
completely different, and it's not common across MSVC versions.



More information about the mesa-dev mailing list