This is a good idea. I’ve been working around the absence of this by writing wrapper functions tagged with the corresponding metadata.
I don’t know clang well enough to review the implementation, but if it ships, I’ll use it. Whatever the syntax.
they seem like very surgical tools for controlling inlining, and so applying them to a family of functions is perhaps unwise – and the case where the builtin is applied to a call in some instantiations and to a built-in operator in others does not immediately seem like a primary concern to me
Having seen a lot of library and game engine code with FORCE_INLINE stuck on dozens functions, I’d eventually expect it to become an issue for some people. However, I think it would be easier to start simple and issue errors in any case where these intrinsics don’t make sense, and relax it later if there’s a real need.
(Are there also macro scenarios where you anticipate it being unknown whether the operand is a function call?)
Arthur O’Dwyer pointed that out in the code review – one example could be sqrt being a function call or a builtin call. Another thing that comes to my mind is
min from windows.h.
What is the semantics of calling function with __builtin_always_inline that is marked with attribute ((noinline)) ?
It seems reasonable to me that call site attributes should be stronger than global attributes.
In general SGTM.