[libc-commits] [libc] fc16f15 - [libc] Add POSIX-mandated transitive header inclusion to three headers. (#237436)

via libc-commits libc-commits at lists.llvm.org
Mon Nov 2 18:07:37 PST 2026


Author: Alexey Samsonov
Date: 2026-11-02T18:07:32-08:00
New Revision: fc16f151a697ae6cc5b0f9a7732e838eeccf9eca

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

LOG: [libc] Add POSIX-mandated transitive header inclusion to three headers. (#237436)

Per POSIX standard:
* `<sys/sem.h>` shall include the `<sys/ipc.h>` header
* Inclusion of the `<threads.h>` header shall make
  symbols defined in the header `<time.h>` visible.
* Inclusion of the `<pthread.h>` header shall make symbols
  defined in the headers `<sched.h>` and `<time.h>` visible.

There are real-world programs which correctly rely on this
behavior.

Implement all of the above using `public_includes` feature in YAML
config
to add transitive inclusions to generated headers. Technically speaking,
we can "make symbols visible" using other mechanisms, but simple
transitive inclusion is by far the easiest one.

Added: 
    

Modified: 
    libc/include/pthread.yaml
    libc/include/sys/sem.yaml
    libc/include/threads.yaml

Removed: 
    


################################################################################
diff  --git a/libc/include/pthread.yaml b/libc/include/pthread.yaml
index 134b03d3275aa8..9f2fffd38a088b 100644
--- a/libc/include/pthread.yaml
+++ b/libc/include/pthread.yaml
@@ -1,6 +1,9 @@
 header: pthread.h
 standards:
   - posix
+public_includes:
+  - sched.h
+  - time.h
 macros:
   - macro_name: "PTHREAD_NULL"
     macro_header: pthread-macros.h

diff  --git a/libc/include/sys/sem.yaml b/libc/include/sys/sem.yaml
index 6e583d669d250c..d45a4f588b62f9 100644
--- a/libc/include/sys/sem.yaml
+++ b/libc/include/sys/sem.yaml
@@ -2,6 +2,8 @@ header: sys/sem.h
 standards:
   - posix
   - linux
+public_includes:
+  - sys/ipc.h
 macros:
   - macro_name: SEM_UNDO
     macro_header: sys-sem-macros.h

diff  --git a/libc/include/threads.yaml b/libc/include/threads.yaml
index c4d9cfd0322eae..cab48108385898 100644
--- a/libc/include/threads.yaml
+++ b/libc/include/threads.yaml
@@ -1,6 +1,8 @@
 header: threads.h
 standards:
   - stdc
+public_includes:
+  - time.h
 macros:
   - macro_name: ONCE_FLAG_INIT
     macro_value: '{0}'
@@ -15,7 +17,6 @@ types:
   - type_name: thrd_t
   - type_name: tss_t
   - type_name: tss_dtor_t
-  - type_name: struct_timespec
 enums:
   - name: mtx_plain
     value: null


        


More information about the libc-commits mailing list