Skip to content
  • Peter Maydell's avatar
    b37778b8
    linux-user: Fix clang warning for nios2-linux-user code · b37778b8
    Peter Maydell authored
    
    
    The clang in Ubuntu 18.04 (10.0.0-4ubuntu1) produces a warning
    on the code added in commit f5ef0e51 where we use a
    shifted expression in a boolean context:
    
    ../../linux-user/elfload.c:2423:16: error: converting the result of '<<' to a boolean always evaluates to true [-Werror,-Wtautological-constant-compare]
        } else if (LO_COMMPAGE) {
                   ^
    ../../linux-user/elfload.c:1102:22: note: expanded from macro 'LO_COMMPAGE'
    #define LO_COMMPAGE  TARGET_PAGE_SIZE
                         ^
    /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/include/exec/cpu-all.h:231:31: note: expanded from macro 'TARGET_PAGE_SIZE'
    #define TARGET_PAGE_SIZE   (1 << TARGET_PAGE_BITS)
                                  ^
    1 error generated.
    
    The warning is bogus because whether LO_COMMPAGE is zero or not
    depends on compile-time ifdefs; shut the compiler up by adding
    an explicit comparison to zero.
    
    Fixes: f5ef0e51 ("linux-user/nios2: Map a real kuser page")
    Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
    Reviewed-by: default avatarLaurent Vivier <laurent@vivier.eu>
    Message-id: 20220111082900.3341274-1-peter.maydell@linaro.org
    Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
    b37778b8
    linux-user: Fix clang warning for nios2-linux-user code
    Peter Maydell authored
    
    
    The clang in Ubuntu 18.04 (10.0.0-4ubuntu1) produces a warning
    on the code added in commit f5ef0e51 where we use a
    shifted expression in a boolean context:
    
    ../../linux-user/elfload.c:2423:16: error: converting the result of '<<' to a boolean always evaluates to true [-Werror,-Wtautological-constant-compare]
        } else if (LO_COMMPAGE) {
                   ^
    ../../linux-user/elfload.c:1102:22: note: expanded from macro 'LO_COMMPAGE'
    #define LO_COMMPAGE  TARGET_PAGE_SIZE
                         ^
    /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/include/exec/cpu-all.h:231:31: note: expanded from macro 'TARGET_PAGE_SIZE'
    #define TARGET_PAGE_SIZE   (1 << TARGET_PAGE_BITS)
                                  ^
    1 error generated.
    
    The warning is bogus because whether LO_COMMPAGE is zero or not
    depends on compile-time ifdefs; shut the compiler up by adding
    an explicit comparison to zero.
    
    Fixes: f5ef0e51 ("linux-user/nios2: Map a real kuser page")
    Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
    Reviewed-by: default avatarLaurent Vivier <laurent@vivier.eu>
    Message-id: 20220111082900.3341274-1-peter.maydell@linaro.org
    Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
Loading