[libc] Add NULL macro definitions to header files (#142764)

By the C standard, <locale.h>, <stddef.h> <stdio.h>, <stdlib.h>,
<string.h>, <time.h>, and <wchar.h> require NULL to be defined.
This commit is contained in:
William
2025-06-11 17:51:34 +01:00
committed by GitHub
parent aa8a1fa6f5
commit 117e78fe50
8 changed files with 22 additions and 6 deletions

View File

@@ -255,6 +255,7 @@ add_header_macro(
time.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.null_macro
.llvm-libc-macros.time_macros
.llvm-libc-types.clock_t
.llvm-libc-types.time_t
@@ -329,6 +330,7 @@ add_header_macro(
stdio.h
DEPENDS
.llvm-libc-macros.file_seek_macros
.llvm-libc-macros.null_macro
.llvm-libc-macros.stdio_macros
.llvm-libc-types.FILE
.llvm-libc-types.cookie_io_functions_t
@@ -343,6 +345,7 @@ add_header_macro(
../libc/include/stdlib.yaml
stdlib.h
DEPENDS
.llvm-libc-macros.null_macro
.llvm-libc-macros.stdlib_macros
.llvm-libc-types.__atexithandler_t
.llvm-libc-types.__qsortcompare_t
@@ -709,6 +712,7 @@ add_header_macro(
wchar.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.null_macro
.llvm-libc-macros.wchar_macros
.llvm-libc-types.mbstate_t
.llvm-libc-types.size_t
@@ -723,6 +727,7 @@ add_header_macro(
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.locale_macros
.llvm-libc-macros.null_macro
.llvm-libc-types.locale_t
.llvm-libc-types.struct_lconv
)

View File

@@ -1,5 +1,8 @@
header: locale.h
header_template: locale.h.def
macros:
- macro_name: NULL
macro_header: null-macro.h
types:
- type_name: locale_t
- type_name: struct_lconv

View File

@@ -1,6 +1,8 @@
header: stdio.h
header_template: stdio.h.def
macros:
- macro_name: NULL
macro_header: null-macro.h
- macro_name: stdout
macro_value: stdout
- macro_name: stdin

View File

@@ -4,7 +4,9 @@ standards:
- stdc
merge_yaml_files:
- stdlib-malloc.yaml
macros: []
macros:
- macro_name: NULL
macro_header: null-macro.h
types:
- type_name: __atexithandler_t
- type_name: __qsortcompare_t

View File

@@ -11,8 +11,6 @@
#include "__llvm-libc-common.h"
#include "llvm-libc-macros/null-macro.h"
%%public_api()
#endif // LLVM_LIBC_STRING_H

View File

@@ -1,6 +1,8 @@
header: string.h
header_template: string.h.def
macros: []
macros:
- macro_name: NULL
macro_header: null-macro.h
types:
- type_name: locale_t
- type_name: size_t

View File

@@ -1,6 +1,8 @@
header: time.h
header_template: time.h.def
macros: []
macros:
- macro_name: NULL
macro_header: null-macro.h
types:
- type_name: struct_timeval
- type_name: clockid_t

View File

@@ -1,6 +1,8 @@
header: wchar.h
header_template: wchar.h.def
macros: []
macros:
- macro_name: NULL
macro_header: null-macro.h
types:
- type_name: size_t
- type_name: wint_t