Deduplicate and follow UCRT headers.

Signed-off-by: Zhongteng Gui <[email protected]>
---
 mingw-w64-headers/crt/corecrt.h | 14 ++++++++++++++
 mingw-w64-headers/crt/crtdbg.h  | 14 --------------
 mingw-w64-headers/crt/malloc.h  | 14 --------------
 3 files changed, 14 insertions(+), 28 deletions(-)

diff --git a/mingw-w64-headers/crt/corecrt.h b/mingw-w64-headers/crt/corecrt.h
index 257108d4e..2dd360f61 100644
--- a/mingw-w64-headers/crt/corecrt.h
+++ b/mingw-w64-headers/crt/corecrt.h
@@ -174,6 +174,20 @@ typedef __time64_t time_t;
 
 #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 019441ea0..1e9136ead 100644
--- a/mingw-w64-headers/crt/crtdbg.h
+++ b/mingw-w64-headers/crt/crtdbg.h
@@ -90,20 +90,6 @@ _CRT_BEGIN_C_HEADER
     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 c26036b1b..64edc3d76 100644
--- a/mingw-w64-headers/crt/malloc.h
+++ b/mingw-w64-headers/crt/malloc.h
@@ -16,20 +16,6 @@ _CRT_BEGIN_C_HEADER
 #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)
-- 
2.55.0.windows.5



_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to