================ @@ -0,0 +1,19 @@ +#ifndef LLVM_CLANG_TEST_STDBIT_H +#define LLVM_CLANG_TEST_STDBIT_H + +#define stdc_leading_zeros(x) (__builtin_stdc_leading_zeros((x))) ---------------- AaronBallman wrote:
Just shipping the builtins isn't conforming; you still have to get access to an actual external symbol because you can still get a function pointer to them. This is C23 7.1.4.p1: > Any function declared in a header may be additionally implemented as a > function-like macro defined in the header, so if a library function is declared explicitly when its header is included, one of the techniques shown later in the next subclause can be used to ensure the declaration is not affected by such a macro. Any macro definition of a function can be suppressed locally by enclosing the name of the function in parentheses, because the name is then not followed by the left parenthesis that indicates expansion of a macro function name. For the same syntactic reason, it is permitted to take the address of a library function even if it is also defined as a macro. The use of #undef to remove any macro definition will also ensure that an actual function is referred to. We'd need to hear from @ldionne or @philnik777 (or others) as to what the STL plans to do here at least for libc++, but it's not uncommon for the C++ standard library to vend a C standard header for use in C++ mode: https://github.com/llvm/llvm-project/blob/main/libcxx/include/stdio.h Another alternative would be using `__attribute__((overloadable))` like we do for tgmath.h: https://github.com/llvm/llvm-project/blob/main/clang/lib/Headers/tgmath.h#L29 https://github.com/llvm/llvm-project/pull/185978 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
