This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


> 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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]