From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from proxmox.maurer-it.com (proxmox.maurer-it.com [212.186.127.180]) (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 8856621E74922 for ; Wed, 6 Sep 2017 22:44:22 -0700 (PDT) Received: from proxmox.maurer-it.com (localhost [127.0.0.1]) by proxmox.maurer-it.com (Proxmox) with ESMTP id 8660F100059C; Thu, 7 Sep 2017 07:47:11 +0200 (CEST) To: "Gao, Liming" , Laszlo Ersek , 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> From: Thomas Lamprecht Message-ID: <42a7bf30-49b6-fea8-91fb-5922a2931173@proxmox.com> Date: Thu, 7 Sep 2017 07:47:09 +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: <4A89E2EF3DFEDB4C8BFDE51014F606A14D78B39E@shsmsx102.ccr.corp.intel.com> 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 05:44:22 -0000 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable 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. >=20 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 wonde= r if those "unrecognized command line options" have something to do with his p= roblem. 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 =E2=80=98main=E2=80=99: test.c:7:9: warning: unused variable =E2=80=98test=E2=80=99 [-Wunused-var= iable] int test; ^~~~ test.c: At top level: cc1: warning: unrecognized command line option =E2=80=98-Wno-foo-bar=E2=80= =99 cheers, Thomas