[libc] Remove header templates from several C standard headers. (#188878)

Switches the following headers to hdrgen-produced ones by referencing
some macro from C standard and the file containing the declarations in
corresponding YAML files:

* limits.h (referenced _WIDTH / _MAX / _MIN families).
* locale.h (referenced LC_ family).
* time.h (referenced CLOCKS_PER_SEC).
* wchar.h (referenced WEOF).
This commit is contained in:
Alexey Samsonov 2026-03-27 10:55:37 -07:00 committed by GitHub
parent 80b304d14b
commit ead9ac8331
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 101 additions and 87 deletions

View File

@ -1,14 +0,0 @@
//===-- C standard library header limits.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_LIMITS_H
#define LLVM_LIBC_LIMITS_H
#include "llvm-libc-macros/limits-macros.h"
#endif // LLVM_LIBC_LIMITS_H

View File

@ -1,8 +1,79 @@
header: limits.h
header_template: limits.h.def
standards:
- stdc
macros: []
macros:
- macro_name: CHAR_BIT
macro_header: limits-macros.h
- macro_name: MB_LEN_MAX
macro_header: limits-macros.h
- macro_name: CHAR_WIDTH
macro_header: limits-macros.h
- macro_name: SCHAR_WIDTH
macro_header: limits-macros.h
- macro_name: UCHAR_WIDTH
macro_header: limits-macros.h
- macro_name: SHRT_WIDTH
macro_header: limits-macros.h
- macro_name: USHRT_WIDTH
macro_header: limits-macros.h
- macro_name: INT_WIDTH
macro_header: limits-macros.h
- macro_name: UINT_WIDTH
macro_header: limits-macros.h
- macro_name: LONG_WIDTH
macro_header: limits-macros.h
- macro_name: ULONG_WIDTH
macro_header: limits-macros.h
- macro_name: LLONG_WIDTH
macro_header: limits-macros.h
- macro_name: ULLONG_WIDTH
macro_header: limits-macros.h
- macro_name: BOOL_WIDTH
macro_header: limits-macros.h
- macro_name: SCHAR_MAX
macro_header: limits-macros.h
- macro_name: UCHAR_MAX
macro_header: limits-macros.h
- macro_name: CHAR_MAX
macro_header: limits-macros.h
- macro_name: SHRT_MAX
macro_header: limits-macros.h
- macro_name: USHRT_MAX
macro_header: limits-macros.h
- macro_name: INT_MAX
macro_header: limits-macros.h
- macro_name: UINT_MAX
macro_header: limits-macros.h
- macro_name: LONG_MAX
macro_header: limits-macros.h
- macro_name: ULONG_MAX
macro_header: limits-macros.h
- macro_name: LLONG_MAX
macro_header: limits-macros.h
- macro_name: ULLONG_MAX
macro_header: limits-macros.h
- macro_name: SCHAR_MIN
macro_header: limits-macros.h
- macro_name: UCHAR_MIN
macro_header: limits-macros.h
- macro_name: CHAR_MIN
macro_header: limits-macros.h
- macro_name: SHRT_MIN
macro_header: limits-macros.h
- macro_name: USHRT_MIN
macro_header: limits-macros.h
- macro_name: INT_MIN
macro_header: limits-macros.h
- macro_name: UINT_MIN
macro_header: limits-macros.h
- macro_name: LONG_MIN
macro_header: limits-macros.h
- macro_name: ULONG_MIN
macro_header: limits-macros.h
- macro_name: LLONG_MIN
macro_header: limits-macros.h
- macro_name: ULLONG_MIN
macro_header: limits-macros.h
types: []
enums: []
objects: []

View File

@ -1,18 +0,0 @@
//===-- C standard library header locale.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_LOCALE_H
#define LLVM_LIBC_LOCALE_H
#include "__llvm-libc-common.h"
#include "llvm-libc-macros/locale-macros.h"
%%public_api()
#endif // LLVM_LIBC_LOCALE_H

View File

@ -1,8 +1,23 @@
header: locale.h
header_template: locale.h.def
standards:
- stdc
macros:
- macro_name: "NULL"
macro_header: null-macro.h
- macro_name: LC_ALL
macro_header: locale-macros.h
- macro_name: LC_COLLATE
macro_header: locale-macros.h
- macro_name: LC_CTYPE
macro_header: locale-macros.h
- macro_name: LC_MESSAGES
macro_header: locale-macros.h
- macro_name: LC_MONETARY
macro_header: locale-macros.h
- macro_name: LC_NUMERIC
macro_header: locale-macros.h
- macro_name: LC_TIME
macro_header: locale-macros.h
types:
- type_name: locale_t
- type_name: struct_lconv

View File

@ -1,17 +0,0 @@
//===-- C standard library header time.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_TIME_H
#define LLVM_LIBC_TIME_H
#include "__llvm-libc-common.h"
#include "llvm-libc-macros/time-macros.h"
%%public_api()
#endif // LLVM_LIBC_TIME_H

View File

@ -1,8 +1,11 @@
header: time.h
header_template: time.h.def
standards:
- stdc
macros:
- macro_name: "NULL"
macro_header: null-macro.h
- macro_name: CLOCKS_PER_SEC
macro_header: time-macros.h
types:
- type_name: struct_timeval
- type_name: clockid_t

View File

@ -1,17 +0,0 @@
//===-- C standard library header wchar.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_WCHAR_H
#define LLVM_LIBC_WCHAR_H
#include "__llvm-libc-common.h"
#include "llvm-libc-macros/wchar-macros.h"
%%public_api()
#endif // LLVM_LIBC_WCHAR_H

View File

@ -1,8 +1,11 @@
header: wchar.h
header_template: wchar.h.def
standards:
- stdc
macros:
- macro_name: "NULL"
macro_header: null-macro.h
- macro_name: WEOF
macro_header: wchar-macros.h
types:
- type_name: FILE
- type_name: rsize_t

View File

@ -152,18 +152,10 @@ LLVM_LIBC_HEADERS = [
"inttypes",
has_def_template = True,
),
libc_header_info(
"limits",
has_def_template = True,
),
libc_header_info(
"link",
has_def_template = True,
),
libc_header_info(
"locale",
has_def_template = True,
),
libc_header_info(
"math",
has_def_template = True,
@ -268,22 +260,16 @@ LLVM_LIBC_HEADERS = [
"termios",
has_def_template = True,
),
libc_header_info(
"time",
has_def_template = True,
),
libc_header_info(
"unistd",
has_def_template = True,
),
libc_header_info(
"wchar",
has_def_template = True,
),
libc_header_info("ctype"),
libc_header_info("dirent"),
libc_header_info("dlfcn"),
libc_header_info("fenv"),
libc_header_info("limits"),
libc_header_info("locale"),
libc_header_info("nl_types"),
libc_header_info("pthread"),
libc_header_info("search"),
@ -295,7 +281,9 @@ LLVM_LIBC_HEADERS = [
libc_header_info("sys/statvfs"),
libc_header_info("sys/utsname"),
libc_header_info("threads"),
libc_header_info("time"),
libc_header_info("uchar"),
libc_header_info("wchar"),
libc_header_info("wctype"),
libc_header_info(
"stdlib",