You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(55) |
Oct
(59) |
Nov
(3) |
Dec
(30) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
(59) |
Feb
(22) |
Mar
(55) |
Apr
(4) |
May
(15) |
Jun
(29) |
Jul
(6) |
Aug
(17) |
Sep
|
Oct
(27) |
Nov
(8) |
Dec
(14) |
| 2009 |
Jan
(6) |
Feb
(26) |
Mar
(48) |
Apr
(11) |
May
(3) |
Jun
(20) |
Jul
(28) |
Aug
(48) |
Sep
(85) |
Oct
(34) |
Nov
(23) |
Dec
(65) |
| 2010 |
Jan
(68) |
Feb
(46) |
Mar
(105) |
Apr
(74) |
May
(185) |
Jun
(118) |
Jul
(179) |
Aug
(170) |
Sep
(513) |
Oct
(113) |
Nov
(41) |
Dec
(52) |
| 2011 |
Jan
(59) |
Feb
(102) |
Mar
(110) |
Apr
(197) |
May
(123) |
Jun
(91) |
Jul
(195) |
Aug
(209) |
Sep
(233) |
Oct
(112) |
Nov
(241) |
Dec
(86) |
| 2012 |
Jan
(138) |
Feb
(151) |
Mar
(326) |
Apr
(154) |
May
(278) |
Jun
(230) |
Jul
(311) |
Aug
(327) |
Sep
(194) |
Oct
(139) |
Nov
(243) |
Dec
(141) |
| 2013 |
Jan
(169) |
Feb
(90) |
Mar
(187) |
Apr
(228) |
May
(150) |
Jun
(328) |
Jul
(287) |
Aug
(199) |
Sep
(288) |
Oct
(199) |
Nov
(310) |
Dec
(214) |
| 2014 |
Jan
(166) |
Feb
(66) |
Mar
(90) |
Apr
(166) |
May
(166) |
Jun
(99) |
Jul
(120) |
Aug
(139) |
Sep
(107) |
Oct
(142) |
Nov
(171) |
Dec
(170) |
| 2015 |
Jan
(138) |
Feb
(100) |
Mar
(101) |
Apr
(83) |
May
(143) |
Jun
(148) |
Jul
(139) |
Aug
(174) |
Sep
(60) |
Oct
(52) |
Nov
(41) |
Dec
(59) |
| 2016 |
Jan
(40) |
Feb
(86) |
Mar
(121) |
Apr
(154) |
May
(78) |
Jun
(46) |
Jul
(71) |
Aug
(191) |
Sep
(96) |
Oct
(44) |
Nov
(85) |
Dec
(52) |
| 2017 |
Jan
(80) |
Feb
(65) |
Mar
(91) |
Apr
(66) |
May
(144) |
Jun
(115) |
Jul
(61) |
Aug
(301) |
Sep
(78) |
Oct
(96) |
Nov
(309) |
Dec
(59) |
| 2018 |
Jan
(99) |
Feb
(41) |
Mar
(88) |
Apr
(52) |
May
(62) |
Jun
(95) |
Jul
(49) |
Aug
(133) |
Sep
(79) |
Oct
(86) |
Nov
(145) |
Dec
(72) |
| 2019 |
Jan
(138) |
Feb
(68) |
Mar
(145) |
Apr
(203) |
May
(115) |
Jun
(70) |
Jul
(85) |
Aug
(55) |
Sep
(79) |
Oct
(50) |
Nov
(95) |
Dec
(155) |
| 2020 |
Jan
(63) |
Feb
(59) |
Mar
(135) |
Apr
(397) |
May
(180) |
Jun
(141) |
Jul
(36) |
Aug
(62) |
Sep
(92) |
Oct
(86) |
Nov
(86) |
Dec
(144) |
| 2021 |
Jan
(112) |
Feb
(44) |
Mar
(117) |
Apr
(112) |
May
(234) |
Jun
(86) |
Jul
(88) |
Aug
(113) |
Sep
(88) |
Oct
(109) |
Nov
(46) |
Dec
(54) |
| 2022 |
Jan
(104) |
Feb
(90) |
Mar
(95) |
Apr
(70) |
May
(51) |
Jun
(96) |
Jul
(76) |
Aug
(91) |
Sep
(101) |
Oct
(95) |
Nov
(126) |
Dec
(125) |
| 2023 |
Jan
(39) |
Feb
(64) |
Mar
(103) |
Apr
(107) |
May
(77) |
Jun
(162) |
Jul
(59) |
Aug
(59) |
Sep
(91) |
Oct
(273) |
Nov
(101) |
Dec
(183) |
| 2024 |
Jan
(148) |
Feb
(50) |
Mar
(55) |
Apr
(182) |
May
(106) |
Jun
(217) |
Jul
(139) |
Aug
(161) |
Sep
(193) |
Oct
(174) |
Nov
(139) |
Dec
(157) |
| 2025 |
Jan
(158) |
Feb
(215) |
Mar
(286) |
Apr
(194) |
May
(150) |
Jun
(172) |
Jul
(117) |
Aug
(133) |
Sep
(166) |
Oct
(275) |
Nov
(204) |
Dec
(267) |
| 2026 |
Jan
(174) |
Feb
(149) |
Mar
(62) |
Apr
(68) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: LIU H. <lh_...@12...> - 2026-04-17 16:26:26
|
在 2026-4-17 04:42, Hervé Poussineau 写道:
> This prevents changing all those checks when adding a new architecture.
>
> Signed-off-by: Hervé Poussineau <hpo...@re...>
> ---
> mingw-w64-crt/stdio/vfscanf.c | 7 ----
> mingw-w64-crt/stdio/vfwscanf.c | 7 ----
> mingw-w64-crt/stdio/vsscanf.c | 7 ----
> mingw-w64-crt/stdio/vswscanf.c | 7 ----
> mingw-w64-headers/crt/malloc.h | 6 ++--
> mingw-w64-headers/crt/math.h | 12 +++++--
> .../include/psdk_inc/intrin-impl.h | 4 ---
> mingw-w64-headers/include/winnt.h | 32 ++++++++-----------
> 8 files changed, 25 insertions(+), 57 deletions(-)
>
> diff --git a/mingw-w64-crt/stdio/vfscanf.c b/mingw-w64-crt/stdio/vfscanf.c
> index 685bca3b1..1b8e4fa31 100644
> --- a/mingw-w64-crt/stdio/vfscanf.c
> +++ b/mingw-w64-crt/stdio/vfscanf.c
> @@ -22,14 +22,7 @@ int vfscanf (FILE * __restrict__ stream, const char * __restrict__ format, va_li
> size_t count = __ms_scanf_max_arg_count_internal (format);
> int ret;
>
> -#if defined(_AMD64_) || defined(__x86_64__) || \
> - defined(_X86_) || defined(__i386__) || \
> - defined(_ARM_) || defined(__arm__) || \
> - defined(_ARM64_) || defined(__aarch64__)
> ret = __ms_vfscanf_internal (stream, format, arg, count, fscanf);
> -#else
> -#error "unknown platform"
> -#endif
>
> return ret;
> }
This can be further compressed to `return __ms_vfscanf_internal (...`, and `int ret` can be deleted.
Likewise elsewhere.
> diff --git a/mingw-w64-headers/include/winnt.h b/mingw-w64-headers/include/winnt.h
> index 38b4d4f38..e9a5973a9 100644
> --- a/mingw-w64-headers/include/winnt.h
> +++ b/mingw-w64-headers/include/winnt.h
> @@ -136,12 +136,16 @@ extern "C" {
> #define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; }, test)
> #endif
>
> -#if defined (__x86_64__) || defined (__i386__)
> -#define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT (DWORD)
> -#elif defined (__ia64__) || defined (__arm__) || defined(__aarch64__)
> -#define PROBE_ALIGNMENT(_s) (TYPE_ALIGNMENT (_s) > TYPE_ALIGNMENT (DWORD) ? TYPE_ALIGNMENT (_s) : TYPE_ALIGNMENT (DWORD))
> -#elif !defined (RC_INVOKED) && !defined (__WIDL__)
> -#error No supported target architecture.
> +#ifdef _WIN64
> + #if defined (__x86_64__)
> + #define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT (DWORD)
> + #elif defined (__ia64__) || defined(__aarch64__)
> + #define PROBE_ALIGNMENT(_s) (TYPE_ALIGNMENT (_s) > TYPE_ALIGNMENT (DWORD) ? TYPE_ALIGNMENT (_s) : TYPE_ALIGNMENT (DWORD))
> + #elif !defined (RC_INVOKED) && !defined (__WIDL__)
> + #error No supported target architecture.
> + #endif
> +#else
> + #define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT (DWORD)
> #endif
This changes definition of `PROBE_ALIGNMENT` on ARM32.
> -#ifndef X86_CACHE_ALIGNMENT_SIZE
> -#define X86_CACHE_ALIGNMENT_SIZE 64
> -#endif
> -
> -#ifndef ARM_CACHE_ALIGNMENT_SIZE
> -#define ARM_CACHE_ALIGNMENT_SIZE 128
> -#endif
> -
> #ifndef SYSTEM_CACHE_ALIGNMENT_SIZE
> #if defined(__x86_64__) || defined(__i386__)
> -#define SYSTEM_CACHE_ALIGNMENT_SIZE X86_CACHE_ALIGNMENT_SIZE
> -#elif defined(__aarch64__) || defined(__arm__)
> -#define SYSTEM_CACHE_ALIGNMENT_SIZE ARM_CACHE_ALIGNMENT_SIZE
> +#define SYSTEM_CACHE_ALIGNMENT_SIZE 64
> #else
> -#error Must define a target architecture.
> +#define SYSTEM_CACHE_ALIGNMENT_SIZE 128
> #endif
> #endif
>
This removes `X86_CACHE_ALIGNMENT_SIZE` and `ARM_CACHE_ALIGNMENT_SIZE`. Are you sure they are unused?
These two macros do not exist in Windows 8.1 SDK headers; they are introduced for Windows 10. There must
be a reason for that.
--
Best regards,
LIU Hao
|
|
From: LIU H. <lh_...@12...> - 2026-04-17 15:51:15
|
在 2026-4-11 17:15, Jaeden Amero via Mingw-w64-public 写道: > Add a step in the testcases-gcc job that compiles and links the > t_intrinc test with -march=i386 using the i686 GCC cross-compiler, and > then runs the test. > > Without kernel32 fallback in intrin-impl.h, GCC correctly refuses to > inline __sync_* builtins on i386 (no CMPXCHG or XADD) and instead emits > calls to library helpers that do not exist and fail to link. > > Even with kernel32 fallback, the final linked binary contains i486+ > instructions from the CRT startup code, which is built for i686. > Building t_intrinc with -march doesn't change this. However, this does > not prevent the test from running on the CI runner, which has a modern > x86 CPU that supports these instructions. > > Signed-off-by: Jaeden Amero <ja...@pa...> > --- > .github/workflows/build.yml | 6 ++++++ > 1 file changed, 6 insertions(+) > This series of patches look good to me. I have pushed them now. Thanks. -- Best regards, LIU Hao |
|
From: Martin S. <ma...@ma...> - 2026-04-17 11:17:36
|
On Fri, 17 Apr 2026, LIU Hao wrote: > I notice that libtasn1 mentions > https://bugs.llvm.org/show_bug.cgi?id=15495#c11, but it's only about inline > use of `memset()`. `memset()` isn't inlinable here and our CRT is compiled > with `-fno-builtin`, so the compiler barrier is not technically required -- > but it is harmless. I also meant to comment on the barrier here. It's harmless indeed, but also doesn't really have any effect here as long as this is compiled out of line. But if someone is building all of mingw-w64-crt with LTO, then it perhaps could make a difference, so perhaps it's indeed good to have it here in any case. // Martin |
|
From: LIU H. <lh_...@12...> - 2026-04-17 10:08:24
|
在 2026-4-14 22:03, LIU Hao 写道: > As discussed in the other patch, I suggest this condition be > > #if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 202311L > > > Also I don't quite like how these declarations are duplicated in memory.h and string.h. Maybe string.h > should just include memory.h (or corecrt_memory.h, like UCRT) to drop those duplicates. I have pushed this patch with this change (and also corecrt_memory.h in another thread). I notice that libtasn1 mentions https://bugs.llvm.org/show_bug.cgi?id=15495#c11, but it's only about inline use of `memset()`. `memset()` isn't inlinable here and our CRT is compiled with `-fno-builtin`, so the compiler barrier is not technically required -- but it is harmless. -- Best regards, LIU Hao |
|
From: LIU H. <lh_...@12...> - 2026-04-17 10:02:39
|
在 2026-4-17 16:20, Martin Storsjö 写道: > On Fri, 17 Apr 2026, LIU Hao wrote: > >> Signed-off-by: LIU Hao <lh_...@12...> >> --- >> mingw-w64-headers/crt/string.h | 34 +--------------------------------- >> 1 file changed, 1 insertion(+), 33 deletions(-) > > LGTM > > I didn't validate all the individual lines moved here, but overall this looks reasonable. > I have also reviewed these patches with LLM and there's no issue. These pass the CI so I have pushed them now. -- Best regards, LIU Hao |
|
From: Martin S. <ma...@ma...> - 2026-04-17 08:20:26
|
On Fri, 17 Apr 2026, LIU Hao wrote: > Signed-off-by: LIU Hao <lh_...@12...> > --- > mingw-w64-headers/crt/string.h | 34 +--------------------------------- > 1 file changed, 1 insertion(+), 33 deletions(-) LGTM I didn't validate all the individual lines moved here, but overall this looks reasonable. // Martin |
|
From: LIU H. <lh_...@12...> - 2026-04-17 08:08:28
|
Signed-off-by: LIU Hao <lh_...@12...>
---
mingw-w64-headers/crt/string.h | 34 +---------------------------------
1 file changed, 1 insertion(+), 33 deletions(-)
diff --git a/mingw-w64-headers/crt/string.h b/mingw-w64-headers/crt/string.h
index 34bb3362a..d8382fa3c 100644
--- a/mingw-w64-headers/crt/string.h
+++ b/mingw-w64-headers/crt/string.h
@@ -7,15 +7,7 @@
#define _INC_STRING
#include <crtdefs.h>
-
-#if defined(__LIBMSVCRT__)
-/* When building mingw-w64, this should be blank. */
-#define _SECIMP
-#else
-#ifndef _SECIMP
-#define _SECIMP __declspec(dllimport)
-#endif /* _SECIMP */
-#endif /* defined(__LIBMSVCRT__) */
+#include <corecrt_memory.h>
#ifdef __cplusplus
extern "C" {
@@ -38,30 +30,6 @@ extern "C" {
#endif
#endif
-#define _WConst_return _CONST_RETURN
-
-#ifndef _CRT_MEMORY_DEFINED
-#define _CRT_MEMORY_DEFINED
- _CRTIMP void *__cdecl _memccpy(void *_Dst,const void *_Src,int _Val,size_t _MaxCount);
-#if !defined(__STRICT_ANSI__) || defined(_GNU_SOURCE) || __STDC_VERSION__ + 0 >= 202311L ||
_XOPEN_SOURCE + 0 >= 600
- void * __cdecl memccpy(void *_Dst,const void *_Src,int _Val,size_t _Size);
-#endif
- _CONST_RETURN void *__cdecl memchr(const void *_Buf ,int _Val,size_t _MaxCount);
- _CRTIMP int __cdecl _memicmp(const void *_Buf1,const void *_Buf2,size_t _Size);
- _CRTIMP int __cdecl _memicmp_l(const void *_Buf1,const void *_Buf2,size_t _Size,_locale_t _Locale);
- int __cdecl memcmp(const void *_Buf1,const void *_Buf2,size_t _Size);
- void * __cdecl memcpy(void * __restrict__ _Dst,const void * __restrict__ _Src,size_t _Size)
__MINGW_ATTRIB_DEPRECATED_SEC_WARN;
- _SECIMP errno_t __cdecl memcpy_s (void *_dest,size_t _numberOfElements,const void *_src,size_t _count);
- void * __cdecl mempcpy (void *_Dst, const void *_Src, size_t _Size);
- void * __cdecl memset(void *_Dst,int _Val,size_t _Size);
-#if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 202311L
- void * __cdecl memset_explicit(void *_Dst,int _Val,size_t _Size);
-#endif
-#ifndef NO_OLDNAMES
- void * __cdecl memccpy(void *_Dst,const void *_Src,int _Val,size_t _Size)
__MINGW_ATTRIB_DEPRECATED_MSVC2005;
- int __cdecl memicmp(const void *_Buf1,const void *_Buf2,size_t _Size) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
-#endif
-#endif
char * __cdecl _strset(char *_Str,int _Val) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
char * __cdecl _strset_l(char *_Str,int _Val,_locale_t _Locale) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
char * __cdecl strcpy(char * __restrict__ _Dest,const char * __restrict__ _Source);
--
2.53.0
|
|
From: LIU H. <lh_...@12...> - 2026-04-17 08:07:52
|
Signed-off-by: LIU Hao <lh_...@12...>
---
mingw-w64-headers/crt/corecrt_memory.h | 57 ++++++++++++++++++++++++++
mingw-w64-headers/crt/memory.h | 48 +---------------------
2 files changed, 58 insertions(+), 47 deletions(-)
create mode 100644 mingw-w64-headers/crt/corecrt_memory.h
diff --git a/mingw-w64-headers/crt/corecrt_memory.h b/mingw-w64-headers/crt/corecrt_memory.h
new file mode 100644
index 000000000..e5c5dc270
--- /dev/null
+++ b/mingw-w64-headers/crt/corecrt_memory.h
@@ -0,0 +1,57 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+#ifndef _INC_CORECRT_MEMORY
+#define _INC_CORECRT_MEMORY
+
+#include <crtdefs.h>
+
+#if defined(__LIBMSVCRT__)
+/* When building mingw-w64, this should be blank. */
+#define _SECIMP
+#else
+#ifndef _SECIMP
+#define _SECIMP __declspec(dllimport)
+#endif /* _SECIMP */
+#endif /* defined(__LIBMSVCRT__) */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _CONST_RETURN
+#define _CONST_RETURN
+#endif
+
+#define _WConst_return _CONST_RETURN
+
+#ifndef _CRT_MEMORY_DEFINED
+#define _CRT_MEMORY_DEFINED
+ _CRTIMP void *__cdecl _memccpy(void *_Dst,const void *_Src,int _Val,size_t _MaxCount);
+#if !defined(__STRICT_ANSI__) || defined(_GNU_SOURCE) || __STDC_VERSION__ + 0 >= 202311L ||
_XOPEN_SOURCE + 0 >= 600
+ void * __cdecl memccpy(void *_Dst,const void *_Src,int _Val,size_t _Size);
+#endif
+ _CONST_RETURN void *__cdecl memchr(const void *_Buf ,int _Val,size_t _MaxCount);
+ _CRTIMP int __cdecl _memicmp(const void *_Buf1,const void *_Buf2,size_t _Size);
+ _CRTIMP int __cdecl _memicmp_l(const void *_Buf1,const void *_Buf2,size_t _Size,_locale_t _Locale);
+ int __cdecl memcmp(const void *_Buf1,const void *_Buf2,size_t _Size);
+ void * __cdecl memcpy(void * __restrict__ _Dst,const void * __restrict__ _Src,size_t _Size)
__MINGW_ATTRIB_DEPRECATED_SEC_WARN;
+ _SECIMP errno_t __cdecl memcpy_s (void *_dest,size_t _numberOfElements,const void *_src,size_t _count);
+ void * __cdecl mempcpy (void *_Dst, const void *_Src, size_t _Size);
+ void * __cdecl memset(void *_Dst,int _Val,size_t _Size);
+#if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 202311L
+ void * __cdecl memset_explicit(void *_Dst,int _Val,size_t _Size);
+#endif
+
+#ifndef NO_OLDNAMES
+ void * __cdecl memccpy(void *_Dst,const void *_Src,int _Val,size_t _Size)
__MINGW_ATTRIB_DEPRECATED_MSVC2005;
+ int __cdecl memicmp(const void *_Buf1,const void *_Buf2,size_t _Size) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/mingw-w64-headers/crt/memory.h b/mingw-w64-headers/crt/memory.h
index 289f0606b..fc40c3117 100644
--- a/mingw-w64-headers/crt/memory.h
+++ b/mingw-w64-headers/crt/memory.h
@@ -6,52 +6,6 @@
#ifndef _INC_MEMORY
#define _INC_MEMORY
-#include <crtdefs.h>
+#include <corecrt_memory.h>
-#if defined(__LIBMSVCRT__)
-/* When building mingw-w64, this should be blank. */
-#define _SECIMP
-#else
-#ifndef _SECIMP
-#define _SECIMP __declspec(dllimport)
-#endif /* _SECIMP */
-#endif /* defined(__LIBMSVCRT__) */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef _CONST_RETURN
-#define _CONST_RETURN
-#endif
-
-#define _WConst_return _CONST_RETURN
-
-#ifndef _CRT_MEMORY_DEFINED
-#define _CRT_MEMORY_DEFINED
- _CRTIMP void *__cdecl _memccpy(void *_Dst,const void *_Src,int _Val,size_t _MaxCount);
-#if !defined(__STRICT_ANSI__) || defined(_GNU_SOURCE) || __STDC_VERSION__ + 0 >= 202311L ||
_XOPEN_SOURCE + 0 >= 600
- void * __cdecl memccpy(void *_Dst,const void *_Src,int _Val,size_t _Size);
-#endif
- _CONST_RETURN void *__cdecl memchr(const void *_Buf ,int _Val,size_t _MaxCount);
- _CRTIMP int __cdecl _memicmp(const void *_Buf1,const void *_Buf2,size_t _Size);
- _CRTIMP int __cdecl _memicmp_l(const void *_Buf1,const void *_Buf2,size_t _Size,_locale_t _Locale);
- int __cdecl memcmp(const void *_Buf1,const void *_Buf2,size_t _Size);
- void * __cdecl memcpy(void * __restrict__ _Dst,const void * __restrict__ _Src,size_t _Size)
__MINGW_ATTRIB_DEPRECATED_SEC_WARN;
- _SECIMP errno_t __cdecl memcpy_s (void *_dest,size_t _numberOfElements,const void *_src,size_t _count);
- void * __cdecl mempcpy (void *_Dst, const void *_Src, size_t _Size);
- void * __cdecl memset(void *_Dst,int _Val,size_t _Size);
-#if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 202311L
- void * __cdecl memset_explicit(void *_Dst,int _Val,size_t _Size);
-#endif
-
-#ifndef NO_OLDNAMES
- void * __cdecl memccpy(void *_Dst,const void *_Src,int _Val,size_t _Size)
__MINGW_ATTRIB_DEPRECATED_MSVC2005;
- int __cdecl memicmp(const void *_Buf1,const void *_Buf2,size_t _Size) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
-#endif
-#endif
-
-#ifdef __cplusplus
-}
-#endif
#endif
--
2.53.0
|
|
From: LIU H. <lh_...@12...> - 2026-04-17 02:29:02
|
在 2026-4-16 15:28, Pali Rohár 写道: > On Thursday 16 April 2026 12:50:26 LIU Hao wrote: >> 在 2026-4-13 02:47, Pali Rohár 写道: >>> Functions which are documented or mentioned on Microsoft web site are >>> uncommented and ready for using. Other symbols are commented for now. >>> --- >>> mingw-w64-crt/lib32/advapi32.def | 9 ++++++++- >>> mingw-w64-crt/lib32/kernel32.def | 10 ++++++++++ >>> mingw-w64-crt/lib32/ntdll.def | 6 ++++++ >>> 3 files changed, 24 insertions(+), 1 deletion(-) >>> >> >> Are there any reasons why `CreateDirectory2A` etc. are not added for x86-64 and ARM64? > > I was looking only at 32-bit x86 DLL files for which def files already > have per-version documentation. > > Basically I have not looked at other archs to verify it. I think those new functions should be added to kernel32.def.in, otherwise it looks incomplete. Documentation can be done later if necessary. -- Best regards, LIU Hao |
|
From: Hervé P. <hpo...@re...> - 2026-04-16 21:22:11
|
This prevents changing all those checks when adding a new architecture.
Signed-off-by: Hervé Poussineau <hpo...@re...>
---
mingw-w64-crt/stdio/vfscanf.c | 7 ----
mingw-w64-crt/stdio/vfwscanf.c | 7 ----
mingw-w64-crt/stdio/vsscanf.c | 7 ----
mingw-w64-crt/stdio/vswscanf.c | 7 ----
mingw-w64-headers/crt/malloc.h | 6 ++--
mingw-w64-headers/crt/math.h | 12 +++++--
.../include/psdk_inc/intrin-impl.h | 4 ---
mingw-w64-headers/include/winnt.h | 32 ++++++++-----------
8 files changed, 25 insertions(+), 57 deletions(-)
diff --git a/mingw-w64-crt/stdio/vfscanf.c b/mingw-w64-crt/stdio/vfscanf.c
index 685bca3b1..1b8e4fa31 100644
--- a/mingw-w64-crt/stdio/vfscanf.c
+++ b/mingw-w64-crt/stdio/vfscanf.c
@@ -22,14 +22,7 @@ int vfscanf (FILE * __restrict__ stream, const char * __restrict__ format, va_li
size_t count = __ms_scanf_max_arg_count_internal (format);
int ret;
-#if defined(_AMD64_) || defined(__x86_64__) || \
- defined(_X86_) || defined(__i386__) || \
- defined(_ARM_) || defined(__arm__) || \
- defined(_ARM64_) || defined(__aarch64__)
ret = __ms_vfscanf_internal (stream, format, arg, count, fscanf);
-#else
-#error "unknown platform"
-#endif
return ret;
}
diff --git a/mingw-w64-crt/stdio/vfwscanf.c b/mingw-w64-crt/stdio/vfwscanf.c
index a2597f220..46527e230 100644
--- a/mingw-w64-crt/stdio/vfwscanf.c
+++ b/mingw-w64-crt/stdio/vfwscanf.c
@@ -23,14 +23,7 @@ int vfwscanf (FILE * __restrict__ stream,
size_t count = __ms_wscanf_max_arg_count_internal (format);
int ret;
-#if defined(_AMD64_) || defined(__x86_64__) || \
- defined(_X86_) || defined(__i386__) || \
- defined(_ARM_) || defined(__arm__) || \
- defined (_ARM64_) || defined (__aarch64__)
ret = __ms_vfwscanf_internal (stream, format, arg, count, fwscanf);
-#else
-#error "unknown platform"
-#endif
return ret;
}
diff --git a/mingw-w64-crt/stdio/vsscanf.c b/mingw-w64-crt/stdio/vsscanf.c
index 31eae9535..506367efd 100644
--- a/mingw-w64-crt/stdio/vsscanf.c
+++ b/mingw-w64-crt/stdio/vsscanf.c
@@ -23,14 +23,7 @@ int vsscanf (const char * __restrict__ s,
size_t count = __ms_scanf_max_arg_count_internal (format);
int ret;
-#if defined(_AMD64_) || defined(__x86_64__) || \
- defined(_X86_) || defined(__i386__) || \
- defined(_ARM_) || defined(__arm__) || \
- defined(_ARM64_) || defined(__aarch64__)
ret = __ms_vsscanf_internal (s, format, arg, count, sscanf);
-#else
-#error "unknown platform"
-#endif
return ret;
}
diff --git a/mingw-w64-crt/stdio/vswscanf.c b/mingw-w64-crt/stdio/vswscanf.c
index c52d79bf2..aea65c6e5 100644
--- a/mingw-w64-crt/stdio/vswscanf.c
+++ b/mingw-w64-crt/stdio/vswscanf.c
@@ -23,14 +23,7 @@ int vswscanf(const wchar_t * __restrict__ s, const wchar_t * __restrict__ format
size_t count = __ms_wscanf_max_arg_count_internal (format);
int ret;
-#if defined(_AMD64_) || defined(__x86_64__) || \
- defined(_X86_) || defined(__i386__) || \
- defined(_ARM_) || defined(__arm__) || \
- defined(_ARM64_) || defined(__aarch64__)
ret = __ms_vswscanf_internal (s, format, arg, count, swscanf);
-#else
-#error "unknown platform"
-#endif
return ret;
}
diff --git a/mingw-w64-headers/crt/malloc.h b/mingw-w64-headers/crt/malloc.h
index 48ae0db90..d86018c59 100644
--- a/mingw-w64-headers/crt/malloc.h
+++ b/mingw-w64-headers/crt/malloc.h
@@ -180,10 +180,10 @@ size_t __mingw_aligned_msize (void *memblock, size_t alignment, size_t offset);
#define _ALLOCA_S_STACK_MARKER 0xCCCC
#define _ALLOCA_S_HEAP_MARKER 0xDDDD
-#if defined(_ARM_) || (defined(_X86_) && !defined(__x86_64))
-#define _ALLOCA_S_MARKER_SIZE 8
-#elif defined(__ia64__) || defined(__x86_64) || defined(__aarch64__)
+#ifdef _WIN64
#define _ALLOCA_S_MARKER_SIZE 16
+#else
+#define _ALLOCA_S_MARKER_SIZE 8
#endif
#if !defined(RC_INVOKED)
diff --git a/mingw-w64-headers/crt/math.h b/mingw-w64-headers/crt/math.h
index 65c41cd6d..78d33478c 100644
--- a/mingw-w64-headers/crt/math.h
+++ b/mingw-w64-headers/crt/math.h
@@ -197,10 +197,12 @@ extern "C" {
{
#if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
return __builtin_fabsf (x);
-#else
+#elif defined(__i386__)
float res = 0.0F;
__asm__ __volatile__ ("fabs;" : "=t" (res) : "0" (x));
return res;
+#else
+ #error Unknown architecture
#endif
}
@@ -208,10 +210,12 @@ extern "C" {
{
#if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
return __builtin_fabsl (x);
-#else
+#elif defined(__i386__)
long double res = 0.0l;
__asm__ __volatile__ ("fabs;" : "=t" (res) : "0" (x));
return res;
+#else
+ #error Unknown architecture
#endif
}
@@ -219,10 +223,12 @@ extern "C" {
{
#if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
return __builtin_fabs (x);
-#else
+#elif defined(__i386__)
double res = 0.0;
__asm__ __volatile__ ("fabs;" : "=t" (res) : "0" (x));
return res;
+#else
+ #error Unknown architecture
#endif
}
#endif
diff --git a/mingw-w64-headers/include/psdk_inc/intrin-impl.h b/mingw-w64-headers/include/psdk_inc/intrin-impl.h
index e109c15d0..e3dfefd23 100644
--- a/mingw-w64-headers/include/psdk_inc/intrin-impl.h
+++ b/mingw-w64-headers/include/psdk_inc/intrin-impl.h
@@ -1555,8 +1555,6 @@ unsigned char _bittestandcomplement64(__int64 *__a, __int64 __b)
/* ***************************************************** */
-#if defined(__x86_64__) || defined(_AMD64_) || defined(__i386__) || defined(_X86_) || defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_)
-
#if __INTRINSIC_PROLOG(__popcnt16)
unsigned short __popcnt16(unsigned short);
#if !__has_builtin(__popcnt16)
@@ -1774,8 +1772,6 @@ void *_InterlockedExchangePointer(void *volatile *Target,void *Value) {
#define __INTRINSIC_DEFINED__InterlockedExchangePointer
#endif /* __INTRINSIC_PROLOG */
-#endif /* defined(__x86_64__) || defined(_AMD64_) || defined(__i386__) || defined(_X86_) || defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) */
-
#if (defined(__x86_64__) && !defined(__arm64ec__)) || (defined(_AMD64_) && !defined(_ARM64EC_)) || defined(__i386__) || defined(_X86_)
#if __INTRINSIC_PROLOG(__int2c)
diff --git a/mingw-w64-headers/include/winnt.h b/mingw-w64-headers/include/winnt.h
index 38b4d4f38..e9a5973a9 100644
--- a/mingw-w64-headers/include/winnt.h
+++ b/mingw-w64-headers/include/winnt.h
@@ -136,12 +136,16 @@ extern "C" {
#define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; }, test)
#endif
-#if defined (__x86_64__) || defined (__i386__)
-#define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT (DWORD)
-#elif defined (__ia64__) || defined (__arm__) || defined(__aarch64__)
-#define PROBE_ALIGNMENT(_s) (TYPE_ALIGNMENT (_s) > TYPE_ALIGNMENT (DWORD) ? TYPE_ALIGNMENT (_s) : TYPE_ALIGNMENT (DWORD))
-#elif !defined (RC_INVOKED) && !defined (__WIDL__)
-#error No supported target architecture.
+#ifdef _WIN64
+ #if defined (__x86_64__)
+ #define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT (DWORD)
+ #elif defined (__ia64__) || defined(__aarch64__)
+ #define PROBE_ALIGNMENT(_s) (TYPE_ALIGNMENT (_s) > TYPE_ALIGNMENT (DWORD) ? TYPE_ALIGNMENT (_s) : TYPE_ALIGNMENT (DWORD))
+ #elif !defined (RC_INVOKED) && !defined (__WIDL__)
+ #error No supported target architecture.
+ #endif
+#else
+ #define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT (DWORD)
#endif
#ifdef _WIN64
@@ -157,7 +161,7 @@ extern "C" {
#include <basetsd.h>
#ifndef DECLSPEC_IMPORT
-#if (defined (__i386__) || defined (__ia64__) || defined (__x86_64__) || defined (__arm__) || defined(__aarch64__)) && !defined (__WIDL__)
+#if !defined (__WIDL__)
#define DECLSPEC_IMPORT __declspec (dllimport)
#else
#define DECLSPEC_IMPORT
@@ -194,21 +198,11 @@ extern "C" {
#endif
#endif /* DECLSPEC_ALIGN */
-#ifndef X86_CACHE_ALIGNMENT_SIZE
-#define X86_CACHE_ALIGNMENT_SIZE 64
-#endif
-
-#ifndef ARM_CACHE_ALIGNMENT_SIZE
-#define ARM_CACHE_ALIGNMENT_SIZE 128
-#endif
-
#ifndef SYSTEM_CACHE_ALIGNMENT_SIZE
#if defined(__x86_64__) || defined(__i386__)
-#define SYSTEM_CACHE_ALIGNMENT_SIZE X86_CACHE_ALIGNMENT_SIZE
-#elif defined(__aarch64__) || defined(__arm__)
-#define SYSTEM_CACHE_ALIGNMENT_SIZE ARM_CACHE_ALIGNMENT_SIZE
+#define SYSTEM_CACHE_ALIGNMENT_SIZE 64
#else
-#error Must define a target architecture.
+#define SYSTEM_CACHE_ALIGNMENT_SIZE 128
#endif
#endif
--
2.51.2
|
|
From: Pali R. <pal...@gm...> - 2026-04-16 07:29:11
|
On Thursday 16 April 2026 12:50:26 LIU Hao wrote: > 在 2026-4-13 02:47, Pali Rohár 写道: > > Functions which are documented or mentioned on Microsoft web site are > > uncommented and ready for using. Other symbols are commented for now. > > --- > > mingw-w64-crt/lib32/advapi32.def | 9 ++++++++- > > mingw-w64-crt/lib32/kernel32.def | 10 ++++++++++ > > mingw-w64-crt/lib32/ntdll.def | 6 ++++++ > > 3 files changed, 24 insertions(+), 1 deletion(-) > > > > Are there any reasons why `CreateDirectory2A` etc. are not added for x86-64 and ARM64? I was looking only at 32-bit x86 DLL files for which def files already have per-version documentation. Basically I have not looked at other archs to verify it. |
|
From: LIU H. <lh_...@12...> - 2026-04-16 04:50:40
|
在 2026-4-13 02:47, Pali Rohár 写道: > Functions which are documented or mentioned on Microsoft web site are > uncommented and ready for using. Other symbols are commented for now. > --- > mingw-w64-crt/lib32/advapi32.def | 9 ++++++++- > mingw-w64-crt/lib32/kernel32.def | 10 ++++++++++ > mingw-w64-crt/lib32/ntdll.def | 6 ++++++ > 3 files changed, 24 insertions(+), 1 deletion(-) > Are there any reasons why `CreateDirectory2A` etc. are not added for x86-64 and ARM64? -- Best regards, LIU Hao |
|
From: Pali R. <pal...@gm...> - 2026-04-15 22:17:46
|
On Tuesday 14 April 2026 18:57:00 LIU Hao wrote:
> 在 2026-4-11 07:00, Pali Rohár 写道:
> > x87 fnstenv instruction saves the current FPU operating environment at the
> > memory location specified with the destination operand, and then masks all
> > floating-point exceptions.
> >
> > So if the x87 fnstenv instruction was called, it is required to call
> > follow-up x87 fldenv instruction which will restore previous masking state
> > of floating-point exceptions. Hence x87 fldenv instruction must be always
> > called, and not only when new cw or sw value differs from the old one.
> >
> > __mingw_setfp is currently calling x87 fldenv instruction only when the new
> > cw or sw value differs from the old one. And this behavior cause breaking
> > of following code:
> >
> > fedisableexcept(FE_ALL_EXCEPT);
> > feenableexcept(FE_INVALID);
> > feenableexcept(FE_INVALID);
> >
> > The third line disables all exceptions, including the FE_INVALID.
> > ---
> > mingw-w64-crt/misc/mingw_setfp.c | 12 ++++++++++--
> > 1 file changed, 10 insertions(+), 2 deletions(-)
> >
>
> While these patches all look good, I would like to suggest you add some testcases to cover such issues.
Ok, I will try to add some test new cases for this issue.
What about running gnulib test suite in CI? As that discovered the issue.
Anyway, this issue was introduced in commit 5c5973cf5f021db8fd75e9667e63881ccd169320
("fenv: Use MSVC-compatible ABI for fenv.h functions.") and from the
commit message it looks like that code was copied from wine project.
Jacek, could you look from which (wine) sources you copied that
mingw_setfp.c code and ideally reapply those fixes? Because other
projects may have similar/same bugs. On gnulib list wrote that same
problem was found in BSD implementation.
|
|
From: Kirill M. <mai...@ou...> - 2026-04-15 13:14:39
|
LIU Hao wrote: > It should be `somelib.func` without `.dll`. Thank you! Interestingly, it works with `.dll` at least on Windows 10/11, so I assumed that it is OK to have `.dll` part. - Kirill Makurin |
|
From: LIU H. <lh_...@12...> - 2026-04-15 13:12:00
|
在 2026-4-15 21:08, Kirill Makurin 写道: > Hello, > > I know that it is possible to use DEF files to export functions from other DLLs like this: > > ``` > EXPORTS > func = somelib.dll.funcname > ``` > > This is a documented feature[1] and I am using it in my posix32 library. However, it seems like it is not supported by old Windows versions. > > I was trying to run simple test application on Windows XP which was linked against a library which exports functions from another DLL using this feature, and it failed to load with error message saying that symbol *somelib.dll.funcname* is not found in the DLL that exports it. > > Is this mechanism not supported on old Windows versions? The documentation[1] does not mention anything about it. It should be `somelib.func` without `.dll`. -- Best regards, LIU Hao |
|
From: Kirill M. <mai...@ou...> - 2026-04-15 13:08:46
|
Hello, I know that it is possible to use DEF files to export functions from other DLLs like this: ``` EXPORTS func = somelib.dll.funcname ``` This is a documented feature[1] and I am using it in my posix32 library. However, it seems like it is not supported by old Windows versions. I was trying to run simple test application on Windows XP which was linked against a library which exports functions from another DLL using this feature, and it failed to load with error message saying that symbol *somelib.dll.funcname* is not found in the DLL that exports it. Is this mechanism not supported on old Windows versions? The documentation[1] does not mention anything about it. - Kirill Makurin [1] https://learn.microsoft.com/en-us/cpp/build/reference/exports |
|
From: Kirill M. <mai...@ou...> - 2026-04-15 10:56:56
|
Hi all, back in March I wrote: > I was reading through Microsoft docs for GetVersion[1], GetVersionEx[2] and related stuff. > > [1] https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getversion > [2] https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getversionexw > > This article[3] lists version numbers for all Windows versions back to Windows 2000; do you know what are these for pre-2000? In particular NT 4.0, NT 3.51, NT 3.5, NT 3.1 and all the Win9x. > > [3] https://learn.microsoft.com/en-us/windows/win32/sysinfo/operating-system-version > > Another interesting detail I've noticed is that GetVersionEx sets `dwPlatformId` member of OSVERSIONINFO* structures to `VER_PLATFORM_WIN32_NT`; this makes me wonder if there was a separate value to identify Win9x systems? > > Also, our lib32/kernel32.def says that GetVersionEx is available in all Win9x and only since NT 3.5, which means in some cases I may need to check for its presence at runtime as well :) I was working on adopting my posix32 library to use runtime checks (compared to using _WIN32_WINNT checks at compilation time). Yesterday I finally finalized and pushed the changes I had been working on since my original message. If anyone needs a reference, feel free to take a look; I think it shouldn't be hard to adopt this code for a specific project's needs. This is the commit that adds functions and helper macros to check platform (Windows NT vs Windows 9x) and which OS version the code is running on: https://github.com/maiddaisuki/posix32/commit/60463d66af29ae2a51b82ff8cf2b58b652ce7cad. It also handles UWP configuration by using `GetVersionEx` instead of `GetVersion` which is not available to UWP applications. There are also some examples (commits) on how these functions are used. 1. Simple one; check if a function is available at runtime and use a simple stub if it's not: https://github.com/maiddaisuki/posix32/commit/2b8c782820e06a7eb3b14d88befb26fbd2781cb8 2. Another simple one; check if `RaiseFailFastException` is available at runtime and choose different implementation depending on result: https://github.com/maiddaisuki/posix32/commit/3244ecb04b936083c0446b6ad0e8d79e81459960 3. Complex one; check if Locale Name APIs (Windows Vista and later) are available and choose appropriate implementation at runtime: https://github.com/maiddaisuki/posix32/commit/a07fdd176ded3f7e4a4f3e2c0f7a0fb0ec2ea8cb. There is also a change in file locale_string.c which shows how the helper macros can be used in conditional expressions in usual code. In all cases, if APIs in question are known to be always available (e.g. `RaiseFailFastException` is available since Windows 7 and library is configured for Windows 7 or later), they will always be used without extra checks at runtime, reducing both library size and runtime overhead. - Kirill Makurin |
|
From: LIU H. <lh_...@12...> - 2026-04-14 14:03:42
|
在 2026-4-12 09:26, Peter Damianov via Mingw-w64-public 写道:
> I implemented it in the same way as glibc. It's just memset, followed by a
> compiler barrier
> ---
> mingw-w64-crt/Makefile.am | 2 +-
> mingw-w64-crt/misc/memset_explicit.c | 16 ++++++++++++++++
> mingw-w64-headers/crt/memory.h | 3 +++
> mingw-w64-headers/crt/string.h | 3 +++
> 4 files changed, 23 insertions(+), 1 deletion(-)
> create mode 100644 mingw-w64-crt/misc/memset_explicit.c
>
> diff --git a/mingw-w64-headers/crt/memory.h b/mingw-w64-headers/crt/memory.h
> index 4910a7ba5..ac54c285f 100644
> --- a/mingw-w64-headers/crt/memory.h
> +++ b/mingw-w64-headers/crt/memory.h
> @@ -41,6 +41,9 @@ extern "C" {
> _SECIMP errno_t __cdecl memcpy_s (void *_dest,size_t _numberOfElements,const void *_src,size_t _count);
> void * __cdecl mempcpy (void *_Dst, const void *_Src, size_t _Size);
> void * __cdecl memset(void *_Dst,int _Val,size_t _Size);
> +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
> + void * __cdecl memset_explicit(void *_Dst,int _Val,size_t _Size);
> +#endif
As discussed in the other patch, I suggest this condition be
#if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 202311L
Also I don't quite like how these declarations are duplicated in memory.h and string.h. Maybe string.h
should just include memory.h (or corecrt_memory.h, like UCRT) to drop those duplicates.
--
Best regards,
LIU Hao
|
|
From: LIU H. <lh_...@12...> - 2026-04-14 13:47:25
|
在 2026-4-14 18:57, LIU Hao 写道:
>
> While these patches all look good, I would like to suggest you add some testcases to cover such issues.
>
> I will push these once the CI passes.
The commit message of the first patch contains a typo ('modidying' => 'modifying'). The second patch
leaves two set-but-unused variables. I have pushed these patches with this fix:
diff --git a/mingw-w64-crt/misc/mingw_setfp.c b/mingw-w64-crt/misc/mingw_setfp.c
index 41768b29e..137a5556e 100644
--- a/mingw-w64-crt/misc/mingw_setfp.c
+++ b/mingw-w64-crt/misc/mingw_setfp.c
@@ -118,8 +118,7 @@ void __mingw_setfp( unsigned int *cw, unsigned int cw_mask,
#if defined(__arm64ec__)
__mingw_setfp_sse(cw, cw_mask, sw, sw_mask);
#elif defined(__i386__) || defined(__x86_64__)
- unsigned long oldcw = 0, newcw = 0;
- unsigned long oldsw = 0, newsw = 0;
+ unsigned long newcw = 0, newsw = 0;
unsigned int flags;
int use_fnstenv_fldenv;
struct {
@@ -163,9 +162,6 @@ void __mingw_setfp( unsigned int *cw, unsigned int cw_mask,
newcw = fenv.control_word;
}
- oldsw = newsw;
- oldcw = newcw;
-
if (sw)
{
flags = 0;
--
Best regards,
LIU Hao
|
|
From: LIU H. <lh_...@12...> - 2026-04-14 10:57:24
|
在 2026-4-11 07:00, Pali Rohár 写道: > x87 fnstenv instruction saves the current FPU operating environment at the > memory location specified with the destination operand, and then masks all > floating-point exceptions. > > So if the x87 fnstenv instruction was called, it is required to call > follow-up x87 fldenv instruction which will restore previous masking state > of floating-point exceptions. Hence x87 fldenv instruction must be always > called, and not only when new cw or sw value differs from the old one. > > __mingw_setfp is currently calling x87 fldenv instruction only when the new > cw or sw value differs from the old one. And this behavior cause breaking > of following code: > > fedisableexcept(FE_ALL_EXCEPT); > feenableexcept(FE_INVALID); > feenableexcept(FE_INVALID); > > The third line disables all exceptions, including the FE_INVALID. > --- > mingw-w64-crt/misc/mingw_setfp.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > While these patches all look good, I would like to suggest you add some testcases to cover such issues. I will push these once the CI passes. -- Best regards, LIU Hao |
|
From: Pali R. <pal...@gm...> - 2026-04-13 17:51:35
|
On Monday 13 April 2026 14:56:15 Kirill Makurin wrote: > Martin Storsjö wrote: > > > On Mon, 13 Apr 2026, Kirill Makurin wrote: > > > >> Pali Rohár wrote: > >> > >>> This will ensure that 'make' will rebuild lib32/libkernel32.a after changing lib32/kernel32.def file. > >> > >> I think I've encountered similar issue with ucrtbase-common.def.in; once > >> libucrtbase[d].a are created, modifying ucrtbase-common.def.in will not > >> cause libraries to be regenerated. This issue seems to come from the > >> fact that both ucrtbase.def.in and ucrtbased.def.in include > >> ucrtbase-common.def.in, but Make does not know about this dependency > >> since we use custom rule to preprocess both ucrtbase[d].def.in. > > > > I think that one is a different issue. The fix for that would be to have > > the preprocessor generate dependency files for the preprocessed files (-MD > > and similar) and include them in the makefile. > > > >This individual patch isn't specific to preprocessing, but to the custom > > rules used for generating libkernel32.a (as it contains both .def file > > contents and some statically linked parts). > > Yes; I just wanted to point out that we have a similar issue affecting other libraries. In both cases Make does not know about dependency, but the reason why is slightly different. > > - Kirill Makurin Anyway, for lib64/kernel32.def this dependency is already there. It was missing for lib32. -MD is slightly different thing. To be precise, both are needed. Top level def file has to be properly specified in the Makefile and then based on top level files needs to be constructed list of subdependences. I am not sure how hard it would be to write such thing. The top level one was easy fix, so I sent the change. |
|
From: Martin S. <ma...@ma...> - 2026-04-13 17:38:55
|
On Mon, 13 Apr 2026, LIU Hao wrote: > This allows these functions to be called in non-strict-conforming code, and > when > `_GNU_SOURCE` is defined, and > > * `memccpy()` is available since ISO C23, and since POSIX 2001 as an XSI > extension, and > * `strdup()` is available since ISO C23, and since POSIX 2001 as an XSI > extension, but > has been moved into POSIX 2008 base standard, and > * `strndup()` is available since ISO C23, and since POSIX 2008. > > Conditions around declarations with `__MINGW_ATTRIB_DEPRECATED_MSVC2005` are > removed, so if someone defines `__MINGW_MSVC_COMPAT_WARNINGS` they get those > warnings, always. > > Signed-off-by: LIU Hao <lh_...@12...> > --- > mingw-w64-headers/crt/memory.h | 4 +--- > mingw-w64-headers/crt/string.h | 10 ++++------ > 2 files changed, 5 insertions(+), 9 deletions(-) Thanks for this patch; this looks good to me, so I pushed it. This patch did fix building GNU make and the earlier cases in VLC. But while building VLC now, I struck another issue in building one of the libraries that VLC bundles. The "pupnp" library hardcodes the assumption that strndup is not available on Windows - even though the library already does a configure check for the function - see https://github.com/pupnp/pupnp/blob/release-1.18.4/upnp/src/api/UpnpString.c#L45-L58. There doesn't seem to be any specific reason for it; when the configure check was introduced in 2011, they seem to have kept a WIN32 part of that same ifdef as well - see https://github.com/pupnp/pupnp/commit/348bf1941274f3e9eb800bb047ab37fa4c489ec6. Fixing the issue should be as simple as removing the current _WIN32 part of the ifdef. I'll try to upstream such a fix (and backport that patch to VLC). // Martin |
|
From: Kirill M. <mai...@ou...> - 2026-04-13 14:56:41
|
Martin Storsjö wrote: > On Mon, 13 Apr 2026, Kirill Makurin wrote: > >> Pali Rohár wrote: >> >>> This will ensure that 'make' will rebuild lib32/libkernel32.a after changing lib32/kernel32.def file. >> >> I think I've encountered similar issue with ucrtbase-common.def.in; once >> libucrtbase[d].a are created, modifying ucrtbase-common.def.in will not >> cause libraries to be regenerated. This issue seems to come from the >> fact that both ucrtbase.def.in and ucrtbased.def.in include >> ucrtbase-common.def.in, but Make does not know about this dependency >> since we use custom rule to preprocess both ucrtbase[d].def.in. > > I think that one is a different issue. The fix for that would be to have > the preprocessor generate dependency files for the preprocessed files (-MD > and similar) and include them in the makefile. > >This individual patch isn't specific to preprocessing, but to the custom > rules used for generating libkernel32.a (as it contains both .def file > contents and some statically linked parts). Yes; I just wanted to point out that we have a similar issue affecting other libraries. In both cases Make does not know about dependency, but the reason why is slightly different. - Kirill Makurin |
|
From: LIU H. <lh_...@12...> - 2026-04-13 14:37:25
|
This allows these functions to be called in non-strict-conforming code, and when
`_GNU_SOURCE` is defined, and
* `memccpy()` is available since ISO C23, and since POSIX 2001 as an XSI extension, and
* `strdup()` is available since ISO C23, and since POSIX 2001 as an XSI extension, but
has been moved into POSIX 2008 base standard, and
* `strndup()` is available since ISO C23, and since POSIX 2008.
Conditions around declarations with `__MINGW_ATTRIB_DEPRECATED_MSVC2005` are
removed, so if someone defines `__MINGW_MSVC_COMPAT_WARNINGS` they get those
warnings, always.
Signed-off-by: LIU Hao <lh_...@12...>
---
mingw-w64-headers/crt/memory.h | 4 +---
mingw-w64-headers/crt/string.h | 10 ++++------
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/mingw-w64-headers/crt/memory.h b/mingw-w64-headers/crt/memory.h
index 4910a7ba5..760d84b28 100644
--- a/mingw-w64-headers/crt/memory.h
+++ b/mingw-w64-headers/crt/memory.h
@@ -30,7 +30,7 @@ extern "C" {
#ifndef _CRT_MEMORY_DEFINED
#define _CRT_MEMORY_DEFINED
_CRTIMP void *__cdecl _memccpy(void *_Dst,const void *_Src,int _Val,size_t _MaxCount);
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
+#if !defined(__STRICT_ANSI__) || defined(_GNU_SOURCE) || __STDC_VERSION__ + 0 >= 202311L ||
_XOPEN_SOURCE + 0 >= 600
void * __cdecl memccpy(void *_Dst,const void *_Src,int _Val,size_t _Size);
#endif
_CONST_RETURN void *__cdecl memchr(const void *_Buf ,int _Val,size_t _MaxCount);
@@ -43,9 +43,7 @@ extern "C" {
void * __cdecl memset(void *_Dst,int _Val,size_t _Size);
#ifndef NO_OLDNAMES
-#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 202311L
void * __cdecl memccpy(void *_Dst,const void *_Src,int _Val,size_t _Size)
__MINGW_ATTRIB_DEPRECATED_MSVC2005;
-#endif
int __cdecl memicmp(const void *_Buf1,const void *_Buf2,size_t _Size) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
#endif
#endif
diff --git a/mingw-w64-headers/crt/string.h b/mingw-w64-headers/crt/string.h
index ab7291140..36daadc03 100644
--- a/mingw-w64-headers/crt/string.h
+++ b/mingw-w64-headers/crt/string.h
@@ -43,7 +43,7 @@ extern "C" {
#ifndef _CRT_MEMORY_DEFINED
#define _CRT_MEMORY_DEFINED
_CRTIMP void *__cdecl _memccpy(void *_Dst,const void *_Src,int _Val,size_t _MaxCount);
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
+#if !defined(__STRICT_ANSI__) || defined(_GNU_SOURCE) || __STDC_VERSION__ + 0 >= 202311L ||
_XOPEN_SOURCE + 0 >= 600
void * __cdecl memccpy(void *_Dst,const void *_Src,int _Val,size_t _Size);
#endif
_CONST_RETURN void *__cdecl memchr(const void *_Buf ,int _Val,size_t _MaxCount);
@@ -55,9 +55,7 @@ extern "C" {
void * __cdecl mempcpy (void *_Dst, const void *_Src, size_t _Size);
void * __cdecl memset(void *_Dst,int _Val,size_t _Size);
#ifndef NO_OLDNAMES
-#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 202311L
void * __cdecl memccpy(void *_Dst,const void *_Src,int _Val,size_t _Size)
__MINGW_ATTRIB_DEPRECATED_MSVC2005;
-#endif
int __cdecl memicmp(const void *_Buf1,const void *_Buf2,size_t _Size) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
#endif
#endif
@@ -77,7 +75,7 @@ extern "C" {
#if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
#pragma pop_macro("_strdup")
#endif
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
+#if !defined(__STRICT_ANSI__) || defined(_GNU_SOURCE) || __STDC_VERSION__ + 0 >= 202311L ||
_POSIX_C_SOURCE + 0 >= 200809L || _XOPEN_SOURCE + 0 >= 600
#if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
#pragma push_macro("strdup")
#undef strdup
@@ -86,6 +84,8 @@ extern "C" {
#if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
#pragma pop_macro("strdup")
#endif
+#endif
+#if !defined(__STRICT_ANSI__) || defined(_GNU_SOURCE) || __STDC_VERSION__ + 0 >= 202311L ||
_POSIX_C_SOURCE + 0 >= 200809L || _XOPEN_SOURCE + 0 >= 700
char *__cdecl strndup(const char *_Src,size_t _MaxCount);
#endif
_CONST_RETURN char *__cdecl strchr(const char *_Str,int _Val);
@@ -128,7 +128,6 @@ extern "C" {
_CRTIMP size_t __cdecl _strxfrm_l(char * __restrict__ _Dst,const char * __restrict__ _Src,size_t
_MaxCount,_locale_t _Locale);
#ifndef NO_OLDNAMES
-#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 202311L
#if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
#pragma push_macro("strdup")
#undef strdup
@@ -136,7 +135,6 @@ extern "C" {
char *__cdecl strdup(const char *_Src) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
#if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
#pragma pop_macro("strdup")
-#endif
#endif
int __cdecl strcmpi(const char *_Str1,const char *_Str2) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
int __cdecl stricmp(const char *_Str1,const char *_Str2) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
--
2.53.0
|
|
From: Martin S. <ma...@ma...> - 2026-04-13 13:03:11
|
On Sun, 12 Apr 2026, Peter0x44 wrote: > On 2026-04-12 15:51, LIU Hao wrote: >> 在 2026-4-12 19:16, Martin Storsjö 写道: >>> The most pragmatic solution to this probably is to expose these functions >>> in any language mode. >>> >>> But if you don't want to do that, I think it could work to only expose it >>> in older language versions, unless __STRICT_ANSI__ is defined. (I.e. if >>> compiling with -std=c99 it's hidden, but if compiling with - std=gnu99 >>> it's visible.) >> >> Maybe this: >> >> #if !defined(__STRICT_ANSI__) \ >> || defined(_POSIX_C_SOURCE) \ >> || defined(_POSIX_SOURCE) \ >> || defined(_GNU_SOURCE) \ >> || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) >> > > I checked what glibc does. > #if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2) || __GLIBC_USE (ISOC2X) > extern char *strndup (const char *__string, size_t __n) > > It's gated like this. > USE_XOPEN2K8 means: > _POSIX_C_SOURCE >= 200809L > or > _XOPEN_SOURCE >= 700 The chain goes further back. I had a look at what GNU make actually defines; it doesn't define any of these. GNU make defines _GNU_SOURCE, which glibc features.h then uses to define _POSIX_C_SOURCE = 200809, which then implies __USE_XOPEN2K8. So if we try to replicate the glibc condition exactly, there's a risk that it ends up not being enabled in the same circumstances where it is in glibc, unless we replicate all of glibc's features.h. I'm ok with the condition that Liu Hao suggested above; I'm also ok with just always exposing it. If exactly replicating what glibc does, I'm wary that we might miss some way that it could/should end up enabled. (But if you want to try committing that first and see if it reduces the breakage, that's also fine with me.) Feel free to push any form of patches for this without waiting for me, I can follow up afterwards about how it seemed to work for the cases where I was affected. // Martin |