Skip to content

Commit 5b598da

Browse files
committed
[libc] Add NULL macro definitions to header files
By the C standard, <locale.h>, <stddef.h> <stdio.h>, <stdlib.h>, <string.h>, <time.h>, and <wchar.h> require NULL to be defined.
1 parent 4b2cb11 commit 5b598da

File tree

6 files changed

+10
-1
lines changed

6 files changed

+10
-1
lines changed

libc/include/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ add_header_macro(
255255
time.h
256256
DEPENDS
257257
.llvm_libc_common_h
258+
.llvm-libc-macros.null_macro
258259
.llvm-libc-macros.time_macros
259260
.llvm-libc-types.clock_t
260261
.llvm-libc-types.time_t
@@ -329,6 +330,7 @@ add_header_macro(
329330
stdio.h
330331
DEPENDS
331332
.llvm-libc-macros.file_seek_macros
333+
.llvm-libc-macros.null_macro
332334
.llvm-libc-macros.stdio_macros
333335
.llvm-libc-types.FILE
334336
.llvm-libc-types.cookie_io_functions_t
@@ -343,6 +345,7 @@ add_header_macro(
343345
../libc/include/stdlib.yaml
344346
stdlib.h
345347
DEPENDS
348+
.llvm-libc-macros.null_macro
346349
.llvm-libc-macros.stdlib_macros
347350
.llvm-libc-types.__atexithandler_t
348351
.llvm-libc-types.__qsortcompare_t
@@ -709,6 +712,7 @@ add_header_macro(
709712
wchar.h
710713
DEPENDS
711714
.llvm_libc_common_h
715+
.llvm-libc-macros.null_macro
712716
.llvm-libc-macros.wchar_macros
713717
.llvm-libc-types.mbstate_t
714718
.llvm-libc-types.size_t
@@ -723,6 +727,7 @@ add_header_macro(
723727
DEPENDS
724728
.llvm_libc_common_h
725729
.llvm-libc-macros.locale_macros
730+
.llvm-libc-macros.null_macro
726731
.llvm-libc-types.locale_t
727732
.llvm-libc-types.struct_lconv
728733
)

libc/include/locale.h.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
#define LLVM_LIBC_LOCALE_H
1111

1212
#include "__llvm-libc-common.h"
13-
1413
#include "llvm-libc-macros/locale-macros.h"
14+
#include "llvm-libc-macros/null-macro.h"
1515

1616
%%public_api()
1717

libc/include/stdio.h.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#include "__llvm-libc-common.h"
1313
#include "llvm-libc-macros/file-seek-macros.h"
14+
#include "llvm-libc-macros/null-macro.h"
1415
#include "llvm-libc-macros/stdio-macros.h"
1516

1617
#include <stdarg.h>

libc/include/stdlib.h.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#define LLVM_LIBC_STDLIB_H
1111

1212
#include "__llvm-libc-common.h"
13+
#include "llvm-libc-macros/null-macro.h"
1314
#include "llvm-libc-macros/stdlib-macros.h"
1415

1516
%%public_api()

libc/include/time.h.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#define LLVM_LIBC_TIME_H
1111

1212
#include "__llvm-libc-common.h"
13+
#include "llvm-libc-macros/null-macro.h"
1314
#include "llvm-libc-macros/time-macros.h"
1415

1516
%%public_api()

libc/include/wchar.h.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#define LLVM_LIBC_WCHAR_H
1111

1212
#include "__llvm-libc-common.h"
13+
#include "llvm-libc-macros/null-macro.h"
1314
#include "llvm-libc-macros/wchar-macros.h"
1415

1516
%%public_api()

0 commit comments

Comments
 (0)