[libc-commits] [libc] 7471a1d - [libc] Add missing public_includes header dependencies (#240740)

via libc-commits libc-commits at lists.llvm.org
Tue Nov 10 01:34:07 PST 2026


Author: Jeff Bailey
Date: 2026-11-10T09:33:57Z
New Revision: 7471a1d8ef5cf94fb86a121348efa38c63502111

URL: https://github.com/llvm/llvm-project/commit/7471a1d8ef5cf94fb86a121348efa38c63502111
DIFF: https://github.com/llvm/llvm-project/commit/7471a1d8ef5cf94fb86a121348efa38c63502111.diff

LOG: [libc] Add missing public_includes header dependencies (#240740)

Several YAML header specifications list headers under public_includes
that are omitted from their add_header_macro DEPENDS lists in
libc/include/CMakeLists.txt. In particular, pthread.h includes sched.h
and time.h, threads.h includes time.h, link.h includes elf.h, and
sys/sem.h includes sys/ipc.h.

When targets that depend on libc.include.pthread compile before
generate-libc-headers has populated the build include directory, such as
running libc-lint on a clean tree, #include <sched.h> falls back to the
host system header and fails with redefinition errors on struct timespec
and struct sched_param.

Move the sched and elf header definitions ahead of pthread and link so
add_gen_header validates them at configure time, and add the missing
header dependencies across all four targets.

Assisted-by: Automated tooling, human reviewed.

Added: 
    

Modified: 
    libc/include/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index c0e518cabc674..523bb11541f7a 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -457,6 +457,7 @@ add_header_macro(
     .llvm-libc-types.tss_t
     .llvm-libc-types.tss_dtor_t
     .llvm-libc-types.struct_timespec
+    .time
 )
 
 add_header_macro(
@@ -585,6 +586,22 @@ add_header_macro(
     .unistd
 )
 
+add_header_macro(
+  sched
+  ../libc/include/sched.yaml
+  sched.h
+  DEPENDS
+    .llvm_libc_common_h
+    .llvm-libc-macros.sched_macros
+    .llvm-libc-types.cpu_set_t
+    .llvm-libc-types.pid_t
+    .llvm-libc-types.size_t
+    .llvm-libc-types.struct_sched_param
+    # Needed according to posix standard
+    .llvm-libc-types.time_t
+    .llvm-libc-types.struct_timespec
+)
+
 add_header_macro(
   pthread
   ../libc/include/pthread.yaml
@@ -613,6 +630,8 @@ add_header_macro(
     .llvm-libc-types.pthread_id_np_t
     .llvm-libc-types.struct_timespec
     .llvm_libc_common_h
+    .sched
+    .time
 )
 
 add_header_macro(
@@ -648,22 +667,6 @@ if(LIBC_TARGET_ARCHITECTURE STREQUAL "x86_64")
   )
 endif()
 
-add_header_macro(
-  sched
-  ../libc/include/sched.yaml
-  sched.h
-  DEPENDS
-    .llvm_libc_common_h
-    .llvm-libc-macros.sched_macros
-    .llvm-libc-types.cpu_set_t
-    .llvm-libc-types.pid_t
-    .llvm-libc-types.size_t
-    .llvm-libc-types.struct_sched_param
-    # Needed according to posix standard
-    .llvm-libc-types.time_t
-    .llvm-libc-types.struct_timespec
-)
-
 add_header_macro(
   semaphore
   ../libc/include/semaphore.yaml
@@ -689,6 +692,15 @@ add_header_macro(
     .llvm-libc-types.posix_spawn_file_actions_t
 )
 
+add_header_macro(
+  elf
+  ../libc/include/elf.yaml
+  elf.h
+  DEPENDS
+    .llvm-libc-proxy.elf_proxy
+    .llvm_libc_common_h
+)
+
 add_header_macro(
   link
   ../libc/include/link.yaml
@@ -700,15 +712,7 @@ add_header_macro(
     .llvm-libc-types.struct_link_map
     .llvm-libc-types.struct_r_debug
     .llvm-libc-types.__dl_iterate_phdr_callback_t
-)
-
-add_header_macro(
-  elf
-  ../libc/include/elf.yaml
-  elf.h
-  DEPENDS
-    .llvm-libc-proxy.elf_proxy
-    .llvm_libc_common_h
+    .elf
 )
 
 # TODO: Not all platforms will have a include/sys directory. Add the sys
@@ -929,6 +933,7 @@ add_header_macro(
     .llvm-libc-types.struct_semid_ds
     .llvm-libc-types.struct_sembuf
     .llvm-libc-types.struct_seminfo
+    .sys_ipc
 )
 
 add_header_macro(


        


More information about the libc-commits mailing list