zygoloid wrote:

I see. The glibc header comment gives an idea of what's going on here:
```c
/* There are two variant implementations of type-generic macros in
   this file: one for GCC 8 and later, using __builtin_tgmath and
   where each macro expands each of its arguments only once, and one
   for older GCC, using other compiler extensions but with macros
   expanding their arguments many times (so resulting in exponential
   blowup of the size of expansions when calls to such macros are
   nested inside arguments to such macros).  */
```
Indeed, it seems that `_Generic` is not sufficient to implement the 
`<tgmath.h>` macros without expanding the arguments at least twice each, and in 
any case glibc doesn't have an implementation that uses `_Generic`.
So it looks like the world is thoroughly unprepared for us to not provide our 
own `<tgmath.h>` in general. We could add a builtin matching the GCC 
`__builtin_tgmath` builtin and remove our header for at least those targets, 
though. And we should find out what other libc implementations are doing.

https://github.com/llvm/llvm-project/pull/135236
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to