[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH V2] build: remove compile warning
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH V2] build: remove compile warning |
Date: |
Tue, 18 Jun 2013 12:13:38 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6 |
Il 07/06/2013 14:17, Markus Armbruster ha scritto:
>> diff --git a/util/iov.c b/util/iov.c
>> index cc6e837..b91cfb9 100644
>> --- a/util/iov.c
>> +++ b/util/iov.c
>> @@ -146,7 +146,7 @@ ssize_t iov_send_recv(int sockfd, struct iovec *iov,
>> unsigned iov_cnt,
>> {
>> ssize_t total = 0;
>> ssize_t ret;
>> - size_t orig_len, tail;
>> + size_t orig_len = 0, tail;
>> unsigned niov;
>>
>> while (bytes > 0) {
>
> Here are the uses of orig_len:
>
> if (tail) {
> /* second, fixup the last element, and remember the original
> * length */
> assert(niov < iov_cnt);
> assert(iov[niov].iov_len > tail);
> orig_len = iov[niov].iov_len;
> iov[niov++].iov_len = tail;
> }
>
> ret = do_send_recv(sockfd, iov, niov, do_send);
>
> /* Undo the changes above before checking for errors */
> if (tail) {
> iov[niov-1].iov_len = orig_len;
> }
>
>
> gcc is too stupid to understand the control flow. The initialization
> shuts it up.
Looks like most people's GCC is not that stupid, or I would have broken
build for everyone, right?
Paolo
- [Qemu-devel] [PATCH V2] build: remove compile warning, Wenchao Xia, 2013/06/07
- Re: [Qemu-devel] [PATCH V2] build: remove compile warning, Stefan Hajnoczi, 2013/06/07
- Re: [Qemu-devel] [PATCH V2] build: remove compile warning, Markus Armbruster, 2013/06/07
- Re: [Qemu-devel] [PATCH V2] build: remove compile warning, Wenchao Xia, 2013/06/07
- Re: [Qemu-devel] [PATCH V2] build: remove compile warning,
Paolo Bonzini <=
- Re: [Qemu-devel] [PATCH V2] build: remove compile warning, Stefan Weil, 2013/06/22
- Re: [Qemu-devel] [PATCH V2] build: remove compile warning, Paolo Bonzini, 2013/06/24
- Re: [Qemu-devel] [PATCH V2] build: remove compile warning, Stefan Weil, 2013/06/24
- Re: [Qemu-devel] [PATCH V2] build: remove compile warning, Paolo Bonzini, 2013/06/26
- Re: [Qemu-devel] [PATCH V2] build: remove compile warning, Wenchao Xia, 2013/06/24