Message ID | 1366716185-36913-4-git-send-email-borntraeger@de.ibm.com |
---|---|
State | New |
Headers | show |
On 04/23/2013 01:23 PM, Christian Borntraeger wrote: > Lets fix this gcc warning: > > virtio.c: In function ‘vring_send_buf’: > virtio.c:125:35: error: operation on ‘vr->next_idx’ may be undefined > [-Werror=sequence-point] > > Signed-off-by: Christian Borntraeger<borntraeger@de.ibm.com> > --- > pc-bios/s390-ccw/virtio.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c > index 79e2941..1968fc6 100644 > --- a/pc-bios/s390-ccw/virtio.c > +++ b/pc-bios/s390-ccw/virtio.c > @@ -122,7 +122,9 @@ static void vring_send_buf(struct vring *vr, void *p, int len, int flags) > vr->desc[vr->next_idx].addr = (ulong)p; > vr->desc[vr->next_idx].len = len; > vr->desc[vr->next_idx].flags = flags& ~VRING_HIDDEN_IS_CHAIN; > - vr->desc[vr->next_idx].next = ++vr->next_idx; > + vr->desc[vr->next_idx].next = vr->next_idx; > + vr->desc[vr->next_idx].next++; > + vr->next_idx++; Hrm. This looks a lot more complicated than it needs to. Why is gcc emitting a warning here? Maybe it only wants braces. Please try whether .next = ++(vr->next_id); works for you. Alex
On 23/04/13 13:31, Alexander Graf wrote: > On 04/23/2013 01:23 PM, Christian Borntraeger wrote: >> Lets fix this gcc warning: >> >> virtio.c: In function ‘vring_send_buf’: >> virtio.c:125:35: error: operation on ‘vr->next_idx’ may be undefined >> [-Werror=sequence-point] >> >> Signed-off-by: Christian Borntraeger<borntraeger@de.ibm.com> >> --- >> pc-bios/s390-ccw/virtio.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c >> index 79e2941..1968fc6 100644 >> --- a/pc-bios/s390-ccw/virtio.c >> +++ b/pc-bios/s390-ccw/virtio.c >> @@ -122,7 +122,9 @@ static void vring_send_buf(struct vring *vr, void *p, int len, int flags) >> vr->desc[vr->next_idx].addr = (ulong)p; >> vr->desc[vr->next_idx].len = len; >> vr->desc[vr->next_idx].flags = flags& ~VRING_HIDDEN_IS_CHAIN; >> - vr->desc[vr->next_idx].next = ++vr->next_idx; >> + vr->desc[vr->next_idx].next = vr->next_idx; >> + vr->desc[vr->next_idx].next++; >> + vr->next_idx++; > > Hrm. This looks a lot more complicated than it needs to. Why is gcc emitting a warning here? Maybe it only wants braces. Please try whether > > .next = ++(vr->next_id); > > works for you. > > > Alex > > I already did that, but I get the same error message. I dont understand why gcc emits that warning, but it does :-(
On 23.04.2013, at 13:45, Christian Borntraeger wrote: > On 23/04/13 13:31, Alexander Graf wrote: >> On 04/23/2013 01:23 PM, Christian Borntraeger wrote: >>> Lets fix this gcc warning: >>> >>> virtio.c: In function ‘vring_send_buf’: >>> virtio.c:125:35: error: operation on ‘vr->next_idx’ may be undefined >>> [-Werror=sequence-point] >>> >>> Signed-off-by: Christian Borntraeger<borntraeger@de.ibm.com> >>> --- >>> pc-bios/s390-ccw/virtio.c | 4 +++- >>> 1 file changed, 3 insertions(+), 1 deletion(-) >>> >>> diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c >>> index 79e2941..1968fc6 100644 >>> --- a/pc-bios/s390-ccw/virtio.c >>> +++ b/pc-bios/s390-ccw/virtio.c >>> @@ -122,7 +122,9 @@ static void vring_send_buf(struct vring *vr, void *p, int len, int flags) >>> vr->desc[vr->next_idx].addr = (ulong)p; >>> vr->desc[vr->next_idx].len = len; >>> vr->desc[vr->next_idx].flags = flags& ~VRING_HIDDEN_IS_CHAIN; >>> - vr->desc[vr->next_idx].next = ++vr->next_idx; >>> + vr->desc[vr->next_idx].next = vr->next_idx; >>> + vr->desc[vr->next_idx].next++; >>> + vr->next_idx++; >> >> Hrm. This looks a lot more complicated than it needs to. Why is gcc emitting a warning here? Maybe it only wants braces. Please try whether >> >> .next = ++(vr->next_id); >> >> works for you. >> >> >> Alex >> >> > > I already did that, but I get the same error message. I dont understand why gcc emits that warning, > but it does :-( *shrug* I'll just add it to the queue. Alex
diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c index 79e2941..1968fc6 100644 --- a/pc-bios/s390-ccw/virtio.c +++ b/pc-bios/s390-ccw/virtio.c @@ -122,7 +122,9 @@ static void vring_send_buf(struct vring *vr, void *p, int len, int flags) vr->desc[vr->next_idx].addr = (ulong)p; vr->desc[vr->next_idx].len = len; vr->desc[vr->next_idx].flags = flags & ~VRING_HIDDEN_IS_CHAIN; - vr->desc[vr->next_idx].next = ++vr->next_idx; + vr->desc[vr->next_idx].next = vr->next_idx; + vr->desc[vr->next_idx].next++; + vr->next_idx++; /* Chains only have a single ID */ if (!(flags & VRING_DESC_F_NEXT)) {
Lets fix this gcc warning: virtio.c: In function ‘vring_send_buf’: virtio.c:125:35: error: operation on ‘vr->next_idx’ may be undefined [-Werror=sequence-point] Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> --- pc-bios/s390-ccw/virtio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)