Re: [Mingw-w64-public] [Patch] normalize strftime and strftime_l

2017-06-09 Thread Kai Tietz via Mingw-w64-public
Well,

the inline variant seems fine to me.  I would prefer to have here
instead an implementation file.  As later allows us to provide such a
function from import-library too.

Cheers,
Kai

2017-06-04 2:10 GMT+02:00 Martell Malone :
> Following up with an initial patch
> Not sure if this is ideal because this will be used over the MSVC version.
> I can add it to a c source as an emulation if that suits better
>
> diff --git a/mingw-w64-headers/crt/time.h b/mingw-w64-headers/crt/time.h
> index 7f5bbb78..405a9f1d 100644
> --- a/mingw-w64-headers/crt/time.h
> +++ b/mingw-w64-headers/crt/time.h
> @@ -129,7 +129,9 @@ extern "C" {
>struct tm *__cdecl _localtime32(const __time32_t *_Time)
> __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
>_SECIMP errno_t __cdecl _localtime32_s (struct tm *_Tm,const __time32_t
> *_Time);
>size_t __cdecl strftime(char * __restrict__ _Buf,size_t
> _SizeInBytes,const char * __restrict__ _Format,const struct tm *
> __restrict__ _Tm);
> -  _CRTIMP size_t __cdecl _strftime_l(char * __restrict__ _Buf,size_t
> _Max_size,const char * __restrict__ _Format,const struct tm * __restrict__
> _Tm,_locale_t _Locale);
> +  __forceinline size_t __cdecl _strftime_l(char * __restrict__ _Buf,size_t
> _Max_size,const char * __restrict__ _Format,const struct tm * __restrict__
> _Tm,_locale_t _Locale) {
> +return strftime(_Buf, _Max_size, _Format, _Tm);
> +  }
>_CRTIMP char *__cdecl _strdate(char *_Buffer)
> __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
>_SECIMP errno_t __cdecl _strdate_s (char *_Buf,size_t _SizeInBytes);
>_CRTIMP char *__cdecl _strtime(char *_Buffer)
> __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
>
> On Mon, May 22, 2017 at 12:18 PM, Martell Malone 
> wrote:
>
>> Thanks for spotting that strangely MSDN seems to think it does exist.
>> https://docs.microsoft.com/en-gb/cpp/c-runtime-library/
>> reference/strftime-wcsftime-strftime-l-wcsftime-l
>> I have no problem in doing an emulation for "strftime_l".
>> I would rather not use random msvcrt versions :)
>>
>> On Mon, May 22, 2017 at 12:14 PM, Liu Hao  wrote:
>>
>>> On 2017/5/22 18:43, JonY wrote:
>>> > On 05/22/2017 07:57 AM, Liu Hao wrote:
>>> >> On 2017/5/22 2:05, Martell Malone wrote:
>>> >>> Context: libc++ uses strftime_l now
>>> >>>
>>> >>> Please Review
>>> >> The DEF files are generated from DLLs. I don't have Win10 at hand so I
>>> >> have asked jon_y on IRC to update them.
>>> >>
>>> >
>>> > Win10 msvcrt doesn't have strftime_l, checked on 1607.
>>> Thanks for confirmation.
>>>
>>> On my Windows 7 the function `_strftime_l` is available in
>>> MSVCR{80,90,100,110,120}.DLL, but is not available in MSVCR{T,70}.DLL.
>>> So the patch can't be applied here.
>>>
>>> When I took my last look at libcxx it required MSVCR90 to build. I am
>>> not sure which version of MSVCR* libcxx requires today but I am afraid
>>> it can't be built with only MSVCRT. That is, in order to build libcxx
>>> you have to *replace* the default `-lmsvcrt` with `-lmsvcr90` (MSVCR90
>>> is fragile so I suggest you use `-lmsvcr100`). In the case of GCC this
>>> can be done by dumping GCC's default specs file, modifying it, then
>>> building use the modified specs.
>>>
>>> --
>>> 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
>>>
>>
>>
> --
> 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] normalize strftime and strftime_l

2017-06-03 Thread Martell Malone
Following up with an initial patch
Not sure if this is ideal because this will be used over the MSVC version.
I can add it to a c source as an emulation if that suits better

diff --git a/mingw-w64-headers/crt/time.h b/mingw-w64-headers/crt/time.h
index 7f5bbb78..405a9f1d 100644
--- a/mingw-w64-headers/crt/time.h
+++ b/mingw-w64-headers/crt/time.h
@@ -129,7 +129,9 @@ extern "C" {
   struct tm *__cdecl _localtime32(const __time32_t *_Time)
__MINGW_ATTRIB_DEPRECATED_SEC_WARN;
   _SECIMP errno_t __cdecl _localtime32_s (struct tm *_Tm,const __time32_t
*_Time);
   size_t __cdecl strftime(char * __restrict__ _Buf,size_t
_SizeInBytes,const char * __restrict__ _Format,const struct tm *
__restrict__ _Tm);
-  _CRTIMP size_t __cdecl _strftime_l(char * __restrict__ _Buf,size_t
_Max_size,const char * __restrict__ _Format,const struct tm * __restrict__
_Tm,_locale_t _Locale);
+  __forceinline size_t __cdecl _strftime_l(char * __restrict__ _Buf,size_t
_Max_size,const char * __restrict__ _Format,const struct tm * __restrict__
_Tm,_locale_t _Locale) {
+return strftime(_Buf, _Max_size, _Format, _Tm);
+  }
   _CRTIMP char *__cdecl _strdate(char *_Buffer)
__MINGW_ATTRIB_DEPRECATED_SEC_WARN;
   _SECIMP errno_t __cdecl _strdate_s (char *_Buf,size_t _SizeInBytes);
   _CRTIMP char *__cdecl _strtime(char *_Buffer)
__MINGW_ATTRIB_DEPRECATED_SEC_WARN;

On Mon, May 22, 2017 at 12:18 PM, Martell Malone 
wrote:

> Thanks for spotting that strangely MSDN seems to think it does exist.
> https://docs.microsoft.com/en-gb/cpp/c-runtime-library/
> reference/strftime-wcsftime-strftime-l-wcsftime-l
> I have no problem in doing an emulation for "strftime_l".
> I would rather not use random msvcrt versions :)
>
> On Mon, May 22, 2017 at 12:14 PM, Liu Hao  wrote:
>
>> On 2017/5/22 18:43, JonY wrote:
>> > On 05/22/2017 07:57 AM, Liu Hao wrote:
>> >> On 2017/5/22 2:05, Martell Malone wrote:
>> >>> Context: libc++ uses strftime_l now
>> >>>
>> >>> Please Review
>> >> The DEF files are generated from DLLs. I don't have Win10 at hand so I
>> >> have asked jon_y on IRC to update them.
>> >>
>> >
>> > Win10 msvcrt doesn't have strftime_l, checked on 1607.
>> Thanks for confirmation.
>>
>> On my Windows 7 the function `_strftime_l` is available in
>> MSVCR{80,90,100,110,120}.DLL, but is not available in MSVCR{T,70}.DLL.
>> So the patch can't be applied here.
>>
>> When I took my last look at libcxx it required MSVCR90 to build. I am
>> not sure which version of MSVCR* libcxx requires today but I am afraid
>> it can't be built with only MSVCRT. That is, in order to build libcxx
>> you have to *replace* the default `-lmsvcrt` with `-lmsvcr90` (MSVCR90
>> is fragile so I suggest you use `-lmsvcr100`). In the case of GCC this
>> can be done by dumping GCC's default specs file, modifying it, then
>> building use the modified specs.
>>
>> --
>> 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
>>
>
>
--
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] normalize strftime and strftime_l

2017-05-22 Thread Martell Malone
Thanks for spotting that strangely MSDN seems to think it does exist.
https://docs.microsoft.com/en-gb/cpp/c-runtime-library/reference/strftime-wcsftime-strftime-l-wcsftime-l
I have no problem in doing an emulation for "strftime_l".
I would rather not use random msvcrt versions :)

On Mon, May 22, 2017 at 12:14 PM, Liu Hao  wrote:

> On 2017/5/22 18:43, JonY wrote:
> > On 05/22/2017 07:57 AM, Liu Hao wrote:
> >> On 2017/5/22 2:05, Martell Malone wrote:
> >>> Context: libc++ uses strftime_l now
> >>>
> >>> Please Review
> >> The DEF files are generated from DLLs. I don't have Win10 at hand so I
> >> have asked jon_y on IRC to update them.
> >>
> >
> > Win10 msvcrt doesn't have strftime_l, checked on 1607.
> Thanks for confirmation.
>
> On my Windows 7 the function `_strftime_l` is available in
> MSVCR{80,90,100,110,120}.DLL, but is not available in MSVCR{T,70}.DLL.
> So the patch can't be applied here.
>
> When I took my last look at libcxx it required MSVCR90 to build. I am
> not sure which version of MSVCR* libcxx requires today but I am afraid
> it can't be built with only MSVCRT. That is, in order to build libcxx
> you have to *replace* the default `-lmsvcrt` with `-lmsvcr90` (MSVCR90
> is fragile so I suggest you use `-lmsvcr100`). In the case of GCC this
> can be done by dumping GCC's default specs file, modifying it, then
> building use the modified specs.
>
> --
> 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
>
--
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] normalize strftime and strftime_l

2017-05-22 Thread Liu Hao
On 2017/5/22 18:43, JonY wrote:
> On 05/22/2017 07:57 AM, Liu Hao wrote:
>> On 2017/5/22 2:05, Martell Malone wrote:
>>> Context: libc++ uses strftime_l now
>>>
>>> Please Review
>> The DEF files are generated from DLLs. I don't have Win10 at hand so I
>> have asked jon_y on IRC to update them.
>>
> 
> Win10 msvcrt doesn't have strftime_l, checked on 1607.
Thanks for confirmation.

On my Windows 7 the function `_strftime_l` is available in 
MSVCR{80,90,100,110,120}.DLL, but is not available in MSVCR{T,70}.DLL. 
So the patch can't be applied here.

When I took my last look at libcxx it required MSVCR90 to build. I am 
not sure which version of MSVCR* libcxx requires today but I am afraid 
it can't be built with only MSVCRT. That is, in order to build libcxx 
you have to *replace* the default `-lmsvcrt` with `-lmsvcr90` (MSVCR90 
is fragile so I suggest you use `-lmsvcr100`). In the case of GCC this 
can be done by dumping GCC's default specs file, modifying it, then 
building use the modified specs.

-- 
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] normalize strftime and strftime_l

2017-05-22 Thread Martell Malone
hmm okay.

It does have strftime however so that should at least be fine right?


On Mon, May 22, 2017 at 11:43 AM, JonY  wrote:

> On 05/22/2017 07:57 AM, Liu Hao wrote:
> > On 2017/5/22 2:05, Martell Malone wrote:
> >> Context: libc++ uses strftime_l now
> >>
> >> Please Review
> > The DEF files are generated from DLLs. I don't have Win10 at hand so I
> > have asked jon_y on IRC to update them.
> >
>
> Win10 msvcrt doesn't have strftime_l, checked on 1607.
>
> 
> --
> 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] normalize strftime and strftime_l

2017-05-22 Thread JonY
On 05/22/2017 07:57 AM, Liu Hao wrote:
> On 2017/5/22 2:05, Martell Malone wrote:
>> Context: libc++ uses strftime_l now
>>
>> Please Review
> The DEF files are generated from DLLs. I don't have Win10 at hand so I 
> have asked jon_y on IRC to update them.
> 

Win10 msvcrt doesn't have strftime_l, checked on 1607.


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


Re: [Mingw-w64-public] [Patch] normalize strftime and strftime_l

2017-05-22 Thread Liu Hao
On 2017/5/22 2:05, Martell Malone wrote:
> Context: libc++ uses strftime_l now
> 
> Please Review
The DEF files are generated from DLLs. I don't have Win10 at hand so I 
have asked jon_y on IRC to update them.

-- 
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


[Mingw-w64-public] [Patch] normalize strftime and strftime_l

2017-05-21 Thread Martell Malone
Context: libc++ uses strftime_l now

Please Review

Kind Regards
Martell

diff --git a/mingw-w64-crt/lib32/msvcrt.def.in b/mingw-w64-crt/lib32/
msvcrt.def.in
index 51f62cb6..f22a79a9 100644
--- a/mingw-w64-crt/lib32/msvcrt.def.in
+++ b/mingw-w64-crt/lib32/msvcrt.def.in
@@ -1210,6 +1210,8 @@ mbstowcs_s
 printf_s
 qsort_s
 scanf_s
+strftime
+_strftime_l
 ; sprintf_s replaced by emu
 sscanf_s
 strcat_s
diff --git a/mingw-w64-crt/lib64/msvcrt.def.in b/mingw-w64-crt/lib64/
msvcrt.def.in
index bcf41ac7..60ddae05 100644
--- a/mingw-w64-crt/lib64/msvcrt.def.in
+++ b/mingw-w64-crt/lib64/msvcrt.def.in
@@ -1199,6 +1199,7 @@ strcspn
 strerror
 ; strerror_s replaced by emu
 strftime
+_strftime_l
 strlen
 strncat
 strncat_s
diff --git a/mingw-w64-crt/libarm32/msvcrt.def
b/mingw-w64-crt/libarm32/msvcrt.def
index 2533d5ac..bf5b9e82 100644
--- a/mingw-w64-crt/libarm32/msvcrt.def
+++ b/mingw-w64-crt/libarm32/msvcrt.def
@@ -1189,6 +1189,7 @@ strcspn
 strerror
 strerror_s
 strftime
+strftime_l
 strlen
 strncat
 strncat_s
--
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