[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 7/7] qobject atomics osdep: Make a few macros more hygieni
From: |
Markus Armbruster |
Subject: |
Re: [PATCH v2 7/7] qobject atomics osdep: Make a few macros more hygienic |
Date: |
Thu, 21 Sep 2023 13:23:48 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) |
Kevin Wolf <kwolf@redhat.com> writes:
> Am 20.09.2023 um 20:31 hat Markus Armbruster geschrieben:
[...]
>> diff --git a/include/qapi/qmp/qobject.h b/include/qapi/qmp/qobject.h
>> index 9003b71fd3..d36cc97805 100644
>> --- a/include/qapi/qmp/qobject.h
>> +++ b/include/qapi/qmp/qobject.h
>> @@ -45,10 +45,17 @@ struct QObject {
>> struct QObjectBase_ base;
>> };
>>
>> -#define QOBJECT(obj) ({ \
>> +/*
>> + * Preprocessory sorcery ahead: use a different identifier for the
>> + * local variable in each expansion, so we can nest macro calls
>> + * without shadowing variables.
>> + */
>> +#define QOBJECT_INTERNAL(obj, _obj) ({ \
>> typeof(obj) _obj = (obj); \
>> - _obj ? container_of(&(_obj)->base, QObject, base) : NULL; \
>> + _obj \
>> + ? container_of(&(_obj)->base, QObject, base) : NULL; \
>
> What happened here? The code in this line (or now two lines) seems to be
> unchanged apart from a strange looking newline.
Accident, will fix, thanks!
>> })
>> +#define QOBJECT(obj) QOBJECT_INTERNAL((obj), MAKE_IDENTFIER(_obj))
>
> Kevin
- [PATCH v2 1/7] migration/rdma: Fix save_page method to fail on polling error, (continued)
- [PATCH v2 1/7] migration/rdma: Fix save_page method to fail on polling error, Markus Armbruster, 2023/09/20
- [PATCH v2 3/7] ui: Clean up local variable shadowing, Markus Armbruster, 2023/09/20
- [PATCH v2 4/7] block/dirty-bitmap: Clean up local variable shadowing, Markus Armbruster, 2023/09/20
- [PATCH v2 5/7] block/vdi: Clean up local variable shadowing, Markus Armbruster, 2023/09/20
- [PATCH v2 7/7] qobject atomics osdep: Make a few macros more hygienic, Markus Armbruster, 2023/09/20
- [PATCH v2 6/7] block: Clean up local variable shadowing, Markus Armbruster, 2023/09/20
- [PATCH v2 2/7] migration: Clean up local variable shadowing, Markus Armbruster, 2023/09/20