[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 hygienic
Kevin Wolf <kwolf@xxxxxxxxxx> 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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |