[RFC] clang, posix: bypass static assert that does not compile with Clang

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Oct 9 10:20:46 UTC 2018


On 08/10/2018 16:07, Daniel Hellstrom wrote:
>>
>> This static assertion ensures that POSIX_SEMAPHORE_VALIDATE_OBJECT() 
>> rejects semaphore pointers with a SEM_FAILED value. We could change 
>> this macro to test also for SEM_FAILED, but it would result in code 
>> like this
>>
>> if (sem == 0 (aka NULL) || sem == 0 (aka SEM_FAILED) || ...)
>>
>> See also:
>>
>> https://gcc.gnu.org/ml/gcc-help/2018-10/msg00021.html
>>
>> Coverity Scan crashes at this line too. GCC issues only a -Wpedantic 
>> warning. In C++ the static assert would be fine. I am not sure how to 
>> fix this.
>>
> I just saw that you have pushed the 
> 1d39e96470b27195d35a69cc94551c403b7980bd commit that updated the 
> RTEMS_STATIC_ASSERT() macro, thanks for updating this. I just wanted 
> to let you know that the issue I'm seeing with clang is still there: 

Yes, this change only affects legacy compilers (non-C11 default mode).

I fixed the static assertion problem like this:

https://git.rtems.org/rtems/commit/?id=acb53d53c900f21b5940554dfba8d7ad94f4bcba

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.




More information about the devel mailing list