在 2020/4/30 13:17, Martin Storsjö 写道:
> 
> This patch broke compiling mingw-w64-crt (with clang, but I'm fairly
> sure the same happens with gcc as well:
> 
> ../misc/wcstof.c:20:7: error: redefinition of 'wcstof' float wcstof
> (const wchar_t * __restrict__ wcs, wchar_t ** __restrict__ wcse)
>       ^ /opt/llvm-mingw/i686-w64-mingw32/include/stdlib.h:569:17: note:
> previous definition is here
>   float __cdecl wcstof(const wchar_t * __restrict__ _Str,wchar_t **
> __restrict__ _EndPtr){
>                 ^
> 1 error generated.
> 


Oops, sorry for the trouble. The attached patch should fix this issue.

(I would like to know whether there are any better macros than `_CRTBLD`
to check against.)


-- 
Best regards,
LH_Mouse
From 617d235d2d67c1a9f8ebfc6a8b89c843e4ed668c Mon Sep 17 00:00:00 2001
From: Liu Hao <lh_mo...@126.com>
Date: Thu, 30 Apr 2020 16:25:33 +0800
Subject: [PATCH] include: Hide inline wrappers when building the CRT

Those wrappers are supposed to be visible to users. When building the
CRT, we would like to compile the non-inline versions, so we must hide
them, otherwise we get redefinitions.

Signed-off-by: Liu Hao <lh_mo...@126.com>
---
 mingw-w64-headers/crt/stdio.h  | 4 ++--
 mingw-w64-headers/crt/stdlib.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/mingw-w64-headers/crt/stdio.h b/mingw-w64-headers/crt/stdio.h
index 4425d4b5..c10202dc 100644
--- a/mingw-w64-headers/crt/stdio.h
+++ b/mingw-w64-headers/crt/stdio.h
@@ -234,7 +234,7 @@ extern
 #define __MINGW_SCANF_FORMAT  ms_scanf
 #endif
 
-#if __USE_MINGW_ANSI_STDIO
+#if __USE_MINGW_ANSI_STDIO && !defined(_CRTBLD)
 /*
  * User has expressed a preference for C99 conformance...
  */
@@ -988,7 +988,7 @@ int vsprintf (char * __restrict__ __stream, const char * 
__restrict__ __format,
   int __cdecl __stdio_common_vfwscanf(unsigned __int64 options, FILE *file, 
const wchar_t *format, _locale_t locale, va_list valist);
 #endif
 
-#if __USE_MINGW_ANSI_STDIO
+#if __USE_MINGW_ANSI_STDIO && !defined(_CRTBLD)
 /*
  * User has expressed a preference for C99 conformance...
  */
diff --git a/mingw-w64-headers/crt/stdlib.h b/mingw-w64-headers/crt/stdlib.h
index e87f6398..f414f250 100644
--- a/mingw-w64-headers/crt/stdlib.h
+++ b/mingw-w64-headers/crt/stdlib.h
@@ -10,7 +10,7 @@
 #include <corecrt_wstdlib.h>
 #include <limits.h>
 
-#if __USE_MINGW_ANSI_STDIO && !defined (__USE_MINGW_STRTOX)
+#if __USE_MINGW_ANSI_STDIO && !defined (__USE_MINGW_STRTOX) && 
!defined(_CRTBLD)
 #define __USE_MINGW_STRTOX 1
 #endif
 
-- 
2.26.2

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to