All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Cc: famz@redhat.com, qemu-block@nongnu.org, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/5] lockable: add QemuLockable
Date: Mon, 5 Feb 2018 15:38:10 +0100	[thread overview]
Message-ID: <cf76eb21-b426-326c-3583-953b3128c395@redhat.com> (raw)
In-Reply-To: <2e6460d8-115a-9cbc-c77d-655a9e843abc@linaro.org>

On 03/02/2018 21:44, Richard Henderson wrote:
> On 02/03/2018 07:39 AM, Paolo Bonzini wrote:
>> +/* This function gives an error if an invalid, non-NULL pointer type is passed
>> + * to QEMU_MAKE_LOCKABLE.  For optimized builds, we can rely on dead-code elimination
>> + * from the compiler, and give the errors already at link time.
>> + */
>> +#ifdef __OPTIMIZE__
>> +void unknown_lock_type(void *);
>> +#else
>> +static inline void unknown_lock_type(void *unused)
>> +{
>> +    abort();
>> +}
> 
> Since you're using __builtin_choose_expr, I'm surprised you would need to test
> __OPTIMZE__.  The nature of the builtin is such that it *must* eliminate the
> other branch; otherwise the types don't even match up.

__builtin_choose_expr works fine.  However we also have

	return x ? __builtin_choose_expr(..., unknown_lock_type) : NULL;

and if "x" is NULL then its type is a void*, and the LHS will refer to
unknown_lock_type.  I was expecting __always_inline__ to be enough to
avoid this, but apparently this is not the case.

Paolo

> It might be worth using __attribute__((error("message"))) on the function too.
> 
> Otherwise,
> 
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> 
> 
> r~
> 

  reply	other threads:[~2018-02-05 14:38 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-03 15:39 [Qemu-devel] [PATCH v5 0/5] coroutine-lock: polymorphic CoQueue Paolo Bonzini
2018-02-03 15:39 ` [Qemu-devel] [PATCH 1/5] test-coroutine: add simple CoMutex test Paolo Bonzini
2018-02-03 20:46   ` Richard Henderson
2018-02-03 15:39 ` [Qemu-devel] [PATCH 2/5] lockable: add QemuLockable Paolo Bonzini
2018-02-03 20:44   ` Richard Henderson
2018-02-05 14:38     ` Paolo Bonzini [this message]
2018-02-03 15:39 ` [Qemu-devel] [PATCH 3/5] coroutine-lock: convert CoQueue to use QemuLockable Paolo Bonzini
2018-02-03 20:50   ` Richard Henderson
2018-02-03 15:39 ` [Qemu-devel] [PATCH 4/5] coroutine-lock: make qemu_co_enter_next thread-safe Paolo Bonzini
2018-02-03 20:57   ` Richard Henderson
2018-02-03 15:39 ` [Qemu-devel] [PATCH 5/5] curl: convert to CoQueue Paolo Bonzini
2018-02-03 20:59   ` Richard Henderson
2018-02-05 14:39 ` [Qemu-devel] [PATCH v5 0/5] coroutine-lock: polymorphic CoQueue Stefan Hajnoczi
2018-02-07  5:27 ` Fam Zheng
  -- strict thread matches above, loose matches on Subject: below --
2018-02-01 21:29 [Qemu-devel] [PATCH v4 " Paolo Bonzini
2018-02-01 21:29 ` [Qemu-devel] [PATCH 2/5] lockable: add QemuLockable Paolo Bonzini
2018-01-25 17:59 [Qemu-devel] [PATCH v3 0/5] coroutine-lock: polymorphic CoQueue Paolo Bonzini
2018-01-25 17:59 ` [Qemu-devel] [PATCH 2/5] lockable: add QemuLockable Paolo Bonzini
2018-01-25 20:13   ` Eric Blake
2018-01-26  3:11   ` Fam Zheng
2018-01-26  5:24   ` Fam Zheng
2018-01-29 11:42   ` Stefan Hajnoczi
2018-01-29 14:30     ` Paolo Bonzini

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=cf76eb21-b426-326c-3583-953b3128c395@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=famz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=stefanha@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.