zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

__stddef_null.h (875B) - Raw


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