[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] lib/rename.c: rpl_rename - Avoid unused-but-set-variable com
From: |
Pádraig Brady |
Subject: |
Re: [PATCH] lib/rename.c: rpl_rename - Avoid unused-but-set-variable compiler warning |
Date: |
Tue, 03 Jun 2014 11:43:20 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 |
On 06/02/2014 08:45 PM, Ben Walton wrote:
> The value is set in se
>
> On Mon, Jun 2, 2014 at 8:31 PM, Pádraig Brady <address@hidden> wrote:
>> On 06/02/2014 08:13 PM, Ben Walton wrote:
>>> * In the non-Win32 variant of rpl_rename, it is possible that
>>> dst_exists may be set but not used. Mark it with the unused
>>> attribute to avoid compiler warnings.
>>>
>>> Signed-off-by: Ben Walton <address@hidden>
>>> ---
>>> lib/rename.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/lib/rename.c b/lib/rename.c
>>> index 55130d8..099066d 100644
>>> --- a/lib/rename.c
>>> +++ b/lib/rename.c
>>> @@ -285,7 +285,7 @@ rpl_rename (char const *src, char const *dst)
>>> char *dst_temp = (char *) dst;
>>> bool src_slash;
>>> bool dst_slash;
>>> - bool dst_exists;
>>> + bool dst_exists _GL_UNUSED;
>>> int ret_val = -1;
>>> int rename_errno = ENOTDIR;
>>> struct stat src_st;
>>>
>>
>> Have to say that I don't see this from looking at the code,
>> since it seems to just return or set dst_exists?
>
> The value is only referenced if RENAME_DEST_EXISTS_BUG is set.
> Otherwise, it's set but never used again. This patch addresses the
> case where RENAME_DEST_EXISTS_BUG is unset.
Ugh sorry. I had read _unused_ as _uninitialized_.
Patch is fine and I've just pushed it.
thanks!
Pádraig.