diff mbox

virtio-serial: Fix compile error

Message ID 1476752749-41210-1-git-send-email-aik@ozlabs.ru
State Accepted
Headers show

Commit Message

Alexey Kardashevskiy Oct. 18, 2016, 1:05 a.m. UTC
This stops using C99 declaration which breaks compile on gcc 4.8.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---

Thomas,

please give it a try.

Also, where did you get that gcc from? Everything I have around has
switched to 5.x already.

---
 lib/libvirtio/virtio-serial.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Thomas Huth Oct. 18, 2016, 6:19 a.m. UTC | #1
On 18.10.2016 03:05, Alexey Kardashevskiy wrote:
> This stops using C99 declaration which breaks compile on gcc 4.8.
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
> 
> Thomas,
> 
> please give it a try.
> 
> Also, where did you get that gcc from? Everything I have around has
> switched to 5.x already.
> 
> ---
>  lib/libvirtio/virtio-serial.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/libvirtio/virtio-serial.c b/lib/libvirtio/virtio-serial.c
> index 6234346..d2eac63 100644
> --- a/lib/libvirtio/virtio-serial.c
> +++ b/lib/libvirtio/virtio-serial.c
> @@ -38,6 +38,7 @@ int virtio_serial_init(struct virtio_device *dev)
>  {
>  	struct vring_avail *vq_avail;
>  	int status = VIRTIO_STAT_ACKNOWLEDGE;
> +	int i;
>  
>  	/* Reset device */
>  	virtio_reset_device(dev);
> @@ -68,7 +69,7 @@ int virtio_serial_init(struct virtio_device *dev)
>  	}
>  
>  	/* Prepare receive buffer queue */
> -	for (int i = 0; i < RX_NUM_ELEMS; i++) {
> +	for (i = 0; i < RX_NUM_ELEMS; i++) {
>  		uint64_t addr = (uint64_t)vq_rx.buf_mem + i * RX_ELEM_SIZE;
>  
>  		/* Descriptor for data: */
> 

Tested-by: Thomas Huth <thuth@redhat.com>
Thomas Huth Oct. 25, 2016, 9:03 a.m. UTC | #2
On 18.10.2016 08:19, Thomas Huth wrote:
> On 18.10.2016 03:05, Alexey Kardashevskiy wrote:
>> This stops using C99 declaration which breaks compile on gcc 4.8.
>>
>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>> ---
>>
>> Thomas,
>>
>> please give it a try.
>>
>> Also, where did you get that gcc from? Everything I have around has
>> switched to 5.x already.

Ah, I just noticed that I forgot to answer that question: The ATC
compilers can be downloaded from:

ftp://ftp.unicamp.br/pub/linuxpatch/toolchain/at/

... and yes, at7.0 is quite old already, but it still works fine on my
RHEL installation.

 Thomas
diff mbox

Patch

diff --git a/lib/libvirtio/virtio-serial.c b/lib/libvirtio/virtio-serial.c
index 6234346..d2eac63 100644
--- a/lib/libvirtio/virtio-serial.c
+++ b/lib/libvirtio/virtio-serial.c
@@ -38,6 +38,7 @@  int virtio_serial_init(struct virtio_device *dev)
 {
 	struct vring_avail *vq_avail;
 	int status = VIRTIO_STAT_ACKNOWLEDGE;
+	int i;
 
 	/* Reset device */
 	virtio_reset_device(dev);
@@ -68,7 +69,7 @@  int virtio_serial_init(struct virtio_device *dev)
 	}
 
 	/* Prepare receive buffer queue */
-	for (int i = 0; i < RX_NUM_ELEMS; i++) {
+	for (i = 0; i < RX_NUM_ELEMS; i++) {
 		uint64_t addr = (uint64_t)vq_rx.buf_mem + i * RX_ELEM_SIZE;
 
 		/* Descriptor for data: */