qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Claudio Fontana <cfontana@suse.de>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>, qemu-devel@nongnu.org
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Peter Maydell" <peter.maydell@linaro.org>
Subject: Re: [RFC PATCH v4] compiler.h: remove GCC < 3 __builtin_expect fallback
Date: Fri, 11 Dec 2020 14:28:33 +0100	[thread overview]
Message-ID: <d15617d9-4892-b349-2e22-8f6bb7c4a715@suse.de> (raw)
In-Reply-To: <20201211131346.473882-1-philmd@redhat.com>

On 12/11/20 2:13 PM, Philippe Mathieu-Daudé wrote:
> Since commit efc6c07 ("configure: Add a test for the minimum compiler
> version"), QEMU explicitely depends on GCC >= 4.8.
> 
> (clang >= 3.4 advertizes itself as GCC >= 4.2 compatible and supports
> __builtin_expect too)
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> [PMD: #error if likely/unlikely already defined]
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> Supersedes: <20201210134752.780923-4-marcandre.lureau@redhat.com>
> ---
>  include/qemu/compiler.h | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
> index c76281f3540..ae1aee79c8d 100644
> --- a/include/qemu/compiler.h
> +++ b/include/qemu/compiler.h
> @@ -43,14 +43,11 @@
>  #define tostring(s)	#s
>  #endif
>  
> -#ifndef likely
> -#if __GNUC__ < 3
> -#define __builtin_expect(x, n) (x)
> +#if defined(likely) || defined(unlikely)
> +#error building with likely/unlikely is not supported

I'd put the argument of #error as a single string constant delimited by quotes ",
doesn't matter in this case though as there are no problem characters in the string.

>  #endif
> -
>  #define likely(x)   __builtin_expect(!!(x), 1)
>  #define unlikely(x)   __builtin_expect(!!(x), 0)
> -#endif
>  
>  #ifndef container_of
>  #define container_of(ptr, type, member) ({                      \
> 

Reviewed-by: Claudio Fontana <cfontana@suse.de>


  reply	other threads:[~2020-12-11 13:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-11 13:13 [RFC PATCH v4] compiler.h: remove GCC < 3 __builtin_expect fallback Philippe Mathieu-Daudé
2020-12-11 13:28 ` Claudio Fontana [this message]
2020-12-11 13:35   ` Philippe Mathieu-Daudé
2020-12-11 13:33 ` Peter Maydell
2020-12-11 13:40   ` Philippe Mathieu-Daudé
2020-12-12 13:51     ` Marc-André Lureau

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=d15617d9-4892-b349-2e22-8f6bb7c4a715@suse.de \
    --to=cfontana@suse.de \
    --cc=marcandre.lureau@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.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).