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

[Xen-changelog] [xen master] dom0-build: fix build with clang5



commit 6827bea2b3b99153821b8b7446bdced27f720188
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Feb 12 10:52:20 2020 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Feb 12 10:52:20 2020 +0100

    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>
    Acked-by: Julien Grall <julien@xxxxxxx>
    Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 xen/arch/arm/domain_build.c | 3 ++-
 xen/arch/x86/dom0_build.c   | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index d2d11eda26..4307087536 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2514,7 +2514,8 @@ int __init construct_dom0(struct domain *d)
 
     printk("*** LOADING DOMAIN 0 ***\n");
 
-    if ( !dom0_mem_set && CONFIG_DOM0_MEM[0] )
+    /* The ordering of operands is to work around a clang5 issue. */
+    if ( CONFIG_DOM0_MEM[0] && !dom0_mem_set )
         parse_dom0_mem(CONFIG_DOM0_MEM);
 
     if ( dom0_mem <= 0 )
diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index 6bf5365582..0ce29e91a3 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -318,7 +318,8 @@ unsigned long __init dom0_compute_nr_pages(
     unsigned long avail = 0, nr_pages, min_pages, max_pages;
     bool need_paging;
 
-    if ( !dom0_mem_set && CONFIG_DOM0_MEM[0] )
+    /* The ordering of operands is to work around a clang5 issue. */
+    if ( CONFIG_DOM0_MEM[0] && !dom0_mem_set )
         parse_dom0_mem(CONFIG_DOM0_MEM);
 
     for_each_node_mask ( node, dom0_nodes )
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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