diff --git a/libc/include/llvm-libc-macros/stdbit-macros.h b/libc/include/llvm-libc-macros/stdbit-macros.h index febe95fe0a1e3..da0fb1a578f13 100644 --- a/libc/include/llvm-libc-macros/stdbit-macros.h +++ b/libc/include/llvm-libc-macros/stdbit-macros.h @@ -9,6 +9,23 @@ #ifndef __LLVM_LIBC_MACROS_STDBIT_MACROS_H #define __LLVM_LIBC_MACROS_STDBIT_MACROS_H +#ifdef __cplusplus +inline unsigned char stdc_leading_zeros(unsigned char x) { + return stdc_leading_zeros_uc(x); +} +inline unsigned short stdc_leading_zeros(unsigned short x) { + return stdc_leading_zeros_us(x); +} +inline unsigned stdc_leading_zeros(unsigned x) { + return stdc_leading_zeros_ui(x); +} +inline unsigned long stdc_leading_zeros(unsigned long x) { + return stdc_leading_zeros_ul(x); +} +inline unsigned long long stdc_leading_zeros(unsigned long long x) { + return stdc_leading_zeros_ull(x); +} +#else #define stdc_leading_zeros(x) \ _Generic((x), \ unsigned char: stdc_leading_zeros_uc, \ @@ -16,5 +33,6 @@ unsigned: stdc_leading_zeros_ui, \ unsigned long: stdc_leading_zeros_ul, \ unsigned long long: stdc_leading_zeros_ull)(x) +#endif // __cplusplus #endif // __LLVM_LIBC_MACROS_STDBIT_MACROS_H diff --git a/libc/include/stdbit.h.def b/libc/include/stdbit.h.def index cb79ac1caf049..c5a77329fbfe7 100644 --- a/libc/include/stdbit.h.def +++ b/libc/include/stdbit.h.def @@ -10,8 +10,9 @@ #define LLVM_LIBC_STDBIT_H #include <__llvm-libc-common.h> -#include %%public_api() +#include + #endif // LLVM_LIBC_STDBIT_H diff --git a/libc/test/include/CMakeLists.txt b/libc/test/include/CMakeLists.txt index ecc32380c596e..6a586cd715cf8 100644 --- a/libc/test/include/CMakeLists.txt +++ b/libc/test/include/CMakeLists.txt @@ -31,9 +31,5 @@ if (LLVM_LIBC_FULL_BUILD) # simply testing the macros provided by stdbit.h, not the implementation # of the underlying functions which the type generic macros may dispatch # to. - COMPILE_OPTIONS - # stdbit.h is full of type generic macros implemented via C11 _Generic. - # Clang will produce -Wno-c11-extensions when using _Generic in C++ mode. - -Wno-c11-extensions ) endif()