qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] seccomp: Work-around GCC 4.x bug in gnu99 mode
@ 2019-01-15 17:32 Thomas Huth
  2019-01-15 17:45 ` Daniel P. Berrangé
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Thomas Huth @ 2019-01-15 17:32 UTC (permalink / raw)
  To: Eduardo Otubo, qemu-devel; +Cc: Daniel P. Berrangé, Markus Armbruster

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.

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] seccomp: Work-around GCC 4.x bug in gnu99 mode
  2019-01-15 17:32 [Qemu-devel] [PATCH] seccomp: Work-around GCC 4.x bug in gnu99 mode Thomas Huth
@ 2019-01-15 17:45 ` Daniel P. Berrangé
  2019-01-15 19:06 ` Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Daniel P. Berrangé @ 2019-01-15 17:45 UTC (permalink / raw)
  To: Thomas Huth; +Cc: Eduardo Otubo, qemu-devel, Markus Armbruster

On Tue, Jan 15, 2019 at 06:32:42PM +0100, Thomas Huth wrote:
> 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.
> 
> 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 }
>  };

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] seccomp: Work-around GCC 4.x bug in gnu99 mode
  2019-01-15 17:32 [Qemu-devel] [PATCH] seccomp: Work-around GCC 4.x bug in gnu99 mode Thomas Huth
  2019-01-15 17:45 ` Daniel P. Berrangé
@ 2019-01-15 19:06 ` Philippe Mathieu-Daudé
  2019-01-18 14:05 ` Eduardo Otubo
  2019-01-23 15:57 ` no-reply
  3 siblings, 0 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-01-15 19:06 UTC (permalink / raw)
  To: Thomas Huth, Eduardo Otubo, qemu-devel; +Cc: Markus Armbruster

On 1/15/19 6:32 PM, Thomas Huth wrote:
> 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.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@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[] = {
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] seccomp: Work-around GCC 4.x bug in gnu99 mode
  2019-01-15 17:32 [Qemu-devel] [PATCH] seccomp: Work-around GCC 4.x bug in gnu99 mode Thomas Huth
  2019-01-15 17:45 ` Daniel P. Berrangé
  2019-01-15 19:06 ` Philippe Mathieu-Daudé
@ 2019-01-18 14:05 ` Eduardo Otubo
  2019-01-23 15:57 ` no-reply
  3 siblings, 0 replies; 6+ messages in thread
From: Eduardo Otubo @ 2019-01-18 14:05 UTC (permalink / raw)
  To: Thomas Huth; +Cc: qemu-devel, Daniel P. Berrangé, Markus Armbruster

[-- Attachment #1: Type: text/plain, Size: 1335 bytes --]

On 15/01/2019 - 18:32:42, Thomas Huth wrote:
> 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.
> 
> 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
> 
Acked-by: Eduardo Otubo <otubo@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] seccomp: Work-around GCC 4.x bug in gnu99 mode
  2019-01-15 17:32 [Qemu-devel] [PATCH] seccomp: Work-around GCC 4.x bug in gnu99 mode Thomas Huth
                   ` (2 preceding siblings ...)
  2019-01-18 14:05 ` Eduardo Otubo
@ 2019-01-23 15:57 ` no-reply
  2019-02-12 10:26   ` Eduardo Otubo
  3 siblings, 1 reply; 6+ messages in thread
From: no-reply @ 2019-01-23 15:57 UTC (permalink / raw)
  To: thuth; +Cc: fam, otubo, qemu-devel, armbru

Patchew URL: https://patchew.org/QEMU/1547573562-32754-1-git-send-email-thuth@redhat.com/



Hi,

This series failed the docker-mingw@fedora build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
time make docker-test-mingw@fedora SHOW_ENV=1 J=14
=== TEST SCRIPT END ===

  CC      backends/rng-egd.o
  CC      backends/tpm.o
/tmp/qemu-test/src/block/sheepdog.c: In function 'find_vdi_name':
/tmp/qemu-test/src/block/sheepdog.c:1239:5: error: 'strncpy' specified bound 256 equals destination size [-Werror=stringop-truncation]
     strncpy(buf + SD_MAX_VDI_LEN, tag, SD_MAX_VDI_TAG_LEN);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors


The full log is available at
http://patchew.org/logs/1547573562-32754-1-git-send-email-thuth@redhat.com/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] seccomp: Work-around GCC 4.x bug in gnu99 mode
  2019-01-23 15:57 ` no-reply
@ 2019-02-12 10:26   ` Eduardo Otubo
  0 siblings, 0 replies; 6+ messages in thread
From: Eduardo Otubo @ 2019-02-12 10:26 UTC (permalink / raw)
  To: qemu-devel; +Cc: thuth, fam, armbru

[-- Attachment #1: Type: text/plain, Size: 1336 bytes --]

On 23/01/2019 - 07:57:51, no-reply@patchew.org wrote:
> Patchew URL: https://patchew.org/QEMU/1547573562-32754-1-git-send-email-thuth@redhat.com/
> 
> 
> 
> Hi,
> 
> This series failed the docker-mingw@fedora build test. Please find the testing commands and
> their output below. If you have Docker installed, you can probably reproduce it
> locally.
> 
> === TEST SCRIPT BEGIN ===
> #!/bin/bash
> time make docker-test-mingw@fedora SHOW_ENV=1 J=14
> === TEST SCRIPT END ===
> 
>   CC      backends/rng-egd.o
>   CC      backends/tpm.o
> /tmp/qemu-test/src/block/sheepdog.c: In function 'find_vdi_name':
> /tmp/qemu-test/src/block/sheepdog.c:1239:5: error: 'strncpy' specified bound 256 equals destination size [-Werror=stringop-truncation]
>      strncpy(buf + SD_MAX_VDI_LEN, tag, SD_MAX_VDI_TAG_LEN);
>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> 
> 
> The full log is available at
> http://patchew.org/logs/1547573562-32754-1-git-send-email-thuth@redhat.com/testing.docker-mingw@fedora/?type=message.
> ---
> Email generated automatically by Patchew [http://patchew.org/].
> Please send your feedback to patchew-devel@redhat.com

This issue was not introduced by the patch itself.
Will send a pull request anyways.

-- 
Eduardo Otubo

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-02-12 10:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-15 17:32 [Qemu-devel] [PATCH] seccomp: Work-around GCC 4.x bug in gnu99 mode Thomas Huth
2019-01-15 17:45 ` Daniel P. Berrangé
2019-01-15 19:06 ` Philippe Mathieu-Daudé
2019-01-18 14:05 ` Eduardo Otubo
2019-01-23 15:57 ` no-reply
2019-02-12 10:26   ` Eduardo Otubo

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).