From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Laszlo Ersek <lersek@redhat.com>
Cc: edk2-devel-01 <edk2-devel@lists.01.org>,
Brijesh Singh <brijesh.singh@amd.com>,
Jordan Justen <jordan.l.justen@intel.com>,
Thomas Lamprecht <t.lamprecht@proxmox.com>
Subject: Re: [PATCH 1/1] OvmfPkg/IoMmuDxe: shut up "unused-const-variable" gcc-6 warning in RELEASE
Date: Wed, 6 Sep 2017 18:12:27 +0100 [thread overview]
Message-ID: <CAKv+Gu8es4fCVEF-XKZepNWY+U1or3c5_VDKpsoJbCTbUkJEew@mail.gmail.com> (raw)
In-Reply-To: <0868f6e6-597c-6b1d-0864-7b6b1997adcf@redhat.com>
On 6 September 2017 at 18:09, Laszlo Ersek <lersek@redhat.com> wrote:
> On 09/06/17 18:56, Ard Biesheuvel wrote:
>> On 6 September 2017 at 17:48, Laszlo Ersek <lersek@redhat.com> wrote:
>>> Starting with gcc-6, a new warning option called "-Wunused-const-variable"
>>> has become available (and enabled by default under our build settings):
>>>
>>> https://gcc.gnu.org/onlinedocs/gcc-6.4.0/gcc/Warning-Options.html
>>>
>>> We should give it the same treatment as Ard gave "unused-but-set-variable"
>>> in commit 20d00edf21d2 ("BaseTools/GCC: set -Wno-unused-but-set-variables
>>> only on RELEASE builds", 2016-03-24); i.e., we should restrict the warning
>>> to the DEBUG build target.
>>>
>>> However, because the new warning is gcc-6+ only, we cannot add
>>> "-Wno-unused-const-variable" to any GCC5 macros in
>>> "BaseTools/Conf/tools_def.template". While the GCC6 toolchain and/or the
>>> desired handling of the new warning are investigated in
>>> <https://bugzilla.tianocore.org/show_bug.cgi?id=700>, suppress the warning
>>> for gcc-6+ (in RELEASE builds) as follows:
>>>
>>> - Replace the "mBusMasterOperationName" array with the
>>> BUS_MASTER_OPERATION_NAME(Expression, ShortName) macro that compares
>>> Expression against EdkiiIoMmuOperationBusMaster<ShortName>, and in case
>>> of a match, evaluates to "ShortName", stringified,
>>>
>>> - when composing the DEBUG message -- which the preprocessor might
>>> eliminate from RELEASE builds, thereby removing its references to
>>> variables --, build a ladder of comparisons with
>>> BUS_MASTER_OPERATION_NAME().
>>>
>>
>> I wonder if we should put this in a header file somewhere. I really
>> hate that we need to create new GCCx versions just for small
>> deviations between versions of the compiler.
>>
>> I.e., add this to MdePkg/Include/Base.h
>>
>> #ifdef MDEPKG_NDEBUG
>> //
>> // Don't warn about unused but set variables: they may only be
>> // referenced by DEBUG code.
>> //
>> #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
>> #if __GNUC__ >= 6
>> #pragma GCC diagnostic ignored "-Wunused-const-variable"
>> #endif
>> #endif
>
> The option in question is "-Wno-unused-const-variable". But, that's a
> side question.
>
No. The option is "-Wunused-const-variable", and adding the 'no-'
prefix is the same as ignoring it.
> If the above is acceptable to the MdePkg maintainers, it is certainly
> good enough for me. In that case, I will reassign TianoCore BZ#700 to
> MdePkg. (I was careful to write "desired handling of the new warning" in
> the commit message, because I expected that the introduction of the GCC6
> toolchain just for this might not be universally liked.)
>
No. I think we should have fewer rather than more. I think the current
collection in tools_def is ridiculous, but that is my personal
opinion.
> Personally I wouldn't like to submit the MdePkg patch myself, as GCC
> pragmas are another delicacy that doesn't fit on my plate right now. (If
> I happen to break something with it, I get to fix it too... Like I'm
> fixing it now within OvmfPkg.)
>
> The point of this patch is to get OVMF back to a building state ASAP.
> Once we fix BZ#700, I'm more than happy to revert the patch. I sought to
> write the patch in a way that would be tolerable both short-term and
> mid/long-term.
>
Fair enough.
next prev parent reply other threads:[~2017-09-06 17:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-06 16:48 [PATCH 0/1] OvmfPkg/IoMmuDxe: shut up "unused-const-variable" gcc-6 warning in RELEASE Laszlo Ersek
2017-09-06 16:48 ` [PATCH 1/1] " Laszlo Ersek
2017-09-06 16:56 ` Ard Biesheuvel
2017-09-06 17:09 ` Laszlo Ersek
2017-09-06 17:12 ` Ard Biesheuvel [this message]
2017-09-06 17:18 ` Laszlo Ersek
2017-09-07 3:38 ` Gao, Liming
2017-09-07 5:47 ` Thomas Lamprecht
2017-09-07 7:32 ` Laszlo Ersek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAKv+Gu8es4fCVEF-XKZepNWY+U1or3c5_VDKpsoJbCTbUkJEew@mail.gmail.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox