qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] misc: fix __COUNTER__ macro to be referenced properly


From: Stefan Hajnoczi
Subject: Re: [PATCH] misc: fix __COUNTER__ macro to be referenced properly
Date: Fri, 20 Mar 2020 11:09:52 +0000

On Thu, Mar 19, 2020 at 09:19:24AM -0700, address@hidden wrote:
> From: danbrodsky <address@hidden>
> 
> - __COUNTER__ doesn't work with ## concat
> - replaced ## with glue() macro so __COUNTER__ is evaluated
> 
> Signed-off-by: danbrodsky <address@hidden>
> ---
>  include/qemu/lockable.h | 2 +-
>  include/qemu/rcu.h      | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/qemu/lockable.h b/include/qemu/lockable.h
> index 1aeb2cb1a6..a9258f2c2c 100644
> --- a/include/qemu/lockable.h
> +++ b/include/qemu/lockable.h
> @@ -170,7 +170,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(QemuLockable, 
> qemu_lockable_auto_unlock)
>   *   }
>   */
>  #define QEMU_LOCK_GUARD(x) \
> -    g_autoptr(QemuLockable) qemu_lockable_auto##__COUNTER__ = \
> +    g_autoptr(QemuLockable) glue(qemu_lockable_auto, __COUNTER__) = \
>              qemu_lockable_auto_lock(QEMU_MAKE_LOCKABLE((x)))
>  
>  #endif

Please fix WITH_QEMU_LOCK_GUARD() too.  It's in the same header file and
gcc -E shows that it also fails to expand __COUNTER__:

  for (__attribute__((cleanup(glib_autoptr_cleanup_QemuLockable)))
      QemuLockable_autoptr qemu_lockable_auto__COUNTER__ = ...

Thanks,
Stefan

Attachment: signature.asc
Description: PGP signature


reply via email to

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