1*bed243d3SAndroid Build Coastguard Worker /*===---- __stddef_null.h - Definition of NULL -----------------------------=== 2*bed243d3SAndroid Build Coastguard Worker * 3*bed243d3SAndroid Build Coastguard Worker * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*bed243d3SAndroid Build Coastguard Worker * See https://llvm.org/LICENSE.txt for license information. 5*bed243d3SAndroid Build Coastguard Worker * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*bed243d3SAndroid Build Coastguard Worker * 7*bed243d3SAndroid Build Coastguard Worker *===-----------------------------------------------------------------------=== 8*bed243d3SAndroid Build Coastguard Worker */ 9*bed243d3SAndroid Build Coastguard Worker 10*bed243d3SAndroid Build Coastguard Worker #if !defined(NULL) || !__building_module(_Builtin_stddef) 11*bed243d3SAndroid Build Coastguard Worker 12*bed243d3SAndroid Build Coastguard Worker /* linux/stddef.h will define NULL to 0. glibc (and other) headers then define 13*bed243d3SAndroid Build Coastguard Worker * __need_NULL and rely on stddef.h to redefine NULL to the correct value again. 14*bed243d3SAndroid Build Coastguard Worker * Modules don't support redefining macros like that, but support that pattern 15*bed243d3SAndroid Build Coastguard Worker * in the non-modules case. 16*bed243d3SAndroid Build Coastguard Worker */ 17*bed243d3SAndroid Build Coastguard Worker #undef NULL 18*bed243d3SAndroid Build Coastguard Worker 19*bed243d3SAndroid Build Coastguard Worker #ifdef __cplusplus 20*bed243d3SAndroid Build Coastguard Worker #if !defined(__MINGW32__) && !defined(_MSC_VER) 21*bed243d3SAndroid Build Coastguard Worker #define NULL __null 22*bed243d3SAndroid Build Coastguard Worker #else 23*bed243d3SAndroid Build Coastguard Worker #define NULL 0 24*bed243d3SAndroid Build Coastguard Worker #endif 25*bed243d3SAndroid Build Coastguard Worker #else 26*bed243d3SAndroid Build Coastguard Worker #define NULL ((void*)0) 27*bed243d3SAndroid Build Coastguard Worker #endif 28*bed243d3SAndroid Build Coastguard Worker 29*bed243d3SAndroid Build Coastguard Worker #endif 30