xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] stubdom: fix compile errors in grub
@ 2012-10-10 14:40 Olaf Hering
  2012-10-18  8:35 ` Ian Campbell
  0 siblings, 1 reply; 2+ messages in thread
From: Olaf Hering @ 2012-10-10 14:40 UTC (permalink / raw)
  To: xen-devel

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1349880048 -7200
# Node ID a74e22faa1c90a38345be8fdf333101c07166671
# Parent  384714804b9b2a9742cc45dffaa43b749b85513b
stubdom: fix compile errors in grub

Building xen.rpm in SLES11 started to fail due to these compiler
warnings:

[ 1436s] ../grub-upstream/netboot/fsys_tftp.c:213: warning: operation on 'block' may be undefined
[ 1437s] ../grub-upstream/netboot/main.c:444: warning: operation on 'block' may be undefined

[ 1234s] E: xen sequence-point ../grub-upstream/netboot/fsys_tftp.c:213
[ 1234s] E: xen sequence-point ../grub-upstream/netboot/main.c:444

The reason for this is that the assignment is done twice:
 tp.u.ack.block = ((uint16_t)( (((uint16_t)((block = prevblock)) & (uint16_t)0x00ffU) << 8) | (((uint16_t)((block = prevblock)) & (uint16_t)0xff00U) >> 8)));

Fix this package build error by adding another patch for grub, which
moves the assignment out of the macro usage.

Signed-off-by: Olaf Hering <olaf@aepfle.de>

diff -r 384714804b9b -r a74e22faa1c9 stubdom/grub.patches/70compiler_warnings.diff
--- /dev/null
+++ b/stubdom/grub.patches/70compiler_warnings.diff
@@ -0,0 +1,45 @@
+[ 1436s] ../grub-upstream/netboot/fsys_tftp.c:213: warning: operation on 'block' may be undefined
+[ 1437s] ../grub-upstream/netboot/main.c:444: warning: operation on 'block' may be undefined
+
+[ 1234s] E: xen sequence-point ../grub-upstream/netboot/fsys_tftp.c:213
+[ 1234s] E: xen sequence-point ../grub-upstream/netboot/main.c:444
+
+---
+ netboot/fsys_tftp.c |    5 ++++-
+ netboot/main.c      |    5 ++++-
+ 2 files changed, 8 insertions(+), 2 deletions(-)
+
+Index: grub-0.97/netboot/fsys_tftp.c
+===================================================================
+--- grub-0.97.orig/netboot/fsys_tftp.c
++++ grub-0.97/netboot/fsys_tftp.c
+@@ -209,8 +209,11 @@ buf_fill (int abort)
+ 	break;
+ 
+       if ((block || bcounter) && (block != prevblock + (unsigned short) 1))
++      {
++	      block = prevblock;
+ 	/* Block order should be continuous */
+-	tp.u.ack.block = htons (block = prevblock);
++	tp.u.ack.block = htons (block);
++      }
+       
+       /* Should be continuous.  */
+       tp.opcode = abort ? htons (TFTP_ERROR) : htons (TFTP_ACK);
+Index: grub-0.97/netboot/main.c
+===================================================================
+--- grub-0.97.orig/netboot/main.c
++++ grub-0.97/netboot/main.c
+@@ -440,8 +440,11 @@ tftp (const char *name, int (*fnc) (unsi
+ 	break;
+       
+       if ((block || bcounter) && (block != prevblock + 1))
++      {
++	      block = prevblock;
+ 	/* Block order should be continuous */
+-	tp.u.ack.block = htons (block = prevblock);
++	tp.u.ack.block = htons (block);
++      }
+       
+       /* Should be continuous.  */
+       tp.opcode = htons (TFTP_ACK);

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

* Re: [PATCH] stubdom: fix compile errors in grub
  2012-10-10 14:40 [PATCH] stubdom: fix compile errors in grub Olaf Hering
@ 2012-10-18  8:35 ` Ian Campbell
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Campbell @ 2012-10-18  8:35 UTC (permalink / raw)
  To: Olaf Hering; +Cc: xen-devel@lists.xen.org

On Wed, 2012-10-10 at 15:40 +0100, Olaf Hering wrote:
> # HG changeset patch
> # User Olaf Hering <olaf@aepfle.de>
> # Date 1349880048 -7200
> # Node ID a74e22faa1c90a38345be8fdf333101c07166671
> # Parent  384714804b9b2a9742cc45dffaa43b749b85513b
> stubdom: fix compile errors in grub
> 
> Building xen.rpm in SLES11 started to fail due to these compiler
> warnings:
> 
> [ 1436s] ../grub-upstream/netboot/fsys_tftp.c:213: warning: operation on 'block' may be undefined
> [ 1437s] ../grub-upstream/netboot/main.c:444: warning: operation on 'block' may be undefined
> 
> [ 1234s] E: xen sequence-point ../grub-upstream/netboot/fsys_tftp.c:213
> [ 1234s] E: xen sequence-point ../grub-upstream/netboot/main.c:444
> 
> The reason for this is that the assignment is done twice:
>  tp.u.ack.block = ((uint16_t)( (((uint16_t)((block = prevblock)) & (uint16_t)0x00ffU) << 8) | (((uint16_t)((block = prevblock)) & (uint16_t)0xff00U) >> 8)));
> 
> Fix this package build error by adding another patch for grub, which
> moves the assignment out of the macro usage.
> 
> Signed-off-by: Olaf Hering <olaf@aepfle.de>
> 
> diff -r 384714804b9b -r a74e22faa1c9 stubdom/grub.patches/70compiler_warnings.diff
> --- /dev/null
> +++ b/stubdom/grub.patches/70compiler_warnings.diff
> @@ -0,0 +1,45 @@
> +[ 1436s] ../grub-upstream/netboot/fsys_tftp.c:213: warning: operation on 'block' may be undefined
> +[ 1437s] ../grub-upstream/netboot/main.c:444: warning: operation on 'block' may be undefined
> +
> +[ 1234s] E: xen sequence-point ../grub-upstream/netboot/fsys_tftp.c:213
> +[ 1234s] E: xen sequence-point ../grub-upstream/netboot/main.c:444
> +
> +---
> + netboot/fsys_tftp.c |    5 ++++-
> + netboot/main.c      |    5 ++++-
> + 2 files changed, 8 insertions(+), 2 deletions(-)
> +
> +Index: grub-0.97/netboot/fsys_tftp.c
> +===================================================================
> +--- grub-0.97.orig/netboot/fsys_tftp.c
> ++++ grub-0.97/netboot/fsys_tftp.c
> +@@ -209,8 +209,11 @@ buf_fill (int abort)
> + 	break;
> + 
> +       if ((block || bcounter) && (block != prevblock + (unsigned short) 1))
> ++      {
> ++	      block = prevblock;
> + 	/* Block order should be continuous */
> +-	tp.u.ack.block = htons (block = prevblock);
> ++	tp.u.ack.block = htons (block);

Both here and the other hunk this line should have been pushed in
another level I think? The existing code looks lie a terrible mixture of
tabs and spaces though, and there's no upstream to send this to so:

Acked and applied.

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

end of thread, other threads:[~2012-10-18  8:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-10 14:40 [PATCH] stubdom: fix compile errors in grub Olaf Hering
2012-10-18  8:35 ` Ian Campbell

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