[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] x86/dom0-build: fix build with clang5


  • To: Tamas K Lengyel <tamas.k.lengyel@xxxxxxxxx>
  • From: Jan Beulich <JBeulich@xxxxxxxx>
  • Date: Mon, 15 Jul 2019 14:49:52 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=suse.com;dmarc=pass action=none header.from=suse.com;dkim=pass header.d=suse.com;arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=t9e8m5854mWRdHGopLVWRx/yYhevthV8e86pLnzLoSw=; b=bx8bxlyAY7p1g0B7jv+Pp2TZLEBa623b/93JTIxCN7Bqw4KQg+g+nD+ZKPRK/jqXKTkn1EfwpHlA+vAl501g8AD4anXgKH7dforaBhn1eZbMxTrBZJzk3cpV6XhKgpPFmslTPbLVUsqExpy1zz8H7qJfstJtBkd+CwZi02MrEyehRfH0VWV4Sil4ZiumTR7lraYZTT9RmY6ZhWry3qtjHtFIYm9A9/mu5F+gk0wFO5DtlPYpBvErX3wHRX4RSZaA7+rzM96x8MvvEQlnpitjrBvwBCAMtSyRZpp7AsKy8c5Qd9A8fYsdyEGDZHpgvt41eP8MsO7OWJCTvb2RV7WSwQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gCESqpAYBKX0Jz6vSyC+mEbdss5oq9QKNAMuxERWvILKb7Q8S3ysPHZPZFURbPmeSExk1XJAwlIptqbmqYdUD2rPxNnNRRG3KmfZVYYpBAsz2D8YGOEc40YJsRRug5l7VyawQkVHpx9zCzm+stWh028U531Un/DYNW3+FYUTYeTeYfx1KczFuDgveWt+hTcSRMXdIdQ9MXAmRFQbOSpADr3smPlohAuMCiheExCDshh9EgM/L/+NNRmnKfuwM67+7a0IHkz7uWM/NWDAm5+du4BC7Ycm7KlDGAxNJO+rvD1CHTRa0wADK67rOZ+q51JcyNpRyDXUrPXH77yxqw/CLA==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=JBeulich@xxxxxxxx;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Mon, 15 Jul 2019 14:50:09 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHVOxeAOJS35VCb3EmrxBvoPUkIQKbLwZ0ugAABSAA=
  • Thread-topic: [PATCH] x86/dom0-build: fix build with clang5

On 15.07.2019 16:44, Tamas K Lengyel wrote:
> On Mon, Jul 15, 2019 at 8:13 AM Jan Beulich <JBeulich@xxxxxxxx> wrote:
>>
>> On 15.07.2019 15:41, Tamas K Lengyel wrote:
>>> On Mon, Jul 15, 2019 at 4:36 AM Jan Beulich <JBeulich@xxxxxxxx> wrote:
>>>>
>>>> With non-empty CONFIG_DOM0_MEM clang5 produces
>>>>
>>>> dom0_build.c:344:24: error: use of logical '&&' with constant operand 
>>>> [-Werror,-Wconstant-logical-operand]
>>>>        if ( !dom0_mem_set && CONFIG_DOM0_MEM[0] )
>>>>                           ^  ~~~~~~~~~~~~~~~~~~
>>>> dom0_build.c:344:24: note: use '&' for a bitwise operation
>>>>        if ( !dom0_mem_set && CONFIG_DOM0_MEM[0] )
>>>>                           ^~
>>>>                           &
>>>> dom0_build.c:344:24: note: remove constant to silence this warning
>>>>        if ( !dom0_mem_set && CONFIG_DOM0_MEM[0] )
>>>>                          ~^~~~~~~~~~~~~~~~~~~~~
>>>> 1 error generated.
>>>>
>>>> Obviously neither of the two suggestions are an option here. Oddly
>>>> enough swapping the operands of the && helps, while e.g. casting or
>>>> parenthesizing doesn't. Another workable variant looks to be the use of
>>>> !! on the constant.
>>>>
>>>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>>>> ---
>>>> I'm open to going the !! or yet some different route. No matter which
>>>> one we choose, I'm afraid it is going to remain guesswork what newer
>>>> (and future) versions of clang will choke on.
>>>
>>> Is disabling the check itself not an option? Seems to me to be a more
>>> sensible option then hacking around it.
>>
>> How would you envision to disable the check? It's there for a reason
>> after all.
> 
> By passing -Wno-constant-logical-operand to the compiler. It looks
> like a check for a non-common situation which evidently Xen uses, so
> what's the point of keeping it but hacking around with it with tricks
> that are fragile?

Oh, so you meant disabling the compiler warning. That may be an option,
but I wouldn't routinely suggest such as often besides unhelpful
instances there are also helpful ones.

Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.