This series of patches attempt to remove some non-reserved identifiers from 
_mingw.h.

`MINGW_HAS_SECURE_API` is a leftover from 3bef7c2206bb6f9552ea7e61315c4bf7af3aa6c9. There was a reference in [1] where they used to provide their own `*_s` functions. This piece of code has been removed.

No reference to `MINGW_HAS_DDK` exists in the wild. There's a known user of DDK [2], but they don't check for this macro.

`MINGW_SDK_INIT` protects these macros from being defined more than once. There was a referece in LuaJIT [3] because the second parameter of `RtlUnwindEx()` was incorrectly declared as an integer. The declaration was fixed in 952dce438458357a3b39d13c808a2f0122841017, and LuaJIT can be built with or without this macro.


[1] (Japanese) https://github.com/berryzplus/sakura-editor/commit/726fcd897a6de3d3feddb066e311b630c9a99e83#diff-1fb2ba11e6b0c80e9f486db18aa360a1136873a31b6d2071a6c022343b489e6bL219
[2] https://github.com/utoni/mingw-w64-dpp/
[3] 
https://github.com/LuaJIT/LuaJIT/commit/c63a1607068a7698c8d26bde84a0f3ca0a5cfd03


--
Best regards,
LIU Hao



From fee47c2048071225c41b0de595c2d3a350a44ffd Mon Sep 17 00:00:00 2001
From: LIU Hao <[email protected]>
Date: Mon, 9 Feb 2026 17:00:37 +0800
Subject: [PATCH 1/4] headers/_mingw: Use reserved identifiers in inline
 functions

Signed-off-by: LIU Hao <[email protected]>
---
 mingw-w64-headers/crt/_mingw.h.in | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/mingw-w64-headers/crt/_mingw.h.in 
b/mingw-w64-headers/crt/_mingw.h.in
index 5d759e2b5..b1d2ee2f1 100644
--- a/mingw-w64-headers/crt/_mingw.h.in
+++ b/mingw-w64-headers/crt/_mingw.h.in
@@ -622,17 +622,17 @@ __MINGW_INTRIN_INLINE void __cdecl __debugbreak(void)
 #define __MINGW_FASTFAIL_IMPL 1
 #endif
 #if __MINGW_FASTFAIL_IMPL == 1
-void __cdecl __MINGW_ATTRIB_NORETURN __fastfail(unsigned int code);
-__MINGW_INTRIN_INLINE void __cdecl __MINGW_ATTRIB_NORETURN __fastfail(unsigned 
int code)
+void __cdecl __MINGW_ATTRIB_NORETURN __fastfail(unsigned int _Code);
+__MINGW_INTRIN_INLINE void __cdecl __MINGW_ATTRIB_NORETURN __fastfail(unsigned 
int _Code)
 {
 #if defined(__aarch64__) || defined(__arm64ec__)
-  register unsigned int w0 __asm__("w0") = code;
-  __asm__ __volatile__("brk #0xf003"::"r"(w0));
+  register unsigned int __w0 __asm__("w0") = _Code;
+  __asm__ __volatile__("brk #0xf003"::"r"(__w0));
 #elif defined(__i386__) || defined(__x86_64__)
-  __asm__ __volatile__("int {$}0x29"::"c"(code));
+  __asm__ __volatile__("int {$}0x29"::"c"(_Code));
 #elif defined(__arm__)
-  register unsigned int r0 __asm__("r0") = code;
-  __asm__ __volatile__("udf #0xfb"::"r"(r0));
+  register unsigned int __r0 __asm__("r0") = _Code;
+  __asm__ __volatile__("udf #0xfb"::"r"(__r0));
 #else
   __asm__ __volatile__("unimplemented");
 #endif
@@ -647,13 +647,13 @@ __MINGW_INTRIN_INLINE void __cdecl 
__MINGW_ATTRIB_NORETURN __fastfail(unsigned i
 #endif
 #if __MINGW_PREFETCH_IMPL == 1
 #if defined(__arm__) || defined(__aarch64__) || defined(__arm64ec__)
-void __cdecl __prefetch(const void *addr);
-__MINGW_INTRIN_INLINE void __cdecl __prefetch(const void *addr)
+void __cdecl __prefetch(const void *_Addr);
+__MINGW_INTRIN_INLINE void __cdecl __prefetch(const void *_Addr)
 {
 #if defined(__arm__)
-  __asm__ __volatile__("pld [%0]"::"r"(addr));
+  __asm__ __volatile__("pld [%0]"::"r"(_Addr));
 #elif defined(__aarch64__) || defined(__arm64ec__)
-  __asm__ __volatile__("prfm pldl1keep, [%0]"::"r"(addr));
+  __asm__ __volatile__("prfm pldl1keep, [%0]"::"r"(_Addr));
 #endif
 }
 #endif /* defined(__arm__) || defined(__aarch64__) */
--
2.53.0



From 2dbc67afe55674278e57eb054936ba11b3c5d776 Mon Sep 17 00:00:00 2001
From: LIU Hao <[email protected]>
Date: Mon, 9 Feb 2026 17:01:11 +0800
Subject: [PATCH 2/4] headers/_mingw: Undefine `MINGW_HAS_SECURE_API`

Since 3bef7c2206bb6f9552ea7e61315c4bf7af3aa6c9, secure APIs are always provided
and there's no need to check for this macro.

Signed-off-by: LIU Hao <[email protected]>
---
 mingw-w64-headers/crt/_mingw.h.in | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/mingw-w64-headers/crt/_mingw.h.in 
b/mingw-w64-headers/crt/_mingw.h.in
index b1d2ee2f1..4aa92f4a7 100644
--- a/mingw-w64-headers/crt/_mingw.h.in
+++ b/mingw-w64-headers/crt/_mingw.h.in
@@ -673,11 +673,6 @@ const char *__mingw_get_crt_info (void);
 #ifndef MINGW_SDK_INIT
 #define MINGW_SDK_INIT

-/* for backward compatibility */
-#ifndef MINGW_HAS_SECURE_API
-#define MINGW_HAS_SECURE_API 1
-#endif
-
 #define __STDC_SECURE_LIB__ 200411L
 #define __GOT_SECURE_LIB__ __STDC_SECURE_LIB__

--
2.53.0




From e6c91db58dc595697e7d1efed48fbfa9be9f37f9 Mon Sep 17 00:00:00 2001
From: LIU Hao <[email protected]>
Date: Mon, 9 Feb 2026 17:06:28 +0800
Subject: [PATCH 3/4] headers/_mingw,ddk: Undefine `MINGW_HAS_DDK_H`

No code is known to check for this macro.

Signed-off-by: LIU Hao <[email protected]>
---
 mingw-w64-headers/configure.ac    | 6 +-----
 mingw-w64-headers/crt/_mingw.h.in | 4 ----
 mingw-w64-headers/ddk/readme.txt  | 3 ---
 3 files changed, 1 insertion(+), 12 deletions(-)

diff --git a/mingw-w64-headers/configure.ac b/mingw-w64-headers/configure.ac
index 186e98992..f88024045 100644
--- a/mingw-w64-headers/configure.ac
+++ b/mingw-w64-headers/configure.ac
@@ -109,12 +109,8 @@ AC_MSG_RESULT([$enable_sdk])

 AS_VAR_IF([enable_ddk],[yes],[
     DDKHEAD_LIST=$srcdir/ddk/include/ddk/*.h
-    MINGW_HAS_DDK=1
-  ],[
-    MINGW_HAS_DDK=0
-  ])
+  ],[])
 AC_SUBST([DDKHEAD_LIST])
-AC_SUBST([MINGW_HAS_DDK])

 AC_MSG_CHECKING([if installing idl files is enabled])
 AC_ARG_ENABLE([idl],
diff --git a/mingw-w64-headers/crt/_mingw.h.in 
b/mingw-w64-headers/crt/_mingw.h.in
index 4aa92f4a7..3e0d544d9 100644
--- a/mingw-w64-headers/crt/_mingw.h.in
+++ b/mingw-w64-headers/crt/_mingw.h.in
@@ -676,8 +676,4 @@ const char *__mingw_get_crt_info (void);
 #define __STDC_SECURE_LIB__ 200411L
 #define __GOT_SECURE_LIB__ __STDC_SECURE_LIB__

-#if @MINGW_HAS_DDK@
-#define MINGW_HAS_DDK_H 1
-#endif
-
 #endif /* MINGW_SDK_INIT */
diff --git a/mingw-w64-headers/ddk/readme.txt b/mingw-w64-headers/ddk/readme.txt
index 9dea9eec6..3c7bd82fb 100644
--- a/mingw-w64-headers/ddk/readme.txt
+++ b/mingw-w64-headers/ddk/readme.txt
@@ -1,9 +1,6 @@
 DDK sdk for x86 and x64 platforms.
 ----------------------------------

-You can check for existance of this optional package by verifying
-the definition of the macro MINGW_HAS_DDK_H.
-
 The DDK headers are from the ReactOS project, from their svn repo
 svn://svn.reactos.org/reactos/trunk/reactos/include/ddk/

--
2.53.0




From 217f6fe8c65b4e002f6a733d6dcaee8d907efede Mon Sep 17 00:00:00 2001
From: LIU Hao <[email protected]>
Date: Mon, 9 Feb 2026 17:06:59 +0800
Subject: [PATCH 4/4] headers/_mingw: Undefine `MINGW_SDK_INIT`

Signed-off-by: LIU Hao <[email protected]>
---
 mingw-w64-headers/crt/_mingw.h.in | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/mingw-w64-headers/crt/_mingw.h.in 
b/mingw-w64-headers/crt/_mingw.h.in
index 3e0d544d9..b5e547a94 100644
--- a/mingw-w64-headers/crt/_mingw.h.in
+++ b/mingw-w64-headers/crt/_mingw.h.in
@@ -668,12 +668,7 @@ const char *__mingw_get_crt_info (void);
 }
 #endif

-#endif /* _INC__MINGW_H */
-
-#ifndef MINGW_SDK_INIT
-#define MINGW_SDK_INIT
-
 #define __STDC_SECURE_LIB__ 200411L
 #define __GOT_SECURE_LIB__ __STDC_SECURE_LIB__

-#endif /* MINGW_SDK_INIT */
+#endif /* _INC__MINGW_H */
--
2.53.0






From fee47c2048071225c41b0de595c2d3a350a44ffd Mon Sep 17 00:00:00 2001
From: LIU Hao <[email protected]>
Date: Mon, 9 Feb 2026 17:00:37 +0800
Subject: [PATCH 1/4] headers/_mingw: Use reserved identifiers in inline
 functions

Signed-off-by: LIU Hao <[email protected]>
---
 mingw-w64-headers/crt/_mingw.h.in | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/mingw-w64-headers/crt/_mingw.h.in 
b/mingw-w64-headers/crt/_mingw.h.in
index 5d759e2b5..b1d2ee2f1 100644
--- a/mingw-w64-headers/crt/_mingw.h.in
+++ b/mingw-w64-headers/crt/_mingw.h.in
@@ -622,17 +622,17 @@ __MINGW_INTRIN_INLINE void __cdecl __debugbreak(void)
 #define __MINGW_FASTFAIL_IMPL 1
 #endif
 #if __MINGW_FASTFAIL_IMPL == 1
-void __cdecl __MINGW_ATTRIB_NORETURN __fastfail(unsigned int code);
-__MINGW_INTRIN_INLINE void __cdecl __MINGW_ATTRIB_NORETURN __fastfail(unsigned 
int code)
+void __cdecl __MINGW_ATTRIB_NORETURN __fastfail(unsigned int _Code);
+__MINGW_INTRIN_INLINE void __cdecl __MINGW_ATTRIB_NORETURN __fastfail(unsigned 
int _Code)
 {
 #if defined(__aarch64__) || defined(__arm64ec__)
-  register unsigned int w0 __asm__("w0") = code;
-  __asm__ __volatile__("brk #0xf003"::"r"(w0));
+  register unsigned int __w0 __asm__("w0") = _Code;
+  __asm__ __volatile__("brk #0xf003"::"r"(__w0));
 #elif defined(__i386__) || defined(__x86_64__)
-  __asm__ __volatile__("int {$}0x29"::"c"(code));
+  __asm__ __volatile__("int {$}0x29"::"c"(_Code));
 #elif defined(__arm__)
-  register unsigned int r0 __asm__("r0") = code;
-  __asm__ __volatile__("udf #0xfb"::"r"(r0));
+  register unsigned int __r0 __asm__("r0") = _Code;
+  __asm__ __volatile__("udf #0xfb"::"r"(__r0));
 #else
   __asm__ __volatile__("unimplemented");
 #endif
@@ -647,13 +647,13 @@ __MINGW_INTRIN_INLINE void __cdecl 
__MINGW_ATTRIB_NORETURN __fastfail(unsigned i
 #endif
 #if __MINGW_PREFETCH_IMPL == 1
 #if defined(__arm__) || defined(__aarch64__) || defined(__arm64ec__)
-void __cdecl __prefetch(const void *addr);
-__MINGW_INTRIN_INLINE void __cdecl __prefetch(const void *addr)
+void __cdecl __prefetch(const void *_Addr);
+__MINGW_INTRIN_INLINE void __cdecl __prefetch(const void *_Addr)
 {
 #if defined(__arm__)
-  __asm__ __volatile__("pld [%0]"::"r"(addr));
+  __asm__ __volatile__("pld [%0]"::"r"(_Addr));
 #elif defined(__aarch64__) || defined(__arm64ec__)
-  __asm__ __volatile__("prfm pldl1keep, [%0]"::"r"(addr));
+  __asm__ __volatile__("prfm pldl1keep, [%0]"::"r"(_Addr));
 #endif
 }
 #endif /* defined(__arm__) || defined(__aarch64__) */
-- 
2.53.0

From 2dbc67afe55674278e57eb054936ba11b3c5d776 Mon Sep 17 00:00:00 2001
From: LIU Hao <[email protected]>
Date: Mon, 9 Feb 2026 17:01:11 +0800
Subject: [PATCH 2/4] headers/_mingw: Undefine `MINGW_HAS_SECURE_API`

Since 3bef7c2206bb6f9552ea7e61315c4bf7af3aa6c9, secure APIs are always provided
and there's no need to check for this macro.

Signed-off-by: LIU Hao <[email protected]>
---
 mingw-w64-headers/crt/_mingw.h.in | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/mingw-w64-headers/crt/_mingw.h.in 
b/mingw-w64-headers/crt/_mingw.h.in
index b1d2ee2f1..4aa92f4a7 100644
--- a/mingw-w64-headers/crt/_mingw.h.in
+++ b/mingw-w64-headers/crt/_mingw.h.in
@@ -673,11 +673,6 @@ const char *__mingw_get_crt_info (void);
 #ifndef MINGW_SDK_INIT
 #define MINGW_SDK_INIT
 
-/* for backward compatibility */
-#ifndef MINGW_HAS_SECURE_API
-#define MINGW_HAS_SECURE_API 1
-#endif
-
 #define __STDC_SECURE_LIB__ 200411L
 #define __GOT_SECURE_LIB__ __STDC_SECURE_LIB__
 
-- 
2.53.0

From e6c91db58dc595697e7d1efed48fbfa9be9f37f9 Mon Sep 17 00:00:00 2001
From: LIU Hao <[email protected]>
Date: Mon, 9 Feb 2026 17:06:28 +0800
Subject: [PATCH 3/4] headers/_mingw,ddk: Undefine `MINGW_HAS_DDK_H`

No code is known to check for this macro.

Signed-off-by: LIU Hao <[email protected]>
---
 mingw-w64-headers/configure.ac    | 6 +-----
 mingw-w64-headers/crt/_mingw.h.in | 4 ----
 mingw-w64-headers/ddk/readme.txt  | 3 ---
 3 files changed, 1 insertion(+), 12 deletions(-)

diff --git a/mingw-w64-headers/configure.ac b/mingw-w64-headers/configure.ac
index 186e98992..f88024045 100644
--- a/mingw-w64-headers/configure.ac
+++ b/mingw-w64-headers/configure.ac
@@ -109,12 +109,8 @@ AC_MSG_RESULT([$enable_sdk])
 
 AS_VAR_IF([enable_ddk],[yes],[
     DDKHEAD_LIST=$srcdir/ddk/include/ddk/*.h
-    MINGW_HAS_DDK=1
-  ],[
-    MINGW_HAS_DDK=0
-  ])
+  ],[])
 AC_SUBST([DDKHEAD_LIST])
-AC_SUBST([MINGW_HAS_DDK])
 
 AC_MSG_CHECKING([if installing idl files is enabled])
 AC_ARG_ENABLE([idl],
diff --git a/mingw-w64-headers/crt/_mingw.h.in 
b/mingw-w64-headers/crt/_mingw.h.in
index 4aa92f4a7..3e0d544d9 100644
--- a/mingw-w64-headers/crt/_mingw.h.in
+++ b/mingw-w64-headers/crt/_mingw.h.in
@@ -676,8 +676,4 @@ const char *__mingw_get_crt_info (void);
 #define __STDC_SECURE_LIB__ 200411L
 #define __GOT_SECURE_LIB__ __STDC_SECURE_LIB__
 
-#if @MINGW_HAS_DDK@
-#define MINGW_HAS_DDK_H 1
-#endif
-
 #endif /* MINGW_SDK_INIT */
diff --git a/mingw-w64-headers/ddk/readme.txt b/mingw-w64-headers/ddk/readme.txt
index 9dea9eec6..3c7bd82fb 100644
--- a/mingw-w64-headers/ddk/readme.txt
+++ b/mingw-w64-headers/ddk/readme.txt
@@ -1,9 +1,6 @@
 DDK sdk for x86 and x64 platforms.
 ----------------------------------
 
-You can check for existance of this optional package by verifying
-the definition of the macro MINGW_HAS_DDK_H.
-
 The DDK headers are from the ReactOS project, from their svn repo
 svn://svn.reactos.org/reactos/trunk/reactos/include/ddk/
 
-- 
2.53.0

From 217f6fe8c65b4e002f6a733d6dcaee8d907efede Mon Sep 17 00:00:00 2001
From: LIU Hao <[email protected]>
Date: Mon, 9 Feb 2026 17:06:59 +0800
Subject: [PATCH 4/4] headers/_mingw: Undefine `MINGW_SDK_INIT`

Signed-off-by: LIU Hao <[email protected]>
---
 mingw-w64-headers/crt/_mingw.h.in | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/mingw-w64-headers/crt/_mingw.h.in 
b/mingw-w64-headers/crt/_mingw.h.in
index 3e0d544d9..b5e547a94 100644
--- a/mingw-w64-headers/crt/_mingw.h.in
+++ b/mingw-w64-headers/crt/_mingw.h.in
@@ -668,12 +668,7 @@ const char *__mingw_get_crt_info (void);
 }
 #endif
 
-#endif /* _INC__MINGW_H */
-
-#ifndef MINGW_SDK_INIT
-#define MINGW_SDK_INIT
-
 #define __STDC_SECURE_LIB__ 200411L
 #define __GOT_SECURE_LIB__ __STDC_SECURE_LIB__
 
-#endif /* MINGW_SDK_INIT */
+#endif /* _INC__MINGW_H */
-- 
2.53.0

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

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

Reply via email to