Paul Eggert wrote: > On 3/2/21 7:09 PM, Bruno Haible wrote: > > + /* On TinyCC, make sure that the macros that indicate the special > > invocation > > + convention get undefined. */ > > +# ifdef __TINYC__ > > +# undef __need_wchar_t > > +# undef __need_size_t > > Would it be more robust to omit the "#ifdef __TINYC__" line, and > unconditionally undef those macros? That won't hurt GCC, and it should > help with any compiler (not just tcc) that is incompatible with GCC in > this respect.
Good point. I had considered it, but I'm too cautious sometimes :) Fixed as below. Also, macOS has the same convention regarding __need_* macros in <stddef.h> as glibc. Therefore, the bug Luca was seeing on a glibc system most likely also exists on macOS. 2021-03-04 Bruno Haible <br...@clisp.org> stddef: Generalize tcc workaround to other compilers. Suggested by Paul Eggert in <https://lists.gnu.org/archive/html/bug-gnulib/2021-03/msg00027.html>. * lib/stddef.in.h: Undefine the __need_* macros with all compilers. * doc/posix-headers/stddef.texi: Mention that the TinyCC bug also exists on macOS. diff --git a/doc/posix-headers/stddef.texi b/doc/posix-headers/stddef.texi index ba27fa8..fe7ed26 100644 --- a/doc/posix-headers/stddef.texi +++ b/doc/posix-headers/stddef.texi @@ -29,8 +29,8 @@ of a pointer: AIX 7.2 with xlc in 64-bit mode. @item -When this header file is provided by TinyCC 0.9.27 on glibc systems, it does -not fulfil the expectations of other glibc header files. +When this header file is provided by TinyCC 0.9.27 on glibc or macOS systems, +it does not fulfil the expectations of other system header files. @end itemize Portability problems not fixed by Gnulib: diff --git a/lib/stddef.in.h b/lib/stddef.in.h index 590e12c..a1fc80c 100644 --- a/lib/stddef.in.h +++ b/lib/stddef.in.h @@ -44,13 +44,11 @@ # @INCLUDE_NEXT@ @NEXT_STDDEF_H@ /* On TinyCC, make sure that the macros that indicate the special invocation convention get undefined. */ -# ifdef __TINYC__ -# undef __need_wchar_t -# undef __need_size_t -# undef __need_ptrdiff_t -# undef __need_NULL -# undef __need_wint_t -# endif +# undef __need_wchar_t +# undef __need_size_t +# undef __need_ptrdiff_t +# undef __need_NULL +# undef __need_wint_t # endif #else