xref: /aosp_15_r20/external/clang/test/Headers/ms-null-ms-header-vs-stddef.cpp (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -fsyntax-only -triple i686-pc-win32 -fms-compatibility -fms-compatibility-version=17.00 %s
2*67e74705SXin Li // RUN: %clang_cc1 -fsyntax-only -triple i386-mingw32 %s
3*67e74705SXin Li 
4*67e74705SXin Li // Something in MSVC's headers (pulled in e.g. by <crtdefs.h>) defines __null
5*67e74705SXin Li // to something, mimick that.
6*67e74705SXin Li #define __null
7*67e74705SXin Li 
8*67e74705SXin Li #include <stddef.h>
9*67e74705SXin Li 
10*67e74705SXin Li // __null is used as a type annotation in MS headers, with __null defined to
11*67e74705SXin Li // nothing in regular builds. This should continue to work even with stddef.h
12*67e74705SXin Li // included.
f(__null void * p)13*67e74705SXin Li void f(__null void* p) { }
14*67e74705SXin Li 
15*67e74705SXin Li // NULL should work fine even with __null defined to nothing.
16*67e74705SXin Li void* p = NULL;
17