[Top][All Lists]

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

Re: [PATCH v4 0/2] Replaced locks with lock guard macros

From: Eric Blake
Subject: Re: [PATCH v4 0/2] Replaced locks with lock guard macros
Date: Tue, 24 Mar 2020 09:22:39 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0

You can test locally by building with clang (llvm) instead of gcc:

   ./configure --cc=clang

Using --cc=clang is causing the following error in several different places:
qemu/target/ppc/translate.c:1894:18: error: result of comparison
'target_ulong' (aka 'unsigned int') <= 4294967295
is always true [-Werror,-Wtautological-type-limit-compare]
         if (mask <= 0xffffffffu) {
             ~~~~ ^  ~~~~~~~~~~~

these errors don't come up when building with gcc. Any idea how to fix
this? Or should I just suppress it?

I'm of the opinion that it should be suppressed.

This is the *correct* test for ppc64, and the warning for ppc32 is simply
because target_ulong == uint32_t.  True is the correct result for ppc32.

We simply want the compiler to DTRT: simplify this test and remove the else as

There may be ways to rewrite that expression to avoid triggering the warning on a 32-bit platform. Untested, but does this help:

if (sizeof(mask) > 4 && mask <= 0xffffffffu) {

Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]