qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-trivial] [PATCH v2] libvixl: a64: Skip "-Wunused-variable" for


From: Chen Gang
Subject: Re: [Qemu-trivial] [PATCH v2] libvixl: a64: Skip "-Wunused-variable" for gcc 5.0.0 or higher
Date: Wed, 15 Oct 2014 17:55:59 +0800
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.1.2

On 10/15/14 4:47, Chen Gang wrote:
> On 10/15/2014 03:58 AM, Michael Tokarev wrote:
>>
>> That's what I'm after too (after trying to fix it properly).
>> And no, at this time I dont know how gcc5 handles this.
>>
> 
> At present, I have sent the related information to gcc upstream mailing
> list for gcc5, we are just discussing about it.
> 
>  - Some gcc members stick to what gcc5 has done is correct (need still
>    report warning).
> 
>  - But for me, I am just trying to get another gcc members' confirmation.
>    I am not quite familiar with C++, for me it is a complex language, so
>    I need additional confirmation by another gcc members, at least.
> 

After consult the gcc related members, we are sure what gcc has done is
correct, and need process this warning in our qemu or 'libvixl'.

The related mail is below:


-------- Forwarded Message --------
Subject: Re: [Consult] g++: About "-Wunused-variable" for constant variable in 
header file
Date: Wed, 15 Oct 2014 10:18:44 +0100
From: Jonathan Wakely <address@hidden>
To: Chen Gang <address@hidden>
CC: gcc-help <address@hidden>, Jeff Law <address@hidden>, Peter Maydell 
<address@hidden>

On 14 October 2014 22:57, Chen Gang <address@hidden> wrote:
> Hello All:
>
> At present, I met one warning issue about gcc 5.0.0.
>
>  - For "const float a = 3.4 - 2.1 / 3;", if it is unused, gcc5 will not
>    report warning.

Because there is no cost to initializing the variable.

>  - "const char n() {return 1;}; const a = n();", if 'a' is unused, gcc5
>    will report warning.

Because it requires dynamic initialization, running a function at
startup, which has a cost. If you don't use the variable then you
might not want to run the initialization code at startup, so you get a
warning.

> For gcc old version (e.g. gcc4), it will not report warning. Is it the
> new feature for gcc5, or just a gcc5's bug?

I think this behaviour is intended and is not a bug.




-- 
Chen Gang

Open, share, and attitude like air, water, and life which God blessed



reply via email to

[Prev in Thread] Current Thread [Next in Thread]