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

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


  • To: Julien Grall <julien.grall@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <JBeulich@xxxxxxxx>
  • Date: Mon, 29 Jul 2019 11:36:49 +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=6pQNRXMMryhlfEu5WQz3Go7hgVd2srSQIa6jtVIKB9I=; b=UcicRzPdv7arQf+LMdkyYquka2lkTpc+mE1CBSUXK92CWXmV8iC75J2eE3o2uJuFT0vibhY4VyWypfXJbgh1z4Q4QqfAoSWLQaE0VRqf8UhQfIifOXlD1vy+/FKhucMiXU39lA84AlgyNTI+VPHWcUtpdeXqMSu8p7HFq8pz66kfuQ9zeqEhyfZN7U85zgozj7GThLuTef59O9Q2sh5GsD1B2lT1recdAHKg3oLkj1CDPh2TO3THk/gnuoc7+X9sVYIxKjW0CN1vsZtb4Wuj7o8ukj2yXZ3VK7IMtmbNA3yWQHq3ESJGKDiHm7MB89pmpQD2lAeSYCEPFRcPkUCvZQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rq1oKbX2OFJksfmX5NgL9WVchEAQPFo78UwfVUG+mG51BfBtSWgC9GdMGvgM6bAs2aS0a1vi6Q+wexGfMGP/IoxOpZYa8jvzrFFxNac7C/hOhvLXCFxh5qKalATjbAHgA/R1iXF4zFWEm3Xkgczrs4pyFbUN20aS77yiXmWxJy49+CcjO4FvEY2232JMWp3uhFO3i6wquG875XNeR+Wwhc4AL7qcUj7+IdSlFa5/vYWe5isc+w3KCI1KV8Ss6n28AWQqiJfC4Qsp8C2PhvWVPToI2fIrlzaiP9M1BUYELS1G+nWrPvJhijtEef6bLZZIqSY3Uo5kYXWsdI8zr6kQrA==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=JBeulich@xxxxxxxx;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Mon, 29 Jul 2019 11:53:30 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHVPGuDyWWK6Geo3ESEScpkr4UVE6bhcbZsgAAZOoA=
  • Thread-topic: [PATCH v2] dom0-build: fix build with clang5

On 29.07.2019 12:05, Julien Grall wrote:
> Hi,
> 
> On 7/17/19 7:47 AM, Jan Beulich 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>
>> ---
>> v2: Also adjust the Arm incarnation of the same construct.
>> ---
>> I'm open to going the !! or yet some different route (but not really the
>> suggested strlen() one). 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.
> 
> I quite like the strlen one, however looking around online this may not
> solve the problem. AFAIK, Clang is not happy because the constant is not
> a boolean.

I don't think it's as simple as "not a boolean", but I also haven't
played with it more than I had to in order to find possible
workarounds. As to the strlen() approach - I've expressed my dislike
before.

> So !! or != 0 should work here.

Well, with perhaps as much of a chance of breaking again as any
other of the possible solutions, unless they recognize and address
the oddity. Andrew - would you be willing to ack a v3 using !!
instead of re-ordering the && operands (seeing that you didn't ack
v2 yet, and perhaps you're also not meaning to)?

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®.