[libc-commits] [libc] [libc][NFC] Move sys/ucontext.h to YAML generation (PR #194573)

Jeff Bailey via libc-commits libc-commits at lists.llvm.org
Tue Apr 28 02:04:17 PDT 2026


https://github.com/kaladron created https://github.com/llvm/llvm-project/pull/194573

Renamed sys/ucontext.h to sys/ucontext.h.def and created a corresponding sys/ucontext.yaml, following the pattern used by sys/prctl. Updated CMakeLists.txt to use add_header_macro.

Also removed the orphaned top-level ucontext.h.def which was never referenced by ucontext.yaml.

>From d4541d77d67467da52eb3bf14892ed84501b753b Mon Sep 17 00:00:00 2001
From: Jeff Bailey <jbailey at raspberryginger.com>
Date: Tue, 28 Apr 2026 09:56:27 +0100
Subject: [PATCH] [libc][NFC] Move sys/ucontext.h to YAML generation

Renamed sys/ucontext.h to sys/ucontext.h.def and created a
corresponding sys/ucontext.yaml, following the pattern used by
sys/prctl. Updated CMakeLists.txt to use add_header_macro.

Also removed the orphaned top-level ucontext.h.def which was
never referenced by ucontext.yaml.
---
 libc/include/CMakeLists.txt                     |  8 +++++---
 libc/include/sys/{ucontext.h => ucontext.h.def} |  2 ++
 libc/include/sys/ucontext.yaml                  |  4 ++++
 libc/include/ucontext.h.def                     | 16 ----------------
 4 files changed, 11 insertions(+), 19 deletions(-)
 rename libc/include/sys/{ucontext.h => ucontext.h.def} (96%)
 create mode 100644 libc/include/sys/ucontext.yaml
 delete mode 100644 libc/include/ucontext.h.def

diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index 38e0c435006b7..79380c5a21cd6 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -477,10 +477,12 @@ if(LIBC_TARGET_ARCHITECTURE STREQUAL "x86_64")
       .llvm-libc-types.stack_t
   )
 
-  add_header(
+  add_header_macro(
     sys_ucontext
-    HDR
-      sys/ucontext.h
+    ../libc/include/sys/ucontext.yaml
+    sys/ucontext.h
+    DEPENDS
+      .ucontext
   )
 endif()
 
diff --git a/libc/include/sys/ucontext.h b/libc/include/sys/ucontext.h.def
similarity index 96%
rename from libc/include/sys/ucontext.h
rename to libc/include/sys/ucontext.h.def
index 7f0b830434475..82813f3eca220 100644
--- a/libc/include/sys/ucontext.h
+++ b/libc/include/sys/ucontext.h.def
@@ -11,4 +11,6 @@
 
 #include <ucontext.h>
 
+%%public_api()
+
 #endif // LLVM_LIBC_SYS_UCONTEXT_H
diff --git a/libc/include/sys/ucontext.yaml b/libc/include/sys/ucontext.yaml
new file mode 100644
index 0000000000000..6d3d38ab24c78
--- /dev/null
+++ b/libc/include/sys/ucontext.yaml
@@ -0,0 +1,4 @@
+header: sys/ucontext.h
+header_template: ucontext.h.def
+standards:
+  - posix
diff --git a/libc/include/ucontext.h.def b/libc/include/ucontext.h.def
deleted file mode 100644
index 0750d99a4a0c5..0000000000000
--- a/libc/include/ucontext.h.def
+++ /dev/null
@@ -1,16 +0,0 @@
-//===-- POSIX header ucontext.h --------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_LIBC_UCONTEXT_H
-#define LLVM_LIBC_UCONTEXT_H
-
-#include "__llvm-libc-common.h"
-
-%%public_api()
-
-#endif // LLVM_LIBC_UCONTEXT_H



More information about the libc-commits mailing list