[Mesa-dev] [PATCH 4/7] mesa: Convert some runtime asserts to static asserts.
Kenneth Graunke
kenneth at whitecape.org
Sun Sep 22 21:19:37 PDT 2013
On 09/22/2013 01:53 PM, Dave Airlie wrote:
> On Sun, Sep 22, 2013 at 12:57 AM, Brian Paul <brian.e.paul at gmail.com> wrote:
[snip]
>> It's worrisome that our STATIC_ASSERT macro is silent at compile time
>> when the expression isn't a compile-time constant. The problem with
>> our macro now is variable-sized arrays are OK at compile time.
>
> just as an aside the current S_A macro produces a warning on later gcc's.
>
> kinda a misfeature.
>
> Dave.
Really? I'm not getting a warning with GCC 4.8. I used to, but haven't
since:
commit 5db22494934779a3e7fb7669379d1693ff19d39f
Author: Paul Berry <stereotype441 at gmail.com>
Date: Tue Apr 2 09:51:47 2013 -0700
Avoid spurious GCC warnings in STATIC_ASSERT() macro.
GCC 4.8 now warns about typedefs that are local to a scope and not
used anywhere within that scope. This produced spurious warnings with
the STATIC_ASSERT() macro (which used a typedef to provoke a compile
error in the event of an assertion failure).
This patch switches to a simpler technique that avoids the warning.
v2: Avoid GCC-specific syntax. Also update p_compiler.h.
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
More information about the mesa-dev
mailing list