Re: [Libguestfs] [PATCH nbdkit 1/2] common/include: Change unique-name macros to use __COUNTER__

2022-02-23 Thread Richard W.M. Jones
On Wed, Feb 23, 2022 at 10:28:17AM +0100, Laszlo Ersek wrote: > On 02/23/22 00:05, Eric Blake wrote: > > On Tue, Feb 22, 2022 at 09:35:03PM +, Richard W.M. Jones wrote: > >> Previously the macros used __LINE__ which meant they created a unique > >> name specific to the line on which the macro

Re: [Libguestfs] [PATCH nbdkit 1/2] common/include: Change unique-name macros to use __COUNTER__

2022-02-23 Thread Laszlo Ersek
On 02/23/22 00:05, Eric Blake wrote: > On Tue, Feb 22, 2022 at 09:35:03PM +, Richard W.M. Jones wrote: >> Previously the macros used __LINE__ which meant they created a unique >> name specific to the line on which the macro was expanded. This >> worked to a limited degree for cases like: >>

Re: [Libguestfs] [PATCH nbdkit 1/2] common/include: Change unique-name macros to use __COUNTER__

2022-02-22 Thread Eric Blake
On Tue, Feb 22, 2022 at 09:35:03PM +, Richard W.M. Jones wrote: > Previously the macros used __LINE__ which meant they created a unique > name specific to the line on which the macro was expanded. This > worked to a limited degree for cases like: > > #define FOO \ > ({ int

[Libguestfs] [PATCH nbdkit 1/2] common/include: Change unique-name macros to use __COUNTER__

2022-02-22 Thread Richard W.M. Jones
Previously the macros used __LINE__ which meant they created a unique name specific to the line on which the macro was expanded. This worked to a limited degree for cases like: #define FOO \ ({ int NBDKIT_UNIQUE_NAME(foo) = 42; \ NBDKIT_UNIQUE_NAME(foo) * 2 }) since the “FOO”