[libc-commits] [libc] d03e8f4 - [libc] Remove yet another batch of header template files (#191067)

via libc-commits libc-commits at lists.llvm.org
Wed Apr 8 15:56:46 PDT 2026


Author: Alexey Samsonov
Date: 2026-04-08T15:56:41-07:00
New Revision: d03e8f4fac8edc303dfebeb9929c32b6d31c77c8

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

LOG: [libc] Remove yet another batch of header template files (#191067)

This follows up on ae63230c23151c16ba68d5213da8bd5459c03a40 and remove
header templates from more C/POSIX standard headers, where templates
only used to `#include` files with macro definitions. We add this logic
to YAML instead - add entries to the `macros` list that point to the
correct `macro_header` to ensure it would be included.

Added: 
    

Modified: 
    libc/include/arpa/inet.yaml
    libc/include/complex.yaml
    libc/include/elf.yaml
    libc/include/fcntl.yaml
    libc/include/inttypes.yaml
    libc/include/llvm-libc-types/imaxdiv_t.h
    libc/include/netinet/in.yaml
    libc/include/poll.yaml
    libc/include/sched.yaml
    libc/include/signal.yaml
    libc/include/stdio.yaml
    libc/include/stdlib.yaml
    libc/include/sysexits.yaml
    libc/include/termios.yaml
    libc/include/unistd.yaml
    utils/bazel/llvm-project-overlay/libc/BUILD.bazel

Removed: 
    libc/include/arpa/inet.h.def
    libc/include/complex.h.def
    libc/include/elf.h.def
    libc/include/fcntl.h.def
    libc/include/inttypes.h.def
    libc/include/netinet/in.h.def
    libc/include/poll.h.def
    libc/include/sched.h.def
    libc/include/signal.h.def
    libc/include/stdio.h.def
    libc/include/stdlib.h.def
    libc/include/sysexits.h.def
    libc/include/termios.h.def
    libc/include/unistd.h.def


################################################################################
diff  --git a/libc/include/arpa/inet.h.def b/libc/include/arpa/inet.h.def
deleted file mode 100644
index 6a62b2c7be81b..0000000000000
--- a/libc/include/arpa/inet.h.def
+++ /dev/null
@@ -1,18 +0,0 @@
-//===-- C standard library header network.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_ARPA_INET_H
-#define LLVM_LIBC_ARPA_INET_H
-
-#include "__llvm-libc-common.h"
-
-#include <inttypes.h>
-
-%%public_api()
-
-#endif // LLVM_LIBC_ARPA_INET_H

diff  --git a/libc/include/arpa/inet.yaml b/libc/include/arpa/inet.yaml
index 350a4d74e5bec..a0601d700d1b4 100644
--- a/libc/include/arpa/inet.yaml
+++ b/libc/include/arpa/inet.yaml
@@ -1,5 +1,6 @@
 header: arpa/inet.h
-header_template: inet.h.def
+standards:
+  - posix
 macros: []
 types:
   - type_name: in_addr

diff  --git a/libc/include/complex.h.def b/libc/include/complex.h.def
deleted file mode 100644
index 65f5765573e84..0000000000000
--- a/libc/include/complex.h.def
+++ /dev/null
@@ -1,17 +0,0 @@
-//===-- C standard library header complex.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_COMPLEX_H
-#define LLVM_LIBC_COMPLEX_H
-
-#include "__llvm-libc-common.h"
-#include "llvm-libc-macros/complex-macros.h"
-
-%%public_api()
-
-#endif // LLVM_LIBC_COMPLEX_H

diff  --git a/libc/include/complex.yaml b/libc/include/complex.yaml
index 05318480a02f1..4db42be6082da 100644
--- a/libc/include/complex.yaml
+++ b/libc/include/complex.yaml
@@ -1,6 +1,19 @@
 header: complex.h
-header_template: complex.h.def
-macros: []
+standards:
+  - stdc
+macros:
+  - macro_name: complex
+    macro_header: complex-macros.h
+  - macro_name: _Complex_I
+    macro_header: complex-macros.h
+  - macro_name: I
+    macro_header: complex-macros.h
+  - macro_name: CMPLX
+    macro_header: complex-macros.h
+  - macro_name: CMPLXF
+    macro_header: complex-macros.h
+  - macro_name: CMPLXL
+    macro_header: complex-macros.h
 types:
   - type_name: cfloat16
   - type_name: cfloat128

diff  --git a/libc/include/elf.h.def b/libc/include/elf.h.def
deleted file mode 100644
index b9b2604fc7167..0000000000000
--- a/libc/include/elf.h.def
+++ /dev/null
@@ -1,17 +0,0 @@
-//===-- System V header elf.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_ELF_H
-#define LLVM_LIBC_ELF_H
-
-#include "__llvm-libc-common.h"
-#include "llvm-libc-macros/elf-macros.h"
-
-%%public_api()
-
-#endif // LLVM_LIBC_ELF_H

diff  --git a/libc/include/elf.yaml b/libc/include/elf.yaml
index 903e85e88e3ad..6889e2125096a 100644
--- a/libc/include/elf.yaml
+++ b/libc/include/elf.yaml
@@ -1,5 +1,4 @@
 header: elf.h
-header_template: elf.h.def
 standards:
   - svid
 macros:
@@ -485,6 +484,34 @@ macros:
     macro_value: 58
   - macro_name: R_X86_64_IRELATIVE
     macro_value: 37
+  - macro_name: ELF32_ST_BIND
+    macro_header: elf-macros.h
+  - macro_name: ELF32_ST_TYPE
+    macro_header: elf-macros.h
+  - macro_name: ELF32_ST_INFO
+    macro_header: elf-macros.h
+  - macro_name: ELF64_ST_BIND
+    macro_header: elf-macros.h
+  - macro_name: ELF64_ST_TYPE
+    macro_header: elf-macros.h
+  - macro_name: ELF64_ST_INFO
+    macro_header: elf-macros.h
+  - macro_name: ELF32_ST_VISIBILITY
+    macro_header: elf-macros.h
+  - macro_name: ELF64_ST_VISIBILITY
+    macro_header: elf-macros.h
+  - macro_name: ELF32_R_SYM
+    macro_header: elf-macros.h
+  - macro_name: ELF32_R_TYPE
+    macro_header: elf-macros.h
+  - macro_name: ELF32_R_INFO
+    macro_header: elf-macros.h
+  - macro_name: ELF64_R_SYM
+    macro_header: elf-macros.h
+  - macro_name: ELF64_R_TYPE
+    macro_header: elf-macros.h
+  - macro_name: ELF64_R_INFO
+    macro_header: elf-macros.h
 types:
   - type_name: Elf32_Addr
   - type_name: Elf32_Chdr

diff  --git a/libc/include/fcntl.h.def b/libc/include/fcntl.h.def
deleted file mode 100644
index 4f608845ce1ed..0000000000000
--- a/libc/include/fcntl.h.def
+++ /dev/null
@@ -1,17 +0,0 @@
-//===-- C standard library header fcntl.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_FCNTL_H
-#define LLVM_LIBC_FCNTL_H
-
-#include "__llvm-libc-common.h"
-#include "llvm-libc-macros/fcntl-macros.h"
-
-%%public_api()
-
-#endif // LLVM_LIBC_FCNTL_H

diff  --git a/libc/include/fcntl.yaml b/libc/include/fcntl.yaml
index 78f93533b84d3..4ccf0d1761cc5 100644
--- a/libc/include/fcntl.yaml
+++ b/libc/include/fcntl.yaml
@@ -1,6 +1,15 @@
 header: fcntl.h
-header_template: fcntl.h.def
-macros: []
+standards:
+  - posix
+macros:
+  - macro_name: AT_FDCWD
+    macro_header: fcntl-macros.h
+  - macro_name: AT_REMOVEDIR
+    macro_header: fcntl-macros.h
+  - macro_name: AT_SYMLINK_NOFOLLOW
+    macro_header: fcntl-macros.h
+  - macro_name: AT_EACCESS
+    macro_header: fcntl-macros.h
 types:
   - type_name: off_t
   - type_name: mode_t

diff  --git a/libc/include/inttypes.h.def b/libc/include/inttypes.h.def
deleted file mode 100644
index 5879d2d8e0410..0000000000000
--- a/libc/include/inttypes.h.def
+++ /dev/null
@@ -1,18 +0,0 @@
-//===-- C standard library header inttypes.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_INTTYPES_H
-#define LLVM_LIBC_INTTYPES_H
-
-#include "__llvm-libc-common.h"
-#include "llvm-libc-macros/inttypes-macros.h"
-#include <stdint.h>
-
-%%public_api()
-
-#endif // LLVM_LIBC_INTTYPES_H

diff  --git a/libc/include/inttypes.yaml b/libc/include/inttypes.yaml
index d5dec5b465ba4..9cfca386a9af4 100644
--- a/libc/include/inttypes.yaml
+++ b/libc/include/inttypes.yaml
@@ -1,6 +1,316 @@
 header: inttypes.h
-header_template: inttypes.h.def
-macros: []
+standards:
+  - stdc
+macros:
+  - macro_name: PRId8
+    macro_header: inttypes-macros.h
+  - macro_name: PRId16
+    macro_header: inttypes-macros.h
+  - macro_name: PRId32
+    macro_header: inttypes-macros.h
+  - macro_name: PRId64
+    macro_header: inttypes-macros.h
+  - macro_name: PRIdLEAST8
+    macro_header: inttypes-macros.h
+  - macro_name: PRIdLEAST16
+    macro_header: inttypes-macros.h
+  - macro_name: PRIdLEAST32
+    macro_header: inttypes-macros.h
+  - macro_name: PRIdLEAST64
+    macro_header: inttypes-macros.h
+  - macro_name: PRIdFAST8
+    macro_header: inttypes-macros.h
+  - macro_name: PRIdFAST16
+    macro_header: inttypes-macros.h
+  - macro_name: PRIdFAST32
+    macro_header: inttypes-macros.h
+  - macro_name: PRIdFAST64
+    macro_header: inttypes-macros.h
+  - macro_name: PRIdMAX
+    macro_header: inttypes-macros.h
+  - macro_name: PRIdPTR
+    macro_header: inttypes-macros.h
+  - macro_name: PRIi8
+    macro_header: inttypes-macros.h
+  - macro_name: PRIi16
+    macro_header: inttypes-macros.h
+  - macro_name: PRIi32
+    macro_header: inttypes-macros.h
+  - macro_name: PRIi64
+    macro_header: inttypes-macros.h
+  - macro_name: PRIiLEAST8
+    macro_header: inttypes-macros.h
+  - macro_name: PRIiLEAST16
+    macro_header: inttypes-macros.h
+  - macro_name: PRIiLEAST32
+    macro_header: inttypes-macros.h
+  - macro_name: PRIiLEAST64
+    macro_header: inttypes-macros.h
+  - macro_name: PRIiFAST8
+    macro_header: inttypes-macros.h
+  - macro_name: PRIiFAST16
+    macro_header: inttypes-macros.h
+  - macro_name: PRIiFAST32
+    macro_header: inttypes-macros.h
+  - macro_name: PRIiFAST64
+    macro_header: inttypes-macros.h
+  - macro_name: PRIiMAX
+    macro_header: inttypes-macros.h
+  - macro_name: PRIiPTR
+    macro_header: inttypes-macros.h
+  - macro_name: PRIo8
+    macro_header: inttypes-macros.h
+  - macro_name: PRIo16
+    macro_header: inttypes-macros.h
+  - macro_name: PRIo32
+    macro_header: inttypes-macros.h
+  - macro_name: PRIo64
+    macro_header: inttypes-macros.h
+  - macro_name: PRIoLEAST8
+    macro_header: inttypes-macros.h
+  - macro_name: PRIoLEAST16
+    macro_header: inttypes-macros.h
+  - macro_name: PRIoLEAST32
+    macro_header: inttypes-macros.h
+  - macro_name: PRIoLEAST64
+    macro_header: inttypes-macros.h
+  - macro_name: PRIoFAST8
+    macro_header: inttypes-macros.h
+  - macro_name: PRIoFAST16
+    macro_header: inttypes-macros.h
+  - macro_name: PRIoFAST32
+    macro_header: inttypes-macros.h
+  - macro_name: PRIoFAST64
+    macro_header: inttypes-macros.h
+  - macro_name: PRIoMAX
+    macro_header: inttypes-macros.h
+  - macro_name: PRIoPTR
+    macro_header: inttypes-macros.h
+  - macro_name: PRIu8
+    macro_header: inttypes-macros.h
+  - macro_name: PRIu16
+    macro_header: inttypes-macros.h
+  - macro_name: PRIu32
+    macro_header: inttypes-macros.h
+  - macro_name: PRIu64
+    macro_header: inttypes-macros.h
+  - macro_name: PRIuLEAST8
+    macro_header: inttypes-macros.h
+  - macro_name: PRIuLEAST16
+    macro_header: inttypes-macros.h
+  - macro_name: PRIuLEAST32
+    macro_header: inttypes-macros.h
+  - macro_name: PRIuLEAST64
+    macro_header: inttypes-macros.h
+  - macro_name: PRIuFAST8
+    macro_header: inttypes-macros.h
+  - macro_name: PRIuFAST16
+    macro_header: inttypes-macros.h
+  - macro_name: PRIuFAST32
+    macro_header: inttypes-macros.h
+  - macro_name: PRIuFAST64
+    macro_header: inttypes-macros.h
+  - macro_name: PRIuMAX
+    macro_header: inttypes-macros.h
+    macro_header: inttypes-macros.h
+  - macro_name: PRIuPTR
+    macro_header: inttypes-macros.h
+  - macro_name: PRIx8
+    macro_header: inttypes-macros.h
+  - macro_name: PRIx16
+    macro_header: inttypes-macros.h
+  - macro_name: PRIx32
+    macro_header: inttypes-macros.h
+  - macro_name: PRIx64
+    macro_header: inttypes-macros.h
+  - macro_name: PRIxLEAST8
+    macro_header: inttypes-macros.h
+  - macro_name: PRIxLEAST16
+    macro_header: inttypes-macros.h
+  - macro_name: PRIxLEAST32
+    macro_header: inttypes-macros.h
+  - macro_name: PRIxLEAST64
+    macro_header: inttypes-macros.h
+  - macro_name: PRIxFAST8
+    macro_header: inttypes-macros.h
+  - macro_name: PRIxFAST16
+    macro_header: inttypes-macros.h
+  - macro_name: PRIxFAST32
+    macro_header: inttypes-macros.h
+  - macro_name: PRIxFAST64
+    macro_header: inttypes-macros.h
+  - macro_name: PRIxMAX
+    macro_header: inttypes-macros.h
+  - macro_name: PRIxPTR
+    macro_header: inttypes-macros.h
+  - macro_name: PRIX8
+    macro_header: inttypes-macros.h
+  - macro_name: PRIX16
+    macro_header: inttypes-macros.h
+  - macro_name: PRIX32
+    macro_header: inttypes-macros.h
+  - macro_name: PRIX64
+    macro_header: inttypes-macros.h
+  - macro_name: PRIXLEAST8
+    macro_header: inttypes-macros.h
+  - macro_name: PRIXLEAST16
+    macro_header: inttypes-macros.h
+  - macro_name: PRIXLEAST32
+    macro_header: inttypes-macros.h
+  - macro_name: PRIXLEAST64
+    macro_header: inttypes-macros.h
+  - macro_name: PRIXFAST8
+    macro_header: inttypes-macros.h
+  - macro_name: PRIXFAST16
+    macro_header: inttypes-macros.h
+  - macro_name: PRIXFAST32
+    macro_header: inttypes-macros.h
+  - macro_name: PRIXFAST64
+    macro_header: inttypes-macros.h
+  - macro_name: PRIXMAX
+    macro_header: inttypes-macros.h
+  - macro_name: PRIXPTR
+    macro_header: inttypes-macros.h
+  - macro_name: SCNd8
+    macro_header: inttypes-macros.h
+  - macro_name: SCNd16
+    macro_header: inttypes-macros.h
+  - macro_name: SCNd32
+    macro_header: inttypes-macros.h
+  - macro_name: SCNd64
+    macro_header: inttypes-macros.h
+  - macro_name: SCNdLEAST8
+    macro_header: inttypes-macros.h
+  - macro_name: SCNdLEAST16
+    macro_header: inttypes-macros.h
+  - macro_name: SCNdLEAST32
+    macro_header: inttypes-macros.h
+  - macro_name: SCNdLEAST64
+    macro_header: inttypes-macros.h
+  - macro_name: SCNdFAST8
+    macro_header: inttypes-macros.h
+  - macro_name: SCNdFAST16
+    macro_header: inttypes-macros.h
+  - macro_name: SCNdFAST32
+    macro_header: inttypes-macros.h
+  - macro_name: SCNdFAST64
+    macro_header: inttypes-macros.h
+  - macro_name: SCNdMAX
+    macro_header: inttypes-macros.h
+  - macro_name: SCNdPTR
+    macro_header: inttypes-macros.h
+  - macro_name: SCNi8
+    macro_header: inttypes-macros.h
+  - macro_name: SCNi16
+    macro_header: inttypes-macros.h
+  - macro_name: SCNi32
+    macro_header: inttypes-macros.h
+  - macro_name: SCNi64
+    macro_header: inttypes-macros.h
+  - macro_name: SCNiLEAST8
+    macro_header: inttypes-macros.h
+  - macro_name: SCNiLEAST16
+    macro_header: inttypes-macros.h
+  - macro_name: SCNiLEAST32
+    macro_header: inttypes-macros.h
+  - macro_name: SCNiLEAST64
+    macro_header: inttypes-macros.h
+  - macro_name: SCNiFAST8
+    macro_header: inttypes-macros.h
+  - macro_name: SCNiFAST16
+    macro_header: inttypes-macros.h
+  - macro_name: SCNiFAST32
+    macro_header: inttypes-macros.h
+  - macro_name: SCNiFAST64
+    macro_header: inttypes-macros.h
+  - macro_name: SCNiMAX
+    macro_header: inttypes-macros.h
+  - macro_name: SCNiPTR
+    macro_header: inttypes-macros.h
+  - macro_name: SCNo8
+    macro_header: inttypes-macros.h
+  - macro_name: SCNo16
+    macro_header: inttypes-macros.h
+  - macro_name: SCNo32
+    macro_header: inttypes-macros.h
+  - macro_name: SCNo64
+    macro_header: inttypes-macros.h
+  - macro_name: SCNoLEAST8
+    macro_header: inttypes-macros.h
+  - macro_name: SCNoLEAST16
+    macro_header: inttypes-macros.h
+  - macro_name: SCNoLEAST32
+    macro_header: inttypes-macros.h
+  - macro_name: SCNoLEAST64
+    macro_header: inttypes-macros.h
+  - macro_name: SCNoFAST8
+    macro_header: inttypes-macros.h
+  - macro_name: SCNoFAST16
+    macro_header: inttypes-macros.h
+  - macro_name: SCNoFAST32
+    macro_header: inttypes-macros.h
+  - macro_name: SCNoFAST64
+    macro_header: inttypes-macros.h
+  - macro_name: SCNoMAX
+    macro_header: inttypes-macros.h
+  - macro_name: SCNoPTR
+    macro_header: inttypes-macros.h
+  - macro_name: SCNu8
+    macro_header: inttypes-macros.h
+  - macro_name: SCNu16
+    macro_header: inttypes-macros.h
+  - macro_name: SCNu32
+    macro_header: inttypes-macros.h
+  - macro_name: SCNu64
+    macro_header: inttypes-macros.h
+  - macro_name: SCNuLEAST8
+    macro_header: inttypes-macros.h
+  - macro_name: SCNuLEAST16
+    macro_header: inttypes-macros.h
+  - macro_name: SCNuLEAST32
+    macro_header: inttypes-macros.h
+  - macro_name: SCNuLEAST64
+    macro_header: inttypes-macros.h
+  - macro_name: SCNuFAST8
+    macro_header: inttypes-macros.h
+  - macro_name: SCNuFAST16
+    macro_header: inttypes-macros.h
+  - macro_name: SCNuFAST32
+    macro_header: inttypes-macros.h
+  - macro_name: SCNuFAST64
+    macro_header: inttypes-macros.h
+  - macro_name: SCNuMAX
+    macro_header: inttypes-macros.h
+  - macro_name: SCNuPTR
+    macro_header: inttypes-macros.h
+  - macro_name: SCNx8
+    macro_header: inttypes-macros.h
+  - macro_name: SCNx16
+    macro_header: inttypes-macros.h
+  - macro_name: SCNx32
+    macro_header: inttypes-macros.h
+  - macro_name: SCNx64
+    macro_header: inttypes-macros.h
+  - macro_name: SCNxLEAST8
+    macro_header: inttypes-macros.h
+  - macro_name: SCNxLEAST16
+    macro_header: inttypes-macros.h
+  - macro_name: SCNxLEAST32
+    macro_header: inttypes-macros.h
+  - macro_name: SCNxLEAST64
+    macro_header: inttypes-macros.h
+  - macro_name: SCNxFAST8
+    macro_header: inttypes-macros.h
+  - macro_name: SCNxFAST16
+    macro_header: inttypes-macros.h
+  - macro_name: SCNxFAST32
+    macro_header: inttypes-macros.h
+  - macro_name: SCNxFAST64
+    macro_header: inttypes-macros.h
+  - macro_name: SCNxMAX
+    macro_header: inttypes-macros.h
+  - macro_name: SCNxPTR
+    macro_header: inttypes-macros.h
 types:
   - type_name: imaxdiv_t
 enums: []

diff  --git a/libc/include/llvm-libc-types/imaxdiv_t.h b/libc/include/llvm-libc-types/imaxdiv_t.h
index 5062b643065a7..bbfdfd3375095 100644
--- a/libc/include/llvm-libc-types/imaxdiv_t.h
+++ b/libc/include/llvm-libc-types/imaxdiv_t.h
@@ -9,6 +9,8 @@
 #ifndef __LLVM_LIBC_TYPES_IMAXDIV_T_H__
 #define __LLVM_LIBC_TYPES_IMAXDIV_T_H__
 
+#include <stdint.h>
+
 typedef struct {
   intmax_t quot;
   intmax_t rem;

diff  --git a/libc/include/netinet/in.h.def b/libc/include/netinet/in.h.def
deleted file mode 100644
index d9a6a6ebe375d..0000000000000
--- a/libc/include/netinet/in.h.def
+++ /dev/null
@@ -1,18 +0,0 @@
-//===-- C standard library header in.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_NETINET_IN_H
-#define LLVM_LIBC_NETINET_IN_H
-
-#include "__llvm-libc-common.h"
-
-#include "../llvm-libc-macros/netinet-in-macros.h"
-
-%%public_api()
-
-#endif // LLVM_LIBC_NETINET_IN_H

diff  --git a/libc/include/netinet/in.yaml b/libc/include/netinet/in.yaml
index fbd798d60cbf9..e7b33dc87334f 100644
--- a/libc/include/netinet/in.yaml
+++ b/libc/include/netinet/in.yaml
@@ -1,6 +1,19 @@
 header: netinet/in.h
-header_template: in.h.def
-macros: []
+standards:
+  - posix
+macros:
+  - macro_name: IPPROTO_IP
+    macro_header: netinet-in-macros.h
+  - macro_name: IPPROTO_ICMP
+    macro_header: netinet-in-macros.h
+  - macro_name: IPPROTO_TCP
+    macro_header: netinet-in-macros.h
+  - macro_name: IPPROTO_UDP
+    macro_header: netinet-in-macros.h
+  - macro_name: IPPROTO_IPV6
+    macro_header: netinet-in-macros.h
+  - macro_name: IPPROTO_RAW
+    macro_header: netinet-in-macros.h
 types: []
 enums: []
 objects: []

diff  --git a/libc/include/poll.h.def b/libc/include/poll.h.def
deleted file mode 100644
index 2f0e0376fa7bb..0000000000000
--- a/libc/include/poll.h.def
+++ /dev/null
@@ -1,17 +0,0 @@
-//===-- C standard library header poll.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_POLL_H
-#define LLVM_LIBC_POLL_H
-
-#include "__llvm-libc-common.h"
-#include "llvm-libc-macros/poll-macros.h"
-
-%%public_api()
-
-#endif // LLVM_LIBC_POLL_H

diff  --git a/libc/include/poll.yaml b/libc/include/poll.yaml
index 399cc91854cdf..bb7d99e87aa07 100644
--- a/libc/include/poll.yaml
+++ b/libc/include/poll.yaml
@@ -1,6 +1,27 @@
 header: poll.h
-header_template: poll.h.def
-macros: []
+standards:
+  - posix
+macros:
+  - macro_name: POLLIN
+    macro_header: poll-macros.h
+  - macro_name: POLLPRI
+    macro_header: poll-macros.h
+  - macro_name: POLLOUT
+    macro_header: poll-macros.h
+  - macro_name: POLLERR
+    macro_header: poll-macros.h
+  - macro_name: POLLHUP
+    macro_header: poll-macros.h
+  - macro_name: POLLNVAL
+    macro_header: poll-macros.h
+  - macro_name: POLLRDNORM
+    macro_header: poll-macros.h
+  - macro_name: POLLRDBAND
+    macro_header: poll-macros.h
+  - macro_name: POLLWRNORM
+    macro_header: poll-macros.h
+  - macro_name: POLLWRBAND
+    macro_header: poll-macros.h
 types:
   - type_name: struct_pollfd
   - type_name: nfds_t

diff  --git a/libc/include/sched.h.def b/libc/include/sched.h.def
deleted file mode 100644
index 493028e8dcc47..0000000000000
--- a/libc/include/sched.h.def
+++ /dev/null
@@ -1,17 +0,0 @@
-//===-- C standard library header sched.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_SCHED_H
-#define LLVM_LIBC_SCHED_H
-
-#include "__llvm-libc-common.h"
-#include "llvm-libc-macros/sched-macros.h"
-
-%%public_api()
-
-#endif // LLVM_LIBC_SCHED_H

diff  --git a/libc/include/sched.yaml b/libc/include/sched.yaml
index 8014aa7ed61fc..b75dee3000449 100644
--- a/libc/include/sched.yaml
+++ b/libc/include/sched.yaml
@@ -1,6 +1,13 @@
 header: sched.h
-header_template: sched.h.def
-macros: []
+standards:
+  - posix
+macros:
+  - macro_name: SCHED_OTHER
+    macro_header: sched-macros.h
+  - macro_name: SCHED_FIFO
+    macro_header: sched-macros.h
+  - macro_name: SCHED_RR
+    macro_header: sched-macros.h
 types:
   - type_name: struct_timespec
   - type_name: time_t

diff  --git a/libc/include/signal.h.def b/libc/include/signal.h.def
deleted file mode 100644
index 50a5f44c7337a..0000000000000
--- a/libc/include/signal.h.def
+++ /dev/null
@@ -1,21 +0,0 @@
-//===-- C standard library header signal.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_SIGNAL_H
-#define LLVM_LIBC_SIGNAL_H
-
-#include "__llvm-libc-common.h"
-
-#define __need_size_t
-#include <stddef.h>
-
-#include "llvm-libc-macros/signal-macros.h"
-
-%%public_api()
-
-#endif // LLVM_LIBC_SIGNAL_H

diff  --git a/libc/include/signal.yaml b/libc/include/signal.yaml
index 6fdd8c97ccbe2..5d14082b59ddb 100644
--- a/libc/include/signal.yaml
+++ b/libc/include/signal.yaml
@@ -1,6 +1,25 @@
 header: signal.h
-header_template: signal.h.def
-macros: []
+standards:
+  - stdc
+macros:
+  - macro_name: SIGABRT
+    macro_header: signal-macros.h
+  - macro_name: SIGFPE
+    macro_header: signal-macros.h
+  - macro_name: SIGILL
+    macro_header: signal-macros.h
+  - macro_name: SIGINT
+    macro_header: signal-macros.h    
+  - macro_name: SIGSEGV
+    macro_header: signal-macros.h
+  - macro_name: SIGTERM
+    macro_header: signal-macros.h
+  - macro_name: SIG_ERR
+    macro_header: signal-macros.h
+  - macro_name: SIG_DFL
+    macro_header: signal-macros.h
+  - macro_name: SIG_IGN
+    macro_header: signal-macros.h
 types:
   - type_name: pid_t
   - type_name: sig_atomic_t

diff  --git a/libc/include/stdio.h.def b/libc/include/stdio.h.def
deleted file mode 100644
index 78d800c83b514..0000000000000
--- a/libc/include/stdio.h.def
+++ /dev/null
@@ -1,20 +0,0 @@
-//===-- C standard library header stdio.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_STDIO_H
-#define LLVM_LIBC_STDIO_H
-
-#include "__llvm-libc-common.h"
-#include "llvm-libc-macros/file-seek-macros.h"
-#include "llvm-libc-macros/stdio-macros.h"
-
-#include <stdarg.h>
-
-%%public_api()
-
-#endif // LLVM_LIBC_STDIO_H

diff  --git a/libc/include/stdio.yaml b/libc/include/stdio.yaml
index cf8675f73495a..edb915085722a 100644
--- a/libc/include/stdio.yaml
+++ b/libc/include/stdio.yaml
@@ -1,5 +1,6 @@
 header: stdio.h
-header_template: stdio.h.def
+standards:
+  - stdc
 macros:
   - macro_name: "NULL"
     macro_header: null-macro.h
@@ -9,6 +10,22 @@ macros:
     macro_value: stdin
   - macro_name: stderr
     macro_value: stderr
+  - macro_name: SEEK_SET
+    macro_header: file-seek-macros.h
+  - macro_name: SEEK_CUR
+    macro_header: file-seek-macros.h
+  - macro_name: SEEK_END
+    macro_header: file-seek-macros.h
+  - macro_name: EOF
+    macro_header: stdio-macros.h
+  - macro_name: BUFSIZ
+    macro_header: stdio-macros.h
+  - macro_name: _IONBF
+    macro_header: stdio-macros.h
+  - macro_name: _IOLBF
+    macro_header: stdio-macros.h
+  - macro_name: _IOFBF
+    macro_header: stdio-macros.h
 types:
   - type_name: rsize_t
   - type_name: size_t

diff  --git a/libc/include/stdlib.h.def b/libc/include/stdlib.h.def
deleted file mode 100644
index d523f7a53024a..0000000000000
--- a/libc/include/stdlib.h.def
+++ /dev/null
@@ -1,17 +0,0 @@
-//===-- C standard library header stdlib.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_STDLIB_H
-#define LLVM_LIBC_STDLIB_H
-
-#include "__llvm-libc-common.h"
-#include "llvm-libc-macros/stdlib-macros.h"
-
-%%public_api()
-
-#endif // LLVM_LIBC_STDLIB_H

diff  --git a/libc/include/stdlib.yaml b/libc/include/stdlib.yaml
index 4ab1f36906b14..a751f8306be24 100644
--- a/libc/include/stdlib.yaml
+++ b/libc/include/stdlib.yaml
@@ -1,5 +1,4 @@
 header: stdlib.h
-header_template: stdlib.h.def
 standards:
   - stdc
 merge_yaml_files:
@@ -7,6 +6,10 @@ merge_yaml_files:
 macros:
   - macro_name: "NULL"
     macro_header: null-macro.h
+  - macro_name: EXIT_SUCCESS
+    macro_header: stdlib-macros.h
+  - macro_name: EXIT_FAILURE
+    macro_header: stdlib-macros.h
 types:
   - type_name: __atexithandler_t
   - type_name: __qsortcompare_t

diff  --git a/libc/include/sysexits.h.def b/libc/include/sysexits.h.def
deleted file mode 100644
index 58e65a62f4903..0000000000000
--- a/libc/include/sysexits.h.def
+++ /dev/null
@@ -1,17 +0,0 @@
-//===-- POSIX header sysexits.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_SYSEXITS_H
-#define LLVM_LIBC_SYSEXITS_H
-
-#include "__llvm-libc-common.h"
-#include "llvm-libc-macros/sysexits-macros.h"
-
-%%public_api()
-
-#endif // LLVM_LIBC_SYSEXITS_H
-

diff  --git a/libc/include/sysexits.yaml b/libc/include/sysexits.yaml
index 753d99205ec29..7383d10f733ee 100644
--- a/libc/include/sysexits.yaml
+++ b/libc/include/sysexits.yaml
@@ -1,9 +1,10 @@
 header: sysexits.h
-header_template: sysexits.h.def
 standards:
-  - BSDExtensions
-  - GNUExtensions
-macros: []
+  - bsd
+  - gnu
+macros:
+  - macro_name: EX_OK
+    macro_header: sysexits-macros.h
 types: []
 enums: []
 objects: []

diff  --git a/libc/include/termios.h.def b/libc/include/termios.h.def
deleted file mode 100644
index 7538944c0985e..0000000000000
--- a/libc/include/termios.h.def
+++ /dev/null
@@ -1,17 +0,0 @@
-//===-- C standard library header termios.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_TERMIOS_H
-#define LLVM_LIBC_TERMIOS_H
-
-#include "__llvm-libc-common.h"
-#include "llvm-libc-macros/termios-macros.h"
-
-%%public_api()
-
-#endif // LLVM_LIBC_TERMIOS_H

diff  --git a/libc/include/termios.yaml b/libc/include/termios.yaml
index 8815097264f95..05f441969d9cc 100644
--- a/libc/include/termios.yaml
+++ b/libc/include/termios.yaml
@@ -1,6 +1,9 @@
 header: termios.h
-header_template: termios.h.def
-macros: []
+standards:
+  - posix
+macros:
+  - macro_name: NCCS
+    macro_header: termios-macros.h
 types:
   - type_name: tcflag_t
   - type_name: struct_termios

diff  --git a/libc/include/unistd.h.def b/libc/include/unistd.h.def
deleted file mode 100644
index 6b9137e14623c..0000000000000
--- a/libc/include/unistd.h.def
+++ /dev/null
@@ -1,18 +0,0 @@
-//===-- C standard library header unistd.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_UNISTD_H
-#define LLVM_LIBC_UNISTD_H
-
-#include "__llvm-libc-common.h"
-#include "llvm-libc-macros/file-seek-macros.h"
-#include "llvm-libc-macros/unistd-macros.h"
-
-%%public_api()
-
-#endif // LLVM_LIBC_UNISTD_H

diff  --git a/libc/include/unistd.yaml b/libc/include/unistd.yaml
index e6eac614ffe4b..5966ab9199890 100644
--- a/libc/include/unistd.yaml
+++ b/libc/include/unistd.yaml
@@ -1,6 +1,19 @@
 header: unistd.h
-header_template: unistd.h.def
-macros: []
+standards:
+  - posix
+macros:
+  - macro_name: SEEK_SET
+    macro_header: file-seek-macros.h
+  - macro_name: SEEK_CUR
+    macro_header: file-seek-macros.h
+  - macro_name: SEEK_END
+    macro_header: file-seek-macros.h
+  - macro_name: STDIN_FILENO
+    macro_header: unistd-macros.h
+  - macro_name: STDOUT_FILENO
+    macro_header: unistd-macros.h
+  - macro_name: STDERR_FILENO
+    macro_header: unistd-macros.h
 types:
   - type_name: uid_t
   - type_name: gid_t

diff  --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 204138dc73e30..692f4ebbca32b 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -112,34 +112,14 @@ py_binary(
 )
 
 LLVM_LIBC_HEADERS = [
-    libc_header_info(
-        "arpa/inet",
-        has_def_template = True,
-    ),
     libc_header_info(
         "assert",
         has_def_template = True,
     ),
-    libc_header_info(
-        "complex",
-        has_def_template = True,
-    ),
-    libc_header_info(
-        "elf",
-        has_def_template = True,
-    ),
     libc_header_info(
         "errno",
         has_def_template = True,
     ),
-    libc_header_info(
-        "fcntl",
-        has_def_template = True,
-    ),
-    libc_header_info(
-        "inttypes",
-        has_def_template = True,
-    ),
     libc_header_info(
         "link",
         has_def_template = True,
@@ -148,22 +128,6 @@ LLVM_LIBC_HEADERS = [
         "math",
         has_def_template = True,
     ),
-    libc_header_info(
-        "netinet/in",
-        has_def_template = True,
-    ),
-    libc_header_info(
-        "poll",
-        has_def_template = True,
-    ),
-    libc_header_info(
-        "sched",
-        has_def_template = True,
-    ),
-    libc_header_info(
-        "signal",
-        has_def_template = True,
-    ),
     libc_header_info(
         "stdbit",
         has_def_template = True,
@@ -172,14 +136,6 @@ LLVM_LIBC_HEADERS = [
         "stdfix",
         has_def_template = True,
     ),
-    libc_header_info(
-        "stdio",
-        has_def_template = True,
-    ),
-    libc_header_info(
-        "sysexits",
-        has_def_template = True,
-    ),
     libc_header_info(
         "sys/prctl",
         has_def_template = True,
@@ -188,30 +144,32 @@ LLVM_LIBC_HEADERS = [
         "sys/syscall",
         has_def_template = True,
     ),
-    libc_header_info(
-        "termios",
-        has_def_template = True,
-    ),
-    libc_header_info(
-        "unistd",
-        has_def_template = True,
-    ),
+    libc_header_info("arpa/inet"),
+    libc_header_info("complex"),
     libc_header_info("ctype"),
     libc_header_info("dirent"),
     libc_header_info("dlfcn"),
+    libc_header_info("elf"),
     libc_header_info("endian"),
+    libc_header_info("fcntl"),
     libc_header_info("features"),
     libc_header_info("fenv"),
     libc_header_info("float"),
+    libc_header_info("inttypes"),
     libc_header_info("limits"),
     libc_header_info("locale"),
+    libc_header_info("netinet/in"),
     libc_header_info("nl_types"),
+    libc_header_info("poll"),
     libc_header_info("pthread"),
+    libc_header_info("sched"),
     libc_header_info("search"),
     libc_header_info("setjmp"),
+    libc_header_info("signal"),
     libc_header_info("spawn"),
     libc_header_info("stdckdint"),
     libc_header_info("stdint"),
+    libc_header_info("stdio"),
     libc_header_info("string"),
     libc_header_info("strings"),
     libc_header_info("sys/auxv"),
@@ -229,14 +187,16 @@ LLVM_LIBC_HEADERS = [
     libc_header_info("sys/types"),
     libc_header_info("sys/utsname"),
     libc_header_info("sys/wait"),
+    libc_header_info("sysexits"),
+    libc_header_info("termios"),
     libc_header_info("threads"),
     libc_header_info("time"),
     libc_header_info("uchar"),
+    libc_header_info("unistd"),
     libc_header_info("wchar"),
     libc_header_info("wctype"),
     libc_header_info(
         "stdlib",
-        has_def_template = True,
         other_srcs = ["include/stdlib-malloc.yaml"],
     ),
     libc_header_info(


        


More information about the libc-commits mailing list