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

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


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <JBeulich@xxxxxxxx>
  • Date: Mon, 15 Jul 2019 10:35:11 +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=P98ajWSvzMrYIlpir5/UWclTb2KKiKzTfhDaLdIkde8=; b=eSwvoj0EtTlbFCvq2TFHV96cngj5sHYzP4qNscs4ahIrWKIFLxYBG7ZdAkXqiBRNHozbPhaeJK302HLv0XuPUKxBknKKIEkmc7nwWYlvtLLSrNMELZO/mm9QibWOXkt3Vn6BntKpfhdZSpqS4cFQ60a5hKxyLKM3jA1ldueOxustyDzyWnyqOnLy1iQMMPtthhxOEWDHhUWRX/O3s4lYXm0OkzFZgMyH5Td8IWZLKH4fy4sJFlRqfD5l9UCSxtf+AlUeSPJv/v2JBzeMtxA6P5aDXPYPN6cH9fWNpRODeN9Q7VPgq9CUDRduPbSU1YVtR3mdtHUy4tsrnPffVYQsKg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G6QrRRHgVmpaHwR5a86HXqruDyMSSpPczLFDwENrSpvzFuDHvWlYwJU0QZWsbVtioMhHXwggiQ+eIcTG0vvIoTHWaAQoqtR1p0QmXwhxCNaYzNGDm7YjSlBe2d3rfO4S0xW2CIR/jmXPGXSQ50dWzqFHpARwElRkfAceOR05W7fEdL9wLLxRadzINjWKUbFELI5cjLnwYeY+292+O4dxE1oq/6Oi8eM3eir6LPSN/+7JG0PFfh6cgX4InSwdC+msr3nAeQfiR8qGpLnp1T/MQBU4BFBoJtLIxTWstTaArUVoOcNhq0TpWCdIPuuWAuK+aNUKcItR+dFJco9PsiZrkQ==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=JBeulich@xxxxxxxx;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Mon, 15 Jul 2019 10:35:35 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHVOvj6+Q8sMST8H0euZPd/xzIlPw==
  • Thread-topic: [PATCH] x86/dom0-build: fix build with clang5

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.

--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -341,7 +341,7 @@ unsigned long __init dom0_compute_nr_pag
      unsigned long avail = 0, nr_pages, min_pages, max_pages;
      bool need_paging;
  
-    if ( !dom0_mem_set && CONFIG_DOM0_MEM[0] )
+    if ( CONFIG_DOM0_MEM[0] && !dom0_mem_set )
          parse_dom0_mem(CONFIG_DOM0_MEM);
  
      for_each_node_mask ( node, dom0_nodes )

Attachment: clang5-build.patch
Description: clang5-build.patch

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