Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions libc/include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
)
Expand Down
3 changes: 3 additions & 0 deletions libc/include/locale.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions libc/include/stdio.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 3 additions & 1 deletion libc/include/stdlib.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions libc/include/string.h.def
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

#include "__llvm-libc-common.h"

#include "llvm-libc-macros/null-macro.h"

%%public_api()

#endif // LLVM_LIBC_STRING_H
4 changes: 3 additions & 1 deletion libc/include/string.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 3 additions & 1 deletion libc/include/time.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 3 additions & 1 deletion libc/include/wchar.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading