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 66B5321E9781F for ; Thu, 7 Sep 2017 00:29:36 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A9B95320F7; Thu, 7 Sep 2017 07:32:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A9B95320F7 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=lersek@redhat.com Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-54.rdu2.redhat.com [10.10.120.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id D1B4F60D10; Thu, 7 Sep 2017 07:32:24 +0000 (UTC) To: Thomas Lamprecht , "Gao, Liming" , edk2-devel-01 Cc: "Justen, Jordan L" , Brijesh Singh , Ard Biesheuvel References: <20170906164819.5082-1-lersek@redhat.com> <20170906164819.5082-2-lersek@redhat.com> <4A89E2EF3DFEDB4C8BFDE51014F606A14D78B39E@shsmsx102.ccr.corp.intel.com> <42a7bf30-49b6-fea8-91fb-5922a2931173@proxmox.com> From: Laszlo Ersek Message-ID: <45d4f381-1dff-5eb5-6e29-32af1fc284e5@redhat.com> Date: Thu, 7 Sep 2017 09:32:23 +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: <42a7bf30-49b6-fea8-91fb-5922a2931173@proxmox.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 07 Sep 2017 07:32:26 +0000 (UTC) Subject: Re: [PATCH 1/1] OvmfPkg/IoMmuDxe: shut up "unused-const-variable" gcc-6 warning in RELEASE 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, 07 Sep 2017 07:29:36 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit On 09/07/17 07:47, Thomas Lamprecht wrote: > On 09/07/2017 05:38 AM, Gao, Liming wrote: >> Laszlo: >>    I add -Wno-unused-const-variable option in GCC5 RELEASE option, and >> build OvmfPkg with GCC5.3. I don't meet any warning or error. Do you >> meet any issue? So, you think we can't add this option in GCC5 tool >> chain. >> > > Yes, he is right, looking at: > https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#Warning-Options > >> When an unrecognized warning option is requested (e.g., >> -Wunknown-warning), GCC emits a diagnostic stating that the option is >> not recognized. However, if the -Wno- form is used, the behavior is >> slightly different: no diagnostic is produced for -Wno-unknown-warning >> unless other diagnostics are being produced. This allows the use of new >> -Wno- options with old compilers, but if something goes wrong, the >> compiler warns that an unrecognized option is present. > > Also the older ones support it: > https://gcc.gnu.org/onlinedocs/gcc-4.9.4/gcc/Warning-Options.html#Warning-Options > > https://gcc.gnu.org/onlinedocs/gcc-5.4.0/gcc/Warning-Options.html#Warning-Options > > > I verified this behavior on gcc 5.4 and on gcc version 4.4.5 (Debian > 4.4.5-8) > (spun up an squeeze container, fun times) > > This seems like an easy solution, hopefully also a valid one in the edk2 > context. > The gcc rationale seems good, if there is such a warning suppress it, if > not we > wouldn't output any warning anyhow, so there is nothing to suppress. > > The only drawback seems that if something goes wrong the user could > wonder if > those "unrecognized command line options" have something to do with his > problem. > > It looks like this (gcc 4.4.5): > > tom@olddeb:~# gcc -Wall -Wno-foo-bar test.c > test.c: In function 'main': > test.c:4: warning: unused variable 'test' > At top level: > cc1: warning: unrecognized command line option "-Wno-foo-bar" > > And very similar on gcc 6: > > tom@plain-stretch:~# gcc -Wall -Wno-foo-bar test.c > test.c: In function ‘main’: > test.c:7:9: warning: unused variable ‘test’ [-Wunused-variable] >      int test; >          ^~~~ > test.c: At top level: > cc1: warning: unrecognized command line option ‘-Wno-foo-bar’ Sounds great, thank you guys for discovering this. I believe this would be a simple solution to BZ#700. Please feel free to update the subject of that bug as appropriate. Correspondingly, this patch can be ignored. Thanks! Laszlo