qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Li Qiang" <liq3ea@163.com>,
	groug@kaod.org, clg@kaod.org, mst@redhat.com
Subject: [Qemu-devel] [PULL v3 26/28] seccomp: Work-around GCC 4.x bug in gnu99 mode
Date: Thu, 17 Jan 2019 14:38:12 +0100	[thread overview]
Message-ID: <1547732292-14021-4-git-send-email-thuth@redhat.com> (raw)
In-Reply-To: <1547732292-14021-1-git-send-email-thuth@redhat.com>

We'd like to compile QEMU with -std=gnu99, but GCC 4.8 currently
fails to compile qemu-seccomp.c in this mode:

qemu-seccomp.c:45:1: error: initializer element is not constant
 };
 ^
qemu-seccomp.c:45:1: error: (near initialization for ‘sched_setscheduler_arg[0]’)

This is due to a compiler bug which has just been fixed in GCC 5.0:

 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63567

Since we still want to support GCC 4.8 for a while and also want to use
gnu99 mode, work-around the issue by expanding the macro manually.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 qemu-seccomp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/qemu-seccomp.c b/qemu-seccomp.c
index 5c73e6a..36d5829 100644
--- a/qemu-seccomp.c
+++ b/qemu-seccomp.c
@@ -41,7 +41,8 @@ struct QemuSeccompSyscall {
 };
 
 const struct scmp_arg_cmp sched_setscheduler_arg[] = {
-    SCMP_A1(SCMP_CMP_NE, SCHED_IDLE)
+    /* was SCMP_A1(SCMP_CMP_NE, SCHED_IDLE), but expanded due to GCC 4.x bug */
+    { .arg = 1, .op = SCMP_CMP_NE, .datum_a = SCHED_IDLE }
 };
 
 static const struct QemuSeccompSyscall blacklist[] = {
-- 
1.8.3.1

  parent reply	other threads:[~2019-01-17 13:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-17 13:38 [Qemu-devel] [PULL v3 00/28] ivshmem deprecation, qtests, typedefs and gnu99 Thomas Huth
2019-01-17 13:38 ` [Qemu-devel] [PULL v3 23/28] ppc: Fix duplicated typedefs to be able to compile with Clang in gnu99 mode Thomas Huth
2019-01-17 13:38 ` [Qemu-devel] [PULL v3 25/28] block: Work-around a bug in libiscsi 1.9.0 when used " Thomas Huth
2019-01-17 13:38 ` Thomas Huth [this message]
2019-02-12 10:35   ` [Qemu-devel] [PULL v3 26/28] seccomp: Work-around GCC 4.x bug " Eduardo Otubo
2019-01-18 11:47 ` [Qemu-devel] [PULL v3 00/28] ivshmem deprecation, qtests, typedefs and gnu99 Peter Maydell
2019-01-18 13:15   ` Philippe Mathieu-Daudé
2019-01-18 13:23     ` Philippe Mathieu-Daudé
2019-01-18 14:20   ` Peter Maydell
2019-01-18 18:26     ` Philippe Mathieu-Daudé
2019-01-18 18:31       ` Peter Maydell
2019-01-21 14:43 ` Peter Maydell
2019-01-21 17:42   ` Philippe Mathieu-Daudé
2019-01-21 18:59     ` Philippe Mathieu-Daudé

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=1547732292-14021-4-git-send-email-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=clg@kaod.org \
    --cc=f4bug@amsat.org \
    --cc=groug@kaod.org \
    --cc=liq3ea@163.com \
    --cc=mst@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.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 NNTP newsgroup(s).