Re: [Mingw-w64-public] [PATCH] headers: Define _M_ARM64 just like MSVC does

2017-11-06 Thread Kai Tietz via Mingw-w64-public
Patch is okay. Please go ahead ans commit.

Thanks
Kai

Am 07.11.2017 08:42 schrieb "Martin Storsjö" :

> Signed-off-by: Martin Storsjö 
> ---
>  mingw-w64-headers/crt/_mingw_mac.h | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/mingw-w64-headers/crt/_mingw_mac.h b/mingw-w64-headers/crt/_
> mingw_mac.h
> index eeb59c6..e60e8d7 100644
> --- a/mingw-w64-headers/crt/_mingw_mac.h
> +++ b/mingw-w64-headers/crt/_mingw_mac.h
> @@ -78,6 +78,10 @@
>  #  endif
>  #endif
>
> +#if defined(__aarch64__) && !defined(_M_ARM64)
> +#  define _M_ARM64 1
> +#endif
> +
>  #ifndef _X86_
> /* MS does not prefix symbols by underscores for 64-bit.  */
>  #  ifndef __MINGW_USE_UNDERSCORE_PREFIX
> --
> 2.7.4
>
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] [PATCH] normalise x86 (i686 vs i386) detection

2017-11-06 Thread Kai Tietz via Mingw-w64-public
Patch is okay. Please commit.
Thanks
Kai

Am 07.11.2017 08:42 schrieb "Martin Storsjö" :

> On Tue, 7 Nov 2017, Martell Malone wrote:
>
> ping. :)
>> I think this is being lost between all the different patches being
>> submitted atm.
>>
>
> The patch looks good to me although I'm not very familiar with those
> areas. Assuming you've tested it, it looks good to me.
>
> // Martin
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] [PATCH] headers: Define _M_ARM64 just like MSVC does

2017-11-06 Thread Martin Storsjö
Signed-off-by: Martin Storsjö 
---
 mingw-w64-headers/crt/_mingw_mac.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/mingw-w64-headers/crt/_mingw_mac.h 
b/mingw-w64-headers/crt/_mingw_mac.h
index eeb59c6..e60e8d7 100644
--- a/mingw-w64-headers/crt/_mingw_mac.h
+++ b/mingw-w64-headers/crt/_mingw_mac.h
@@ -78,6 +78,10 @@
 #  endif
 #endif
 
+#if defined(__aarch64__) && !defined(_M_ARM64)
+#  define _M_ARM64 1
+#endif
+
 #ifndef _X86_
/* MS does not prefix symbols by underscores for 64-bit.  */
 #  ifndef __MINGW_USE_UNDERSCORE_PREFIX
-- 
2.7.4


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] [PATCH] normalise x86 (i686 vs i386) detection

2017-11-06 Thread Martin Storsjö

On Tue, 7 Nov 2017, Martell Malone wrote:


ping. :)
I think this is being lost between all the different patches being
submitted atm.


The patch looks good to me although I'm not very familiar with those 
areas. Assuming you've tested it, it looks good to me.


// Martin

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] [PATCHv3 3/3] headers: Fix the ucrtbase version of asprintf and vasprinf

2017-11-06 Thread Martin Storsjö
Move the format attribute to the right spot, use unique variables
in the asprintf function (previously there were two variables
named ret), use properly reserved identifiers throughout both
functions.

Signed-off-by: Martin Storsjö 
---
Now with __format__ instead of format, in the attribute.
---
 mingw-w64-headers/crt/stdio.h | 30 --
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/mingw-w64-headers/crt/stdio.h b/mingw-w64-headers/crt/stdio.h
index 7365994..830bba3 100644
--- a/mingw-w64-headers/crt/stdio.h
+++ b/mingw-w64-headers/crt/stdio.h
@@ -516,25 +516,27 @@ int vsnprintf (char *__stream, size_t __n, const char 
*__format, __builtin_va_li
   }
 #ifdef _GNU_SOURCE
   __mingw_ovr
-  int __cdecl vasprintf(char ** __restrict__ ret,const char * __restrict__ 
format,va_list ap)  __attribute__ ((format (__MINGW_PRINTF_FORMAT, 2, 0)))
+  __attribute__ ((__format__ (__MINGW_PRINTF_FORMAT, 2, 0)))
+  int __cdecl vasprintf(char ** __restrict__ _Ret,const char * __restrict__ 
_Format,va_list _Args)
   {
-int len = 
__stdio_common_vsprintf(UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR, NULL, 0, 
format, NULL, ap);
-if (len < 0)
-  return len;
-*ret = malloc(len + 1);
-if (!*ret)
+int _Len = 
__stdio_common_vsprintf(UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR, NULL, 0, 
_Format, NULL, _Args);
+if (_Len < 0)
+  return _Len;
+*_Ret = malloc(_Len + 1);
+if (!*_Ret)
   return -1;
-return 
__stdio_common_vsprintf(UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR, *ret, len 
+ 1, format, NULL, ap);
+return 
__stdio_common_vsprintf(UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR, *_Ret, 
_Len + 1, _Format, NULL, _Args);
   }
   __mingw_ovr
-  int __cdecl asprintf(char ** __restrict__ ret,const char * __restrict__ 
format,...) __attribute__ ((format (__MINGW_PRINTF_FORMAT, 2, 3)))
+  __attribute__ ((__format__ (__MINGW_PRINTF_FORMAT, 2, 3)))
+  int __cdecl asprintf(char ** __restrict__ _Ret,const char * __restrict__ 
_Format,...)
   {
-__builtin_va_list ap;
-int ret;
-__builtin_va_start(ap, _Format);
-ret = vasprintf(ret, format, ap);
-__builtin_va_end(ap);
-return ret;
+__builtin_va_list _Args;
+int _N;
+__builtin_va_start(_Args, _Format);
+_N = vasprintf(_Ret, _Format, _Args);
+__builtin_va_end(_Args);
+return _N;
   }
 #endif /*_GNU_SOURCE*/
 
-- 
2.7.4


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] [PATCH] normalise x86 (i686 vs i386) detection

2017-11-06 Thread Martell Malone
ping. :)
I think this is being lost between all the different patches being
submitted atm.

On Sun, Nov 5, 2017 at 3:07 AM, Martell Malone 
wrote:

> different variations of -march can be passed to the compiler.
> this fixes mingw-w64 when __i686__ is not present.
>
> Please Review.
>
> diff --git a/mingw-w64-headers/crt/_mingw_mac.h b/mingw-w64-headers/crt/_
> mingw_mac.h
> index eeb59c69..115e58a5 100644
> --- a/mingw-w64-headers/crt/_mingw_mac.h
> +++ b/mingw-w64-headers/crt/_mingw_mac.h
> @@ -47,10 +47,10 @@
>  #define _M_IX86 400
>  #  elif defined(__i586__)
>  #define _M_IX86 500
> -#  else
> - /* This gives wrong (600 instead of 300) value if -march=i386 is
> specified
> -  but we cannot check for__i386__ as it is defined for all 32-bit
> CPUs. */
> +#  elif defined(__i686__)
>  #define _M_IX86 600
> +#  else
> +#define _M_IX86 300
>  #  endif
>  #endif /* if defined(_X86_) && !defined(_M_IX86) && !defined(_M_IA64) ...
> */
>
> diff --git a/mingw-w64-libraries/winpthreads/src/thread.c
> b/mingw-w64-libraries/winpthreads/src/thread.c
> index fd213ccf..2e6fe610 100644
> --- a/mingw-w64-libraries/winpthreads/src/thread.c
> +++ b/mingw-w64-libraries/winpthreads/src/thread.c
> @@ -1457,7 +1457,7 @@ pthread_setcanceltype (int type, int *oldtype)
>return 0;
>  }
>
> -#if defined(__i686__)
> +#if defined(__i386__)
>  /* Align ESP on 16-byte boundaries. */
>  #  if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)
>  __attribute__((force_align_arg_pointer))
>
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] [PATCHv2 3/3] headers: Fix the ucrtbase version of asprintf and vasprinf

2017-11-06 Thread Liu Hao

On 2017/11/7 14:23, Martin Storsjö wrote:

  __attribute__ ((format (__MINGW_PRINTF_FORMAT, 2, 0)))


I think this should be `__attribute__((__format__ ... ))`, as in 
`_snprintf`.


I just took a look at other functions in , and yes, there are a 
number of such issues, with a few more (such as the parameter of 
`ftello`). I hope oneday these could be fixed. `swscanf`, `fwprintf` etc 
do not have such issues.


--
Best regards,
LH_Mouse


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] [PATCH 3/3] headers: Fix the ucrtbase version of asprintf

2017-11-06 Thread Martin Storsjö

On Tue, 7 Nov 2017, Liu Hao wrote:


On 2017/11/7 13:19, Martin Storsjö wrote:
Not really, it mostly comes from whichever wording was used in the place it 
was copypasted from. Since these identifiers aren't visible outside of the 
inline function, I don't see how it would matter. If you feel strongly 
about it, there's a huge number of other inline functions with identifiers 
like these.


// Martin


Pedantically speaking, as long as these identifiers are used in a _standard 
library_ header (that is, ) they shall be reserved ones such as the 
`_Format` thing that gets removed by this patch. Otherwise, some _strictly 
conforming programs_ will fail to compile, as follows:


```c
#define format !?
#include 
int main(void){
 puts("hello world!");
 return 0;
}
```

```
E:\Desktop>gcc test.c
test.c:1:16: error: expected ';', ',' or ')' before '!' token
#define format !?
   ^
```


Oh, indeed, I hadn't thought about that aspect of it. Will update the 
patch, and make sure any further patches I write use such reserved names 
correctly.


// Martin
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] [PATCH 3/3] headers: Fix the ucrtbase version of asprintf

2017-11-06 Thread Liu Hao

On 2017/11/7 13:19, Martin Storsjö wrote:
Not really, it mostly comes from whichever wording was used in the place 
it was copypasted from. Since these identifiers aren't visible outside 
of the inline function, I don't see how it would matter. If you feel 
strongly about it, there's a huge number of other inline functions with 
identifiers like these.


// Martin


Pedantically speaking, as long as these identifiers are used in a 
_standard library_ header (that is, ) they shall be reserved 
ones such as the `_Format` thing that gets removed by this patch. 
Otherwise, some _strictly conforming programs_ will fail to compile, as 
follows:


```c
#define format !?
#include 
int main(void){
  puts("hello world!");
  return 0;
}
```

```
E:\Desktop>gcc test.c
test.c:1:16: error: expected ';', ',' or ')' before '!' token
 #define format !?
^
```

--
Best regards,
LH_Mouse


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] [PATCH 3/3] headers: Fix the ucrtbase version of asprintf

2017-11-06 Thread Martin Storsjö

On Tue, 7 Nov 2017, Liu Hao wrote:


On 2017/11/7 6:19, Martin Storsjö wrote:

Signed-off-by: Martin Storsjö 
---
  mingw-w64-headers/crt/stdio.h | 8 
  1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mingw-w64-headers/crt/stdio.h b/mingw-w64-headers/crt/stdio.h
index 7365994..cea5559 100644
--- a/mingw-w64-headers/crt/stdio.h
+++ b/mingw-w64-headers/crt/stdio.h
@@ -530,11 +530,11 @@ int vsnprintf (char *__stream, size_t __n, const char 
*__format, __builtin_va_li
int __cdecl asprintf(char ** __restrict__ ret,const char * __restrict__ 
format,...) __attribute__ ((format (__MINGW_PRINTF_FORMAT, 2, 3)))

{
  __builtin_va_list ap;
-int ret;
-__builtin_va_start(ap, _Format);
-ret = vasprintf(ret, format, ap);
+int n;
+__builtin_va_start(ap, format);
+n = vasprintf(ret, format, ap);
  __builtin_va_end(ap);
-return ret;
+return n;
}
  #endif /*_GNU_SOURCE*/


Are there any reasons why reserved identifiers are not favored here?


Not really, it mostly comes from whichever wording was used in the place 
it was copypasted from. Since these identifiers aren't visible outside of 
the inline function, I don't see how it would matter. If you feel strongly 
about it, there's a huge number of other inline functions with identifiers 
like these.


// Martin
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] [PATCH 0/2] Top level build libraries/tools improvements

2017-11-06 Thread Alon Bar-Lev
On 7 November 2017 at 01:09, JonY via Mingw-w64-public
 wrote:
>
> On 11/04/2017 09:02 PM, Alon Bar-Lev wrote:
> > Hi,
> >
> > I see that the patch to add winpthreads was finally merged, this is great as
> > we can patch less the build system at Gentoo.
> >
> > Here are additional two patches:
> > 1. Enable build of pseh only in supported architecture
> > 2. Enable comma-separated list of tools and libraries instead explicit
> >single element.
>
> Pushed to master.

Thanks!
Can you please also cherry-pick these into v5.x?

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] [PATCH 3/3] headers: Fix the ucrtbase version of asprintf

2017-11-06 Thread Liu Hao

On 2017/11/7 6:19, Martin Storsjö wrote:

Signed-off-by: Martin Storsjö 
---
  mingw-w64-headers/crt/stdio.h | 8 
  1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mingw-w64-headers/crt/stdio.h b/mingw-w64-headers/crt/stdio.h
index 7365994..cea5559 100644
--- a/mingw-w64-headers/crt/stdio.h
+++ b/mingw-w64-headers/crt/stdio.h
@@ -530,11 +530,11 @@ int vsnprintf (char *__stream, size_t __n, const char 
*__format, __builtin_va_li
int __cdecl asprintf(char ** __restrict__ ret,const char * __restrict__ 
format,...) __attribute__ ((format (__MINGW_PRINTF_FORMAT, 2, 3)))
{
  __builtin_va_list ap;
-int ret;
-__builtin_va_start(ap, _Format);
-ret = vasprintf(ret, format, ap);
+int n;
+__builtin_va_start(ap, format);
+n = vasprintf(ret, format, ap);
  __builtin_va_end(ap);
-return ret;
+return n;
}
  #endif /*_GNU_SOURCE*/
  


Are there any reasons why reserved identifiers are not favored here?

--
Best regards,
LH_Mouse


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] [PATCH 0/2] Top level build libraries/tools improvements

2017-11-06 Thread JonY via Mingw-w64-public
On 11/04/2017 09:02 PM, Alon Bar-Lev wrote:
> Hi,
> 
> I see that the patch to add winpthreads was finally merged, this is great as
> we can patch less the build system at Gentoo.
> 
> Here are additional two patches:
> 1. Enable build of pseh only in supported architecture
> 2. Enable comma-separated list of tools and libraries instead explicit
>single element.

Pushed to master.



signature.asc
Description: OpenPGP digital signature
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] [PATCH 3/3] headers: Fix the ucrtbase version of asprintf

2017-11-06 Thread Martin Storsjö
Signed-off-by: Martin Storsjö 
---
 mingw-w64-headers/crt/stdio.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mingw-w64-headers/crt/stdio.h b/mingw-w64-headers/crt/stdio.h
index 7365994..cea5559 100644
--- a/mingw-w64-headers/crt/stdio.h
+++ b/mingw-w64-headers/crt/stdio.h
@@ -530,11 +530,11 @@ int vsnprintf (char *__stream, size_t __n, const char 
*__format, __builtin_va_li
   int __cdecl asprintf(char ** __restrict__ ret,const char * __restrict__ 
format,...) __attribute__ ((format (__MINGW_PRINTF_FORMAT, 2, 3)))
   {
 __builtin_va_list ap;
-int ret;
-__builtin_va_start(ap, _Format);
-ret = vasprintf(ret, format, ap);
+int n;
+__builtin_va_start(ap, format);
+n = vasprintf(ret, format, ap);
 __builtin_va_end(ap);
-return ret;
+return n;
   }
 #endif /*_GNU_SOURCE*/
 
-- 
2.7.4


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] [PATCH 2/3] crt: Remove ucrtbase_compat workarounds for __mb_cur_max

2017-11-06 Thread Martin Storsjö
This simplifies the compat wrapper quite significantly, and the
workarounds weren't sufficient in any case (the local __mb_cur_max
value only was updated if the current module set the locale).

Signed-off-by: Martin Storsjö 
---
 mingw-w64-crt/crt/ucrtbase_compat.c | 39 -
 1 file changed, 39 deletions(-)

diff --git a/mingw-w64-crt/crt/ucrtbase_compat.c 
b/mingw-w64-crt/crt/ucrtbase_compat.c
index ed37ac2..404d1ac 100644
--- a/mingw-w64-crt/crt/ucrtbase_compat.c
+++ b/mingw-w64-crt/crt/ucrtbase_compat.c
@@ -20,12 +20,10 @@
 #define __wgetmainargs crtimp___wgetmainargs
 #define _amsg_exit crtimp__amsg_exit
 #define _get_output_format crtimp__get_output_format
-#define _wsetlocale crtimp__wsetlocale
 
 #include 
 #include 
 #include 
-#include 
 
 #undef vfprintf
 #undef fprintf
@@ -35,10 +33,8 @@
 #undef __wgetmainargs
 #undef _amsg_exit
 #undef _get_output_format
-#undef _wsetlocale
 
 #undef __iob_func
-#undef ___mb_cur_max_func
 
 
 // Declarations of non-static functions implemented within this file (that 
aren't
@@ -48,7 +44,6 @@ int __cdecl __getmainargs(int * _Argc, char *** _Argv, char 
***_Env, int _DoWild
 int __cdecl __wgetmainargs(int * _Argc, wchar_t *** _Argv, wchar_t ***_Env, 
int _DoWildCard, _startupinfo *_StartInfo);
 void __cdecl _amsg_exit(int ret);
 unsigned int __cdecl _get_output_format(void);
-wchar_t * __cdecl _wsetlocale(int _Category, const wchar_t *_Locale);
 
 void __cdecl _lock(int _File);
 void __cdecl _unlock(int _File);
@@ -72,7 +67,6 @@ _CRTIMP char** __cdecl __p__acmdln(void);
 _CRTIMP wchar_t** __cdecl __p__wcmdln(void);
 
 _CRTIMP int __cdecl _crt_atexit(_onexit_t func);
-_CRTIMP int __cdecl ___mb_cur_max_func(void);
 
 _CRTIMP int __cdecl _initialize_narrow_environment(void);
 _CRTIMP int __cdecl _initialize_wide_environment(void);
@@ -153,10 +147,6 @@ char ** __MINGW_IMP_SYMBOL(_wcmdln);
 #define _EXIT_LOCK1 8
 
 static CRITICAL_SECTION exit_lock;
-static char * (*real_setlocale)(int, const char*);
-static wchar_t * (*real__wsetlocale)(int, const wchar_t*);
-static int local__mb_cur_max;
-int * __MINGW_IMP_SYMBOL(__mb_cur_max) = __mb_cur_max;
 
 static void __cdecl free_locks(void)
 {
@@ -165,43 +155,14 @@ static void __cdecl free_locks(void)
 
 static void __cdecl init_compat_dtor(void)
 {
-  HANDLE ucrt;
-
-  ucrt = GetModuleHandle("ucrtbase.dll");
-  real_setlocale = (char * (*)(int, const char*)) GetProcAddress(ucrt, 
"setlocale");
-  real__wsetlocale = (wchar_t * (*)(int, const wchar_t*)) GetProcAddress(ucrt, 
"_wsetlocale");
-
   InitializeCriticalSection(_lock);
 
-  local__mb_cur_max = ___mb_cur_max_func();
-
   atexit(free_locks);
 }
 
 _CRTALLOC(".CRT$XID") _PVFV mingw_ucrtbase_compat_init = init_compat_dtor;
 
 
-// Intercept any calls to setlocale, that could change the return value of
-// ___mb_cur_max_func(), and update the __mb_cur_max variable accordingly.
-// If stdlib.h and ctype.h were to be updated to actually call the real
-// ___mb_cur_max_func() function (which exists in all(?) versions of 
msvcrt.dll)
-// instead of reading the __mb_cur_max extern variable, we could avoid all 
this.
-char * __cdecl setlocale(int _Category, const char *_Locale)
-{
-  char *ret;
-  ret = real_setlocale(_Category, _Locale);
-  local__mb_cur_max = ___mb_cur_max_func();
-  return ret;
-}
-
-wchar_t * __cdecl _wsetlocale(int _Category, const wchar_t *_Locale)
-{
-  wchar_t *ret;
-  ret = real__wsetlocale(_Category, _Locale);
-  local__mb_cur_max = ___mb_cur_max_func();
-  return ret;
-}
-
 // This is the only lock that will be used (from atonexit.c). The _lock_file 
and
 // _unlock_file fallback wrappers in stdio/mingw_lock.c are only linked in 
libmsvcrt.a,
 // not when targeting a known newer version.
-- 
2.7.4


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] [PATCH] Provide __debugbreak on clang if it doesn't exist as builtin

2017-11-06 Thread Martin Storsjö

On Sun, 5 Nov 2017, Martell Malone wrote:


LGTM

On Sun, Nov 5, 2017 at 7:49 PM, Martin Storsjö  wrote:


Since clang 3.4, __debugbreak is limited to -fms-extensions
and thus not available by default when targeting mingw.

Signed-off-by: Martin Storsjö 
---
 mingw-w64-headers/crt/_mingw.h.in | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/mingw-w64-headers/crt/_mingw.h.in b/mingw-w64-headers/crt/_
mingw.h.in
index c5f3bf8..c7b07ed 100644
--- a/mingw-w64-headers/crt/_mingw.h.in
+++ b/mingw-w64-headers/crt/_mingw.h.in
@@ -534,8 +534,13 @@ typedef int __int128 __attribute__ ((__mode__ (TI)));
 extern "C" {
 #endif

+
+#ifndef __has_builtin
+  #define __has_builtin(x) 0
+#endif
+
 #ifdef __MINGW_INTRIN_INLINE
-#if !defined (__clang__)
+#if !defined (__clang__) || !__has_builtin(__debugbreak)
 void __cdecl __debugbreak(void);
 __MINGW_INTRIN_INLINE void __cdecl __debugbreak(void)
 {
--
2.7.4


Pushed, thanks

// Martin
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public