Re: How to clear unused variable warnings created by static assert?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> But perhaps the simplest and least intrusive approach, if you
> can't use static_assert, is to annotate the unused variable with
> attribute unused:
>
>   #define COMPILE_ASSERT_INSTANCE(assertion, instance) \
>     static CompileAssert<(assertion)> \
>       ASSERT_JOIN(assert_, instance) __attribute__ ((unused))
>

I like the sound of this one. To pull it off, I need to ensure the
gear that claims to be GCC (by faking __GNUC__), and GCC itself, can
handle it.

When did GCC add '__attribute__ ((unused))'? We still have GCC 3.x
users (IIRC), so we can't break things for them. There is a shinny
side to the penny: we don't have to support GCC 2.95.

Jeff



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux