[Bug c/66970] Add __has_builtin() macro

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Aug 24 11:38:00 GMT 2018


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

--- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to felix from comment #7)
> I made the feature closely mimic The Other Compiler's behaviour: only
> function built-ins are recognised. This includes generic functions like
> __builtin_add_overflow and C library functions specially handled by the
> front-end like printf (unless -fno-builtin is used), but excludes types like
> __builtin_va_list and function-like constructs (implemented as keywords)
> like __builtin_offsetof and __builtin_types_compatible_p. This is not so
> much of a problem for them, since they also provide __has_feature(),
> __has_extension() and __is_identifier() macros.

I hate that behaviour. Having to use !__is_identifier(__builtin_launder) is
confusing (and not just to me, but to developers of LLVM's own libc++, who I've
had to explain the problem to).

But consistency with Clang is probably more important than making __has_builtin
behave sanely.


More information about the Gcc-bugs mailing list