From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4B11321D492F0 for ; Thu, 14 Sep 2017 01:16:38 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3F32DC0587DD; Thu, 14 Sep 2017 08:19:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3F32DC0587DD Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=lersek@redhat.com Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-83.rdu2.redhat.com [10.10.120.83]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2352D67C93; Thu, 14 Sep 2017 08:19:33 +0000 (UTC) To: "Zeng, Star" , Ard Biesheuvel , "Gao, Liming" , "Bi, Dandan" , "Wu, Hao A" Cc: "Ni, Ruiyu" , "Dong, Eric" , edk2-devel-01 , Paulo Alcantara References: <20170912222612.14451-1-lersek@redhat.com> <20170912222612.14451-3-lersek@redhat.com> <0C09AFA07DD0434D9E2A0C6AEB0483103B94098B@shsmsx102.ccr.corp.intel.com> <0C09AFA07DD0434D9E2A0C6AEB0483103B9409E7@shsmsx102.ccr.corp.intel.com> <23e789a8-59df-d67d-fa16-fc70aafb95d7@redhat.com> <0C09AFA07DD0434D9E2A0C6AEB0483103B94A227@SHSMSX151.ccr.corp.intel.com> <0C09AFA07DD0434D9E2A0C6AEB0483103B94E290@SHSMSX151.ccr.corp.intel.com> From: Laszlo Ersek Message-ID: Date: Thu, 14 Sep 2017 10:19:33 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <0C09AFA07DD0434D9E2A0C6AEB0483103B94E290@SHSMSX151.ccr.corp.intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 14 Sep 2017 08:19:36 +0000 (UTC) Subject: Re: [PATCH 2/2] MdeModulePkg/UdfDxe: suppress incorrect compiler warning in ReadFile() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Sep 2017 08:16:38 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 09/14/17 03:20, Zeng, Star wrote: > Seemingly, VS has similar issue with GCC. > > VS2010/VS2012 still have the building failures below after this patch. :( > edk2\mdemodulepkg\universal\disk\udfdxe\filesystemoperations.c(1083) : error C2220: warning treated as error - no 'executable' file generated > edk2\mdemodulepkg\universal\disk\udfdxe\filesystemoperations.c(1083) : warning C4701: potentially uninitialized local variable 'FilePosition' used > edk2\mdemodulepkg\universal\disk\udfdxe\filesystemoperations.c(1078) : warning C4701: potentially uninitialized local variable 'FinishedSeeking' used > edk2\mdemodulepkg\universal\disk\udfdxe\filesystemoperations.c(1167) : warning C4701: potentially uninitialized local variable 'Data' used > edk2\mdemodulepkg\universal\disk\udfdxe\filesystemoperations.c(1167) : warning C4703: potentially uninitialized local pointer variable 'Data' used > > > Liming, Dandan and Hao, > Do you remember how we fix this kind of false alarm before? > Just initialize the variable at the beginning of the function? I think that all such warnings should be evaluated carefully. Can you please file a TianoCore BZ about the above? Paulo might want to take a look. Thanks! Laszlo > -----Original Message----- > From: Zeng, Star > Sent: Thursday, September 14, 2017 8:43 AM > To: Ard Biesheuvel ; Laszlo Ersek > Cc: Ni, Ruiyu ; Dong, Eric ; edk2-devel-01 ; Gao, Liming ; Zeng, Star > Subject: RE: [edk2] [PATCH 2/2] MdeModulePkg/UdfDxe: suppress incorrect compiler warning in ReadFile() > > Comparing adding workaround in code with suppressing it in *OLD* version GCCs, I prefer the latter personally. > > > Thanks, > Star > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ard Biesheuvel > Sent: Thursday, September 14, 2017 2:52 AM > To: Laszlo Ersek > Cc: Ni, Ruiyu ; Dong, Eric ; edk2-devel-01 ; Gao, Liming ; Zeng, Star > Subject: Re: [edk2] [PATCH 2/2] MdeModulePkg/UdfDxe: suppress incorrect compiler warning in ReadFile() > > On 13 September 2017 at 11:49, Laszlo Ersek wrote: >> On 09/13/17 08:43, Zeng, Star wrote: >>> Beyond the Rb (I do not want to block this patch series), I am curious about one question. >>> >>> There may be more this kind of workarounds to fix the build failure. >>> Is it possible to disable the warning (like below example for VS) for specific version of GCC for this kind of false alarm? >>> >>> >>> ProcessorBind.h: >>> #if defined(_MSC_EXTENSIONS) >>> >>> ... >>> >>> #if _MSC_VER == 1800 || _MSC_VER == 1900 >>> >>> // >>> // Disable these warnings for VS2013. >>> // >>> >>> // >>> // This warning is for potentially uninitialized local variable, and >>> it may cause false // positive issues in VS2013 and VS2015 build // >>> #pragma warning ( disable : 4701 ) >>> >>> // >>> // This warning is for potentially uninitialized local pointer >>> variable, and it may cause // false positive issues in VS2013 and >>> VS2015 build // #pragma warning ( disable : 4703 ) >>> >>> #endif >>> >>> #endif >> >> I think starting with gcc-4.6, gcc supports the "diagnostics" pragma, >> which can be used to suppress warnings. >> >> Unfortunately, there's no pragma to suppress *only* the incorrect >> warnings :) So if we set the pragma, we could lose even those warnings >> that point out real bugs. >> > > That applies to the VS case as well. But I think doing this for older GCCs is fine, most EDK2 developers use a newer version anyway, so we will not lose any coverage by doing so. > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel >