On Mon, 18 Mar 2024 at 16:46, Kaz Kylheku <k...@kylheku.com> wrote: > > On 2024-03-18 00:30, Jonathan Wakely wrote: > >>+@item __EXP_COUNTER__ > >>+This macro's name means "(macro) expansion counter". > >>+Outside of macro replacement sequences, it expands to the integer > >>+token @code{1}. This make it possible to easily test for the presence > >>+of this feature using conditional directives such as > >>+@code{#if __EXP_COUNTER__}. > > > > It's a macro, so you can just use '#ifdef __EXP_COUNTER__' to test if > > it's supported. Is this additional behaviour necessary? > > Thanks for looking at the patch. > > The macro has to be defined, but it doesn't have to be 1. > > Outside a macro body, it could just appear defined > with an empty value, as if by #define __EXP_COUNTER__. > > When I dump the predefined macros of a nearby GCC installation, I > see very few empty ones: > > $ echo | gcc -dM -E - | awk 'NF == 2' > #define __USER_LABEL_PREFIX__ > #define __REGISTER_PREFIX__ > > The __EXP_COUNTER__ and __UEXP_COUNTER__ symbols are > intended for suffix and infix use, so they are roughly in > a kind of category with those those two.
I don't feel strongly about the value, it seems fine to define it as 1 too. I just thought it was a bit strange to explicitly mention testing its value to detect support, when #ifdef seems simpler and more "correct" (as in, it just checks if it's defined, and thevalue is irrelevant). > > I will make that change, and also fix the grammar error > and remove the conflict-promoting ChangeLog changes. >