[Mesa-dev] [PATCH] util/u_atomic: use STATIC_ASSERT() when selecting the appropriate function

Emil Velikov emil.l.velikov at gmail.com
Wed May 13 13:00:42 PDT 2015


On 13/05/15 16:43, Matt Turner wrote:
> On Wed, May 13, 2015 at 10:37 AM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
>> As we evaluate sizeof() at compile time, having the run-time assert()
>> does not provide any benefits. Move to the compile-time version
>> STATIC_ASSERT() which will kindly prompt us when this go wrong.
>>
>> Cc: Matt Turner <mattst88 at gmail.com>
>> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
>> ---
> 
> Oh, good idea. Presumably you confirmed that the STATIC_ASSERT
> triggers at compile-time when you pass an unsupported type to the
> macro? If so,
> 
With some hacking[1] it did trigger. Just in case, Vinson - can you try
this patch [2] on a Windows/SolarisOS VM please ?

> Reviewed-by: Matt Turner <mattst88 at gmail.com>
> 
Thanks !


-Emil

[1] The asserts are only for the Windows/Solaris code, so I copied the
logic to the Linux/GCC build, and dropped on the "sizeof(*v) ==
sizeof(uint64_t)" case.

[2] http://patchwork.freedesktop.org/patch/49235/


More information about the mesa-dev mailing list