[libc-commits] [libc] [libc][sched] Implement proxy headers for `cpu_set_t`, `struct sched_param` and `sched_macros`. (PR #126303)

via libc-commits libc-commits at lists.llvm.org
Thu Feb 13 15:13:48 PST 2025


================
@@ -205,5 +205,13 @@ add_proxy_header_library(
     libc.include.wchar
 )
 
+add_proxy_header_library(
+  sched_macros
+  HDRS
+    sched_macros.h
+  FULL_BUILD_DEPENDS
+    libc.include.llvm-libc-macros.sched_macros
----------------
lntue wrote:

I got the following errors when trying this PR locally:
```
$ cmake -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_BUILD_TYPE=Release  -DLLVM_ENABLE_RUNTIMES="libc;compiler-rt" -DLLVM_LIBC_FULL_BUILD=ON -DLLVM_LIBC_INCLUDE_SCUDO=ON -DCOMPILER_RT_BUILD_SCUDO_STANDALONE_WITH_LLVM_LIBC=ON -DCOMPILER_RT_BUILD_GWP_ASAN=OFF -DCOMPILER_RT_SCUDO_STANDALONE_BUILD_SHARED=OFF -G Ninja -S ../runtimes
...
$ ninja libc
[826/826] Linking CXX static library libc/lib/libc.a
$ ninja check-libc
[5499/9162] Building CXX object libc/tes..._test.__build__.dir/cpu_count_test.cpp.o
FAILED: libc/test/src/sched/CMakeFiles/libc.test.src.sched.cpu_count_test.__build__.dir/cpu_count_test.cpp.o 
/usr/bin/clang++ -DLIBC_NAMESPACE=__llvm_libc_21_0_0_git -I/usr/local/google/home/lntue/experiment/llvm-project/libc -isystem /usr/local/google/home/lntue/experiment/llvm-project/build/libc/include -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -std=gnu++17 -fpie -DLIBC_FULL_BUILD -ffreestanding -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -Wimplicit-fallthrough -Wwrite-strings -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wstrict-prototypes -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wthread-safety -MD -MT libc/test/src/sched/CMakeFiles/libc.test.src.sched.cpu_count_test.__build__.dir/cpu_count_test.cpp.o -MF libc/test/src/sched/CMakeFiles/libc.test.src.sched.cpu_count_test.__build__.dir/cpu_count_test.cpp.o.d -o libc/test/src/sched/CMakeFiles/libc.test.src.sched.cpu_count_test.__build__.dir/cpu_count_test.cpp.o -c /usr/local/google/home/lntue/experiment/llvm-project/libc/test/src/sched/cpu_count_test.cpp
/usr/local/google/home/lntue/experiment/llvm-project/libc/test/src/sched/cpu_count_test.cpp:32:18: error: use of undeclared identifier '__sched_getcpucount'; did you mean '__llvm_libc_21_0_0_git::__sched_getcpucount'?
  int num_cpus = CPU_COUNT(&mask);
                 ^
/usr/local/google/home/lntue/experiment/llvm-project/libc/include/llvm-libc-macros/linux/sched-macros.h:27:24: note: expanded from macro 'CPU_COUNT'
#define CPU_COUNT(set) CPU_COUNT_S(sizeof(cpu_set_t), set)
                       ^
/usr/local/google/home/lntue/experiment/llvm-project/libc/include/llvm-libc-macros/linux/sched-macros.h:26:35: note: expanded from macro 'CPU_COUNT_S'
#define CPU_COUNT_S(setsize, set) __sched_getcpucount(setsize, set)
                                  ^
/usr/local/google/home/lntue/experiment/llvm-project/libc/src/sched/sched_getcpucount.h:20:5: note: '__llvm_libc_21_0_0_git::__sched_getcpucount' declared here
int __sched_getcpucount(size_t cpuset_size, const cpu_set_t *mask);
    ^
1 error generated.
[5628/9162] Building CXX object libc/tes...st.__unit__.__build__.dir/op_tests.cpp.o
ninja: build stopped: subcommand failed.
```

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


More information about the libc-commits mailing list