headers: crt: move _STATIC_ASSERT to corecrt.h Deduplicate and follow UCRT headers. Signed-off-by: Zhongteng Gui <dragon-archer@outlook.com> Signed-off-by: LIU Hao <lh_mouse@126.com>
diff --git a/mingw-w64-headers/crt/corecrt.h b/mingw-w64-headers/crt/corecrt.h index 257108d..2dd360f 100644 --- a/mingw-w64-headers/crt/corecrt.h +++ b/mingw-w64-headers/crt/corecrt.h
@@ -174,6 +174,20 @@ #define _WConst_return _CONST_RETURN +#ifndef _STATIC_ASSERT +#if (defined(__cpp_static_assert) && __cpp_static_assert >= 201411L) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) +#define _STATIC_ASSERT(expr) static_assert(expr) +#elif defined(__cpp_static_assert) +#define _STATIC_ASSERT(expr) static_assert(expr, #expr) +#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +#define _STATIC_ASSERT(expr) _Static_assert(expr, #expr) +#elif defined(_MSC_VER) +#define _STATIC_ASSERT(expr) typedef char __static_assert_t[(expr)] +#else +#define _STATIC_ASSERT(expr) extern void __static_assert_t(int [(expr)?1:-1]) +#endif +#endif + #if defined(__LIBMSVCRT__) /* When building mingw-w64, this should be blank. */ #define _SECIMP
diff --git a/mingw-w64-headers/crt/crtdbg.h b/mingw-w64-headers/crt/crtdbg.h index 019441e..1e9136e 100644 --- a/mingw-w64-headers/crt/crtdbg.h +++ b/mingw-w64-headers/crt/crtdbg.h
@@ -90,20 +90,6 @@ size_t lTotalCount; } _CrtMemState; -#ifndef _STATIC_ASSERT -#if (defined(__cpp_static_assert) && __cpp_static_assert >= 201411L) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) -#define _STATIC_ASSERT(expr) static_assert(expr) -#elif defined(__cpp_static_assert) -#define _STATIC_ASSERT(expr) static_assert(expr, #expr) -#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L -#define _STATIC_ASSERT(expr) _Static_assert(expr, #expr) -#elif defined(_MSC_VER) -#define _STATIC_ASSERT(expr) typedef char __static_assert_t[(expr)] -#else -#define _STATIC_ASSERT(expr) extern void __static_assert_t(int [(expr)?1:-1]) -#endif -#endif - #ifndef _DEBUG #ifndef _ASSERT
diff --git a/mingw-w64-headers/crt/malloc.h b/mingw-w64-headers/crt/malloc.h index c26036b..64edc3d 100644 --- a/mingw-w64-headers/crt/malloc.h +++ b/mingw-w64-headers/crt/malloc.h
@@ -16,20 +16,6 @@ #define _HEAP_MAXREQ 0xFFFFFFE0 #endif -#ifndef _STATIC_ASSERT -#if (defined(__cpp_static_assert) && __cpp_static_assert >= 201411L) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) -#define _STATIC_ASSERT(expr) static_assert(expr) -#elif defined(__cpp_static_assert) -#define _STATIC_ASSERT(expr) static_assert(expr, #expr) -#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L -#define _STATIC_ASSERT(expr) _Static_assert(expr, #expr) -#elif defined(_MSC_VER) -#define _STATIC_ASSERT(expr) typedef char __static_assert_t[(expr)] -#else -#define _STATIC_ASSERT(expr) extern void __static_assert_t(int [(expr)?1:-1]) -#endif -#endif - /* Return codes for _heapwalk() */ #define _HEAPEMPTY (-1) #define _HEAPOK (-2)