diff --git a/libc/config/gpu/api.td b/libc/config/gpu/api.td --- a/libc/config/gpu/api.td +++ b/libc/config/gpu/api.td @@ -2,17 +2,6 @@ include "spec/stdc.td" -def NullMacro : MacroDef<"NULL"> { - let Defn = [{ - #define __need_NULL - #include - }]; -} - def StringAPI : PublicAPI<"string.h"> { let Types = ["size_t"]; - - let Macros = [ - NullMacro, - ]; } diff --git a/libc/config/linux/api.td b/libc/config/linux/api.td --- a/libc/config/linux/api.td +++ b/libc/config/linux/api.td @@ -36,13 +36,6 @@ }]; } -def NullMacro : MacroDef<"NULL"> { - let Defn = [{ - #define __need_NULL - #include - }]; -} - def AssertAPI : PublicAPI<"assert.h"> { let Macros = [ AssertMacro, @@ -134,10 +127,6 @@ def StringAPI : PublicAPI<"string.h"> { let Types = ["size_t"]; - - let Macros = [ - NullMacro, - ]; } def StdIOAPI : PublicAPI<"stdio.h"> { diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt --- a/libc/include/CMakeLists.txt +++ b/libc/include/CMakeLists.txt @@ -91,6 +91,7 @@ GEN_HDR string.h DEPENDS .llvm_libc_common_h + .llvm-libc-macros.null_macro .llvm-libc-types.size_t ) diff --git a/libc/include/llvm-libc-macros/CMakeLists.txt b/libc/include/llvm-libc-macros/CMakeLists.txt --- a/libc/include/llvm-libc-macros/CMakeLists.txt +++ b/libc/include/llvm-libc-macros/CMakeLists.txt @@ -6,6 +6,12 @@ generic-error-number-macros.h ) +add_header( + null_macro + HDR + null-macro.h +) + add_header( fcntl_macros HDR diff --git a/libc/include/string.h.def b/libc/include/llvm-libc-macros/null-macro.h copy from libc/include/string.h.def copy to libc/include/llvm-libc-macros/null-macro.h --- a/libc/include/string.h.def +++ b/libc/include/llvm-libc-macros/null-macro.h @@ -1,4 +1,4 @@ -//===-- C standard library header string.h --------------------------------===// +//===-- Definition of the NULL macro --------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,11 +6,10 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_STRING_H -#define LLVM_LIBC_STRING_H +#ifndef __LLVM_LIBC_MACROS_NULL_MACRO_H +#define __LLVM_LIBC_MACROS_NULL_MACRO_H -#include <__llvm-libc-common.h> +#define __need_NULL +#include -%%public_api() - -#endif // LLVM_LIBC_STRING_H +#endif // __LLVM_LIBC_MACROS_NULL_MACRO_H diff --git a/libc/include/string.h.def b/libc/include/string.h.def --- a/libc/include/string.h.def +++ b/libc/include/string.h.def @@ -11,6 +11,8 @@ #include <__llvm-libc-common.h> +#include + %%public_api() #endif // LLVM_LIBC_STRING_H