From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40203) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XeLDm-00059Z-Jo for qemu-devel@nongnu.org; Wed, 15 Oct 2014 05:50:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XeLDi-0007DC-1b for qemu-devel@nongnu.org; Wed, 15 Oct 2014 05:50:18 -0400 Message-ID: <543E44AF.6070800@gmail.com> Date: Wed, 15 Oct 2014 17:55:59 +0800 From: Chen Gang MIME-Version: 1.0 References: <5439399D.4020004@gmail.com> <54393AF0.1010708@gmail.com> <543D807A.6000704@msgid.tls.msk.ru> <543D8BCB.2020109@gmail.com> In-Reply-To: <543D8BCB.2020109@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH v2] libvixl: a64: Skip "-Wunused-variable" for gcc 5.0.0 or higher List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Tokarev Cc: Peter Maydell , Jonathan Wakely , QEMU Trivial , qemu-devel , Richard Henderson 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 To: Chen Gang CC: gcc-help , Jeff Law , Peter Maydell On 14 October 2014 22:57, Chen Gang 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