On Sat, 13 Jun 2026, LIU Hao wrote:
> Hello,
> 
> Attached are patches which change the base types of `u?int_fast16_t` to
> `unsigned? int`, to match how these are declared in Microsoft UCRT headers.
> 
> These changes are small but are technically an ABI break. A consequent
> change may be needed in Clang. Your perspective will be appreciated.

As it is ABI breaking change, it requires handling.
mingw/mingw-stdint.h is used by ix86 and aarch64.
aarch64-w64-mingw32 is not stabilized yet, and it will require recompilation
after some contributions anyway.
However, it should be handled for ix86.

Here is an idea how it can be done.

mingw/mingw-stdint.h might be changed as it was proposed.

mingw-w64-headers/crt/stdint.h

 #define __need_wchar_t
 #include <stddef.h>
 
+#if !defined (MINGW_ABI_VERSION)
+#if __GNUC__ <= 16
+#define MINGW_ABI_VERSION 1
+#else
+#define MINGW_ABI_VERSION 2
+#endif
+#endif
+
 /* 7.18.1.1  Exact-width integer types */
 typedef signed char int8_t;
 typedef unsigned char   uint8_t;
@@ -57,13 +65,19 @@ __MINGW_EXTENSION typedef unsigned long long   
uint_least64_t;
  */
 typedef signed char int_fast8_t;
 typedef unsigned char uint_fast8_t;
-typedef short  int_fast16_t;
-typedef unsigned short  uint_fast16_t;
 typedef int  int_fast32_t;
 typedef unsigned  int  uint_fast32_t;
 __MINGW_EXTENSION typedef long long  int_fast64_t;
 __MINGW_EXTENSION typedef unsigned long long   uint_fast64_t;
 
+#if MINGW_ABI_VERSION == 1
+typedef short  int_fast16_t;
+typedef unsigned short  uint_fast16_t;
+#else
+typedef int  int_fast16_t;
+typedef unsigned int  uint_fast16_t;
+#endif
+
 /* 7.18.1.5  Greatest-width integer types */
 __MINGW_EXTENSION typedef long long  intmax_t;
 __MINGW_EXTENSION typedef unsigned long long   uintmax_t;

Starting from GCC 17, a new MinGW ABI will be used. And if some code should be 
compatible
with previous ABI version, MINGW_ABI_VERSION 1 should be defined.

Regards,
Evgeny

Reply via email to