Hi Paul,

> which doesn’t work when
> compiled with stricter C17-and-earlier compilers.  The feature is
> using ‘#define f(a, ...) b’ and calling ‘f’ with only one arg.

1) Comparing ISO C 17 § 6.10.3.(12) vs. ISO C 23 § 6.10.5.(12):
The C 17 text also has the "(if any)" part; so that means that
in C 17 one needs to write
   f (x,)
not
   f (x)

How about, instead of defining two macros

   _GL_FUNCDECL_SYS (func, rettype, parameters);
   _GL_FUNCATTR_SYS (func, rettype, parameters, attributes);

we would have one macro

  _GL_FUNCDECL_SYS (func, rettype, parameters, attributes);

and invoke it with 4 arguments always, e.g.

  _GL_FUNCDECL_SYS (getprogname, const char *, (void),);
  _GL_FUNCATTR_SYS (getprogname, const char *, (void), _GL_ATTRIBUTE_PURE);

To me, that is simpler. While empty macro arguments are not "esthetic"
for some people, this is only a question of getting used to it. Empty
macro arguments are supported since C 99; only K&R C preprocessors had
problems with them.


2) The CI reports a compilation error on many platforms:

In file included from ./uchar.h:61,
                 from ../../gllib/btoc32.c:23:
./wchar.h:815:61: error: macro "_GL_FUNCDECL_RPL" passed 4 arguments, but takes 
just 3
  815 | _GL_FUNCDECL_RPL (btowc, wint_t, (int c), _GL_ATTRIBUTE_PURE);
      |                                                             ^
In file included from ./uchar.h:61,
                 from ../../gllib/btoc32.c:23:
./wchar.h:287: note: macro "_GL_FUNCDECL_RPL" defined here
  287 | #define _GL_FUNCDECL_RPL(func,rettype,parameters) \
      | 
make[4]: *** [Makefile:11826: btoc32.o] Error 1


Bruno




Reply via email to