xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Roger Pau Monne <roger.pau@citrix.com>
Cc: xen-devel@lists.xenproject.org, Wei Liu <wl@xen.org>,
	Andrew Cooper <andrew.cooper3@citrix.com>
Subject: Re: [PATCH 1/3] x86/mm: do not attempt to convert _PAGE_GNTTAB to a boolean
Date: Tue, 5 May 2020 15:47:43 +0200	[thread overview]
Message-ID: <20332b18-960c-a180-8150-55fae60bdc6e@suse.com> (raw)
In-Reply-To: <20200505092454.9161-2-roger.pau@citrix.com>

On 05.05.2020 11:24, Roger Pau Monne wrote:
> Clang 10 complains with:
> 
> mm.c:1239:10: error: converting the result of '<<' to a boolean always evaluates to true
>       [-Werror,-Wtautological-constant-compare]
>     if ( _PAGE_GNTTAB && (l1e_get_flags(l1e) & _PAGE_GNTTAB) &&
>          ^
> xen/include/asm/x86_64/page.h:161:25: note: expanded from macro '_PAGE_GNTTAB'
> #define _PAGE_GNTTAB (1U<<22)
>                         ^

This is a rather odd warning. Do they also warn for "if ( 0 )"
or "do { } while ( 0 )", as we use in various places? There's
no difference to me between a plain number and a constant
composed via an expression.

> Remove the conversion of _PAGE_GNTTAB to a boolean, since the and
> operation performed afterwards will already return false if the value
> of the macro is 0.

I'm sorry, but no. The expression was put there on purpose by
0932210ac095 ("x86: Address "Bitwise-and with zero
CONSTANT_EXPRESSION_RESULT" Coverity issues"), and the
description there is clearly telling us that this wants to stay
unless Coverity changed in the meantime. Otherwise I'm afraid
a more elaborate solution will be needed to please both. Or a
more simplistic one, like using "#if _PAGE_GNTTAB" around the
construct.

Jan


  reply	other threads:[~2020-05-05 13:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-05  9:24 [PATCH 0/3] build: fixes for clang 10 Roger Pau Monne
2020-05-05  9:24 ` [PATCH 1/3] x86/mm: do not attempt to convert _PAGE_GNTTAB to a boolean Roger Pau Monne
2020-05-05 13:47   ` Jan Beulich [this message]
2020-05-05 14:11     ` Roger Pau Monné
2020-05-05 14:59       ` Jan Beulich
2020-05-05  9:24 ` [PATCH 2/3] configure: also add EXTRA_PREFIX to {CPP/LD}FLAGS Roger Pau Monne
2020-05-06 13:07   ` Wei Liu
2020-05-22  8:41   ` Bertrand Marquis
2020-05-22  9:05     ` Wei Liu
2020-05-22  9:37       ` Bertrand Marquis
2020-05-22  9:59         ` Wei Liu
2020-05-22 11:19       ` Roger Pau Monné
2020-05-22 11:40         ` Bertrand Marquis
2020-05-22 11:41           ` Wei Liu
2020-05-05  9:24 ` [PATCH 3/3] tools/libxl: disable clang indentation check for the disk parser Roger Pau Monne
2020-05-06 13:07   ` Wei Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20332b18-960c-a180-8150-55fae60bdc6e@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).