public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Sebastian Huber <sebastian.huber@embedded-brains.de>
To: GCC help <gcc-help@gcc.gnu.org>
Subject: Variably modified at file scope due to (void *)0 == (sem_t *)0?
Date: Thu, 04 Oct 2018 08:51:00 -0000	[thread overview]
Message-ID: <1339d0b7-7f3d-699b-d1e6-f79484669af6@embedded-brains.de> (raw)

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.

             reply	other threads:[~2018-10-04  8:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-04  8:51 Sebastian Huber [this message]
2018-10-04  8:58 ` Jonathan Wakely
2018-10-04  9:11   ` Sebastian Huber
2018-10-04 12:28     ` Liu Hao
2018-10-05  5:51       ` Sebastian Huber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1339d0b7-7f3d-699b-d1e6-f79484669af6@embedded-brains.de \
    --to=sebastian.huber@embedded-brains.de \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).