15f757f3fSDimitry Andric /*===---- __stddef_null.h - Definition of NULL -----------------------------=== 25f757f3fSDimitry Andric * 35f757f3fSDimitry Andric * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 45f757f3fSDimitry Andric * See https://llvm.org/LICENSE.txt for license information. 55f757f3fSDimitry Andric * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 65f757f3fSDimitry Andric * 75f757f3fSDimitry Andric *===-----------------------------------------------------------------------=== 85f757f3fSDimitry Andric */ 95f757f3fSDimitry Andric 10*439352acSDimitry Andric #if !defined(NULL) || !__building_module(_Builtin_stddef) 115f757f3fSDimitry Andric 125f757f3fSDimitry Andric /* linux/stddef.h will define NULL to 0. glibc (and other) headers then define 135f757f3fSDimitry Andric * __need_NULL and rely on stddef.h to redefine NULL to the correct value again. 145f757f3fSDimitry Andric * Modules don't support redefining macros like that, but support that pattern 155f757f3fSDimitry Andric * in the non-modules case. 165f757f3fSDimitry Andric */ 175f757f3fSDimitry Andric #undef NULL 185f757f3fSDimitry Andric 195f757f3fSDimitry Andric #ifdef __cplusplus 205f757f3fSDimitry Andric #if !defined(__MINGW32__) && !defined(_MSC_VER) 215f757f3fSDimitry Andric #define NULL __null 225f757f3fSDimitry Andric #else 235f757f3fSDimitry Andric #define NULL 0 245f757f3fSDimitry Andric #endif 255f757f3fSDimitry Andric #else 265f757f3fSDimitry Andric #define NULL ((void*)0) 275f757f3fSDimitry Andric #endif 285f757f3fSDimitry Andric 295f757f3fSDimitry Andric #endif 30