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]

Variably modified at file scope due to (void *)0 == (sem_t *)0?


Hello,

I use a typedef for static assertions for pre C11 compilers. For one static assertion

typedef struct { int i; } sem_t;

typedef int static_assert_sem_failed [((void *)0 == (sem_t *)0) ? 1 : -1];

_Static_assert((void *)0 == (sem_t *)0, "sem_failed");

I get a warning like this:

gcc -S -o - sa.c > /dev/null
sa.c:3:1: warning: variably modified ‘static_assert_sem_failed’ at file scope
 typedef int static_assert_sem_failed [((void *)0 == (sem_t *)0) ? 1 : -1];
 ^~~~~~~

Is there some way to get around this warning? The same expression in the _Static_assert() doen't lead to a warning.

--
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@embedded-brains.de
PGP     : Public key available on request.

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]