Misc updates to stddef.h to improve resiliency

This commit is contained in:
mintsuki 2023-04-25 21:36:04 +02:00
parent 7d5edad571
commit c60b8d7068

View File

@ -23,20 +23,19 @@ typedef decltype(nullptr) nullptr_t;
#ifndef __FSTD_HDRS_STDDEF_H_MACROS #ifndef __FSTD_HDRS_STDDEF_H_MACROS
#define __FSTD_HDRS_STDDEF_H_MACROS 1 #define __FSTD_HDRS_STDDEF_H_MACROS 1
#ifdef NULL
#undef NULL #undef NULL
#endif
#ifndef __cplusplus #ifndef __cplusplus
# define NULL ((void *)0) # define NULL ((void *)0)
#else #else
# define NULL 0 # define NULL 0
#endif #endif
#undef offsetof
#define offsetof(s, m) __builtin_offsetof(s, m) #define offsetof(s, m) __builtin_offsetof(s, m)
/* XXX fix to use proper __STDC_VERSION__ number later on */ /* XXX fix to use proper __STDC_VERSION__ number later on */
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 202000L) #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 202000L)
# undef unreachable
# define unreachable() __builtin_unreachable() # define unreachable() __builtin_unreachable()
#endif #endif