[clang] [clang]Implement the c23 stdc bit builtins (PR #185978)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 10 10:02:47 PDT 2026


================
@@ -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:

Ope, maybe I spoke too soon. C23 7.18.1p5:

> It is unspecified whether any generic function declared in <stdbit.h> is a macro or an identifier
declared with external linkage. If a macro definition is suppressed to access an actual function,
or a program defines an external identifier with the name of a generic function, the behavior is
unspecified.

https://github.com/llvm/llvm-project/pull/185978


More information about the cfe-commits mailing list