[cfe-dev] __builtin_choose_expr and __builtin_types_compatible_p

Richard Smith via cfe-dev cfe-dev at lists.llvm.org
Mon May 21 11:56:58 PDT 2018


On 20 May 2018 at 06:05, Jim Pryor via cfe-dev <cfe-dev at lists.llvm.org>
wrote:

> These builtins are mentioned in the docs and seem to be honored (I'm
> compiling in C with --std=c99) but `__has_builtin(__builtin_choose_expr)`
> returns 0, and similarly for `__builtin_types_compatible_p`. Can someone
> on this list explain why?
>
> Should I expect `__has_builtin` to have other false negatives too?
>
> Does the issue have anything to do with these functions being declared as
> keywords in include/clang/Basic/TokenKinds.def?
>
> I'm not subscribed to the list, so I'd welcome being cc'd on any replies.
> Thanks.


Status quo: __has_builtin tests for the existence of a builtin function.
__builtin_choose_expr and __builtin_types_compatible_p aren't functions, so
__has_builtin can't be used to test for them.

Last time this was brought up, I seem to recall that there was largely
consensus that we should also report the existence of non-function builtins
through __has_builtin, but I don't think anyone actually put together a
patch to implement that. Are you interested in doing so?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180521/1ed5ee3c/attachment.html>


More information about the cfe-dev mailing list