https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66970

Andy Lutomirski <luto at mit dot edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |luto at mit dot edu

--- Comment #2 from Andy Lutomirski <luto at mit dot edu> ---
I'd also like this feature.

Not all standard open source projects use autoconf.  For example, the Linux
kernel doesn't.  The Linux kernel *is* capable of probing for the existence of
builtins, but it's a pain in the neck: it needs to write out a test .c file and
try compiling it.  This is slow, and it scales terribly: the configuration step
wastes time proportional to the number of probed builtins probing for builtins,
and the constant factor is pretty bad.

It also means that the amount of work needed to use a new builtin is rather
high: add a new config step and remember to use the result correctly in the
code that uses the builtin.  The name of the resulting macro can't really be
standardized.

Sure, with __has_builtin, users would still need to probe for __has_builtin
itself, but that would be a single check.  For builtins that are newer than
__has_builtin, there would be no need to have a fallback and, for older
builtins, a fallback could be added if needed.  (Alternatively, the C code
could simply not use the builtin on older gcc versions.)

Reply via email to