Re: [Mingw-w64-public] [PATCH] Add _ftime aliases for all msvcr versions

2019-01-03 Thread Mateusz
W dniu 03.01.2019 o 17:05, Jacek Caban pisze:
> On 1/3/19 4:47 PM, Jacek Caban wrote:
>> Hi Mateusz,
>>
>> On 1/2/19 5:45 PM, Mateusz wrote:
>>> W dniu 02.01.2019 o 16:32, JonY via Mingw-w64-public pisze:
 On 1/2/19 1:10 PM, Johannes Pfau wrote:
> Hello all,
>
> I'm currently adding (some basic) MinGW support to the D code which
> was recently merged into GCC9. The D runtime library already has full
> windows support, developed by DMD and LLVM D compiler devs. However,
> this needs MSVC runtime versions >= 120. So I'm now trying to add
> proper support for targeting newer MSVC libs to the GCC/MinGW ecosystem. 
>
> It turns out libgomp uses _ftime, but this symbol is only exposed for
> msvcrt.dll and I get linker errors for any other MSVC version.
> Therefore this patch adds the _ftime aliases to all msvcr .def
> files. According to timeb.h, there should be a _ftime symbol which
> maps to _ftime64 on _WIN64 and _ftime32 for anything else.
>
> This is my first MinGW patch, so please feel free to point out if
> there's anything wrong with the patch.
> BTW: How do you handle branches for the patches? The attached patch
> is against the v6.x branch.
>
> Best regards,
> Johannes
 Ideally, the patch should be against master, and then cherry-picked to
 v6.x. If there are conflicts, please prepare the patch for both branches.

 I'll let LH, Jacek and the others comment on the patch.
>>> On page 
>>> https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/ftime-ftime32-ftime64?view=vs-2017
>>>  there is an example program.
>>>
>>> I've tested this example in 64-bit GCC msvcrt/msvcr120/ucrtbase + 32-bit 
>>> GCC msvcrt/msvcr120/ucrtbase -- all works. Could you specify example that 
>>> not works?
>>
>>
>> Note that in this example, a header file is used and it's redirected in 
>> header file itself by a macro (like we do). The patch affects importlib 
>> entries. To test them you could for example declare the function yourself.
>>
> 
> Oh, I missed part of the thread and thought that importlib patch is still 
> needed besides having the define. I already tested that patch's behaviour 
> matches msvc and pushed it. Do we want it anyway? It improves compatibility 
> and in practice the macro (doing the right thing) will be used anyway.
> 
> 
> Sorry for the mess.

Hi Jacek,

Microsoft removed _ftime function (it was in msvcrt.dll) and moved to 
_ftime32/64 functions and _ftime macro. In trunk we follow this path. It is not 
needed extra patch for _ftime function (moreover, in 32-bit it is only 50% 
accurate -- _ftime could be _ftime64 and without header and check of 
_USE_32BIT_TIME_T it is impossible to tell).

Regards,
Mateusz



___
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] Add _ftime aliases for all msvcr versions

2019-01-03 Thread Jacek Caban

Hi Mateusz,

On 1/2/19 5:45 PM, Mateusz wrote:

W dniu 02.01.2019 o 16:32, JonY via Mingw-w64-public pisze:

On 1/2/19 1:10 PM, Johannes Pfau wrote:

Hello all,

I'm currently adding (some basic) MinGW support to the D code which
was recently merged into GCC9. The D runtime library already has full
windows support, developed by DMD and LLVM D compiler devs. However,
this needs MSVC runtime versions >= 120. So I'm now trying to add
proper support for targeting newer MSVC libs to the GCC/MinGW ecosystem.

It turns out libgomp uses _ftime, but this symbol is only exposed for
msvcrt.dll and I get linker errors for any other MSVC version.
Therefore this patch adds the _ftime aliases to all msvcr .def
files. According to timeb.h, there should be a _ftime symbol which
maps to _ftime64 on _WIN64 and _ftime32 for anything else.

This is my first MinGW patch, so please feel free to point out if
there's anything wrong with the patch.
BTW: How do you handle branches for the patches? The attached patch
is against the v6.x branch.

Best regards,
Johannes

Ideally, the patch should be against master, and then cherry-picked to
v6.x. If there are conflicts, please prepare the patch for both branches.

I'll let LH, Jacek and the others comment on the patch.

On 
pagehttps://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/ftime-ftime32-ftime64?view=vs-2017
  there is an example program.

I've tested this example in 64-bit GCC msvcrt/msvcr120/ucrtbase + 32-bit GCC 
msvcrt/msvcr120/ucrtbase -- all works. Could you specify example that not works?



Note that in this example, a header file is used and it's redirected in 
header file itself by a macro (like we do). The patch affects importlib 
entries. To test them you could for example declare the function yourself.



Thanks,

Jacek


___
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] Add _ftime aliases for all msvcr versions

2019-01-03 Thread Johannes Pfau

Am 03.01.19 um 07:46 schrieb Liu Hao:

在 2019/1/3 3:27, Johannes Pfau 写道:

Am 02.01.19 um 18:02 schrieb Mateusz:

W dniu 02.01.2019 o 14:10, Johannes Pfau pisze:

BTW: How do you handle branches for the patches? The attached patch
is against the v6.x branch.

I didn't read this, sorry for noise in previous mail.

The problem was solved in master branch by
https://sourceforge.net/p/mingw-w64/mingw-w64/ci/38496499910a580ddc449a7d09f3bc0302767f31/


Regards,
Mateusz

I guess I should have checked the master branch first, this is perfect.
Any idea whether this will be backported to v6.x? OTOH I'll probably
just post a patch to https://github.com/niXman/mingw-builds anyway, so
it's not really urgent to have this in v6.x.


If you are sure that this fixes the problem for you, we can cherry-pick
it now, as it applies cleanly.


That would be great. I tested both trunk and the v6.x branch with the 
cherry-picked commit and it does indeed fix the issue.



Best regards,

Johannes



___
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] Add _ftime aliases for all msvcr versions

2019-01-02 Thread Liu Hao
在 2019/1/3 3:27, Johannes Pfau 写道:
> Am 02.01.19 um 18:02 schrieb Mateusz:
>> W dniu 02.01.2019 o 14:10, Johannes Pfau pisze:
>>> BTW: How do you handle branches for the patches? The attached patch
>>> is against the v6.x branch.
>> I didn't read this, sorry for noise in previous mail.
>>
>> The problem was solved in master branch by
>> https://sourceforge.net/p/mingw-w64/mingw-w64/ci/38496499910a580ddc449a7d09f3bc0302767f31/
>>
>>
>> Regards,
>> Mateusz
> 
> I guess I should have checked the master branch first, this is perfect.
> Any idea whether this will be backported to v6.x? OTOH I'll probably
> just post a patch to https://github.com/niXman/mingw-builds anyway, so
> it's not really urgent to have this in v6.x.
> 

If you are sure that this fixes the problem for you, we can cherry-pick
it now, as it applies cleanly.

> Regards,
> 
> Johannes
> 
> 
> 

-- 
Best regards,
LH_Mouse

___
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] Add _ftime aliases for all msvcr versions

2019-01-02 Thread Liu Hao
在 2019/1/3 1:02, Mateusz 写道:
> W dniu 02.01.2019 o 14:10, Johannes Pfau pisze:
>> BTW: How do you handle branches for the patches? The attached patch
>> is against the v6.x branch.
> 
> I didn't read this, sorry for noise in previous mail.
> 
> The problem was solved in master branch by
> https://sourceforge.net/p/mingw-w64/mingw-w64/ci/38496499910a580ddc449a7d09f3bc0302767f31/
> 
> Regards,
> Mateusz
> 
> 
>

Yes; and there is no need for a fresh patch. Backporting the existent
patch will suffice.


-- 
Best regards,
LH_Mouse

___
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] Add _ftime aliases for all msvcr versions

2019-01-02 Thread Mateusz
W dniu 02.01.2019 o 20:27, Johannes Pfau pisze:
> Am 02.01.19 um 18:02 schrieb Mateusz:
>> W dniu 02.01.2019 o 14:10, Johannes Pfau pisze:
>>> BTW: How do you handle branches for the patches? The attached patch
>>> is against the v6.x branch.
>> I didn't read this, sorry for noise in previous mail.
>>
>> The problem was solved in master branch by
>> https://sourceforge.net/p/mingw-w64/mingw-w64/ci/38496499910a580ddc449a7d09f3bc0302767f31/
>>
>> Regards,
>> Mateusz
> 
> I guess I should have checked the master branch first, this is perfect. Any 
> idea whether this will be backported to v6.x?

I don't know, usually JonY make the backports and releases.

JonY maybe it is time to backport all new commits and make 6.1 release?
Now it is possible to compile ffmpeg for msvcrt/msvcr120/ucrtbase and it passes 
FATE tests for all variants 32/64-bit msvcrt/msvcr120/ucrtbase.
It is also possible to compile x265 for ucrtbase and run this x265 in Windows 
XP (after installing VC++ 2017 redist that brings ucrt to WinXP).

Regards,
Mateusz



___
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] Add _ftime aliases for all msvcr versions

2019-01-02 Thread Mateusz Mikuła
If you want to experiment mingw-build allows you to use trunk mingw-w64:
https://github.com/niXman/mingw-builds/blob/dba8a4ab94906afe677bf11199b6330e3e1ce8a2/build#L69
GCC 8.1.0 available at mingw-w64 sourceforge page was built from master
branch AFAIK.

Regards,
Mateusz Mikuła

śr., 2 sty 2019 o 20:27 Johannes Pfau  napisał(a):

> Am 02.01.19 um 18:02 schrieb Mateusz:
> > W dniu 02.01.2019 o 14:10, Johannes Pfau pisze:
> >> BTW: How do you handle branches for the patches? The attached patch
> >> is against the v6.x branch.
> > I didn't read this, sorry for noise in previous mail.
> >
> > The problem was solved in master branch by
> >
> https://sourceforge.net/p/mingw-w64/mingw-w64/ci/38496499910a580ddc449a7d09f3bc0302767f31/
> >
> > Regards,
> > Mateusz
>
> I guess I should have checked the master branch first, this is perfect.
> Any idea whether this will be backported to v6.x? OTOH I'll probably
> just post a patch to https://github.com/niXman/mingw-builds anyway, so
> it's not really urgent to have this in v6.x.
>
> Regards,
>
> Johannes
>
>
>
> ___
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>

___
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] Add _ftime aliases for all msvcr versions

2019-01-02 Thread Johannes Pfau

Am 02.01.19 um 18:02 schrieb Mateusz:

W dniu 02.01.2019 o 14:10, Johannes Pfau pisze:

BTW: How do you handle branches for the patches? The attached patch
is against the v6.x branch.

I didn't read this, sorry for noise in previous mail.

The problem was solved in master branch by
https://sourceforge.net/p/mingw-w64/mingw-w64/ci/38496499910a580ddc449a7d09f3bc0302767f31/

Regards,
Mateusz


I guess I should have checked the master branch first, this is perfect. 
Any idea whether this will be backported to v6.x? OTOH I'll probably 
just post a patch to https://github.com/niXman/mingw-builds anyway, so 
it's not really urgent to have this in v6.x.


Regards,

Johannes



___
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] Add _ftime aliases for all msvcr versions

2019-01-02 Thread Mateusz
W dniu 02.01.2019 o 14:10, Johannes Pfau pisze:
> BTW: How do you handle branches for the patches? The attached patch
> is against the v6.x branch.

I didn't read this, sorry for noise in previous mail.

The problem was solved in master branch by
https://sourceforge.net/p/mingw-w64/mingw-w64/ci/38496499910a580ddc449a7d09f3bc0302767f31/

Regards,
Mateusz



___
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] Add _ftime aliases for all msvcr versions

2019-01-02 Thread Mateusz
W dniu 02.01.2019 o 16:32, JonY via Mingw-w64-public pisze:
> On 1/2/19 1:10 PM, Johannes Pfau wrote:
>> Hello all,
>>
>> I'm currently adding (some basic) MinGW support to the D code which
>> was recently merged into GCC9. The D runtime library already has full
>> windows support, developed by DMD and LLVM D compiler devs. However,
>> this needs MSVC runtime versions >= 120. So I'm now trying to add
>> proper support for targeting newer MSVC libs to the GCC/MinGW ecosystem. 
>>
>> It turns out libgomp uses _ftime, but this symbol is only exposed for
>> msvcrt.dll and I get linker errors for any other MSVC version.
>> Therefore this patch adds the _ftime aliases to all msvcr .def
>> files. According to timeb.h, there should be a _ftime symbol which
>> maps to _ftime64 on _WIN64 and _ftime32 for anything else.
>>
>> This is my first MinGW patch, so please feel free to point out if
>> there's anything wrong with the patch.
>> BTW: How do you handle branches for the patches? The attached patch
>> is against the v6.x branch.
>>
>> Best regards,
>> Johannes
> 
> 
> Ideally, the patch should be against master, and then cherry-picked to
> v6.x. If there are conflicts, please prepare the patch for both branches.
> 
> I'll let LH, Jacek and the others comment on the patch.

On page 
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/ftime-ftime32-ftime64?view=vs-2017
 there is an example program.

I've tested this example in 64-bit GCC msvcrt/msvcr120/ucrtbase + 32-bit GCC 
msvcrt/msvcr120/ucrtbase -- all works. Could you specify example that not works?

Regards,
Mateusz

Test results:

$ m64- 82

Mateusz@Mateusz-i7 /f/t/ft
$ gcc -Wall -o f64.exe f.c

Mateusz@Mateusz-i7 /f/t/ft
$ f64
Seconds since midnight, January 1, 1970 (UTC): 1546446966
Milliseconds: 416
Minutes between UTC and local time: -60
Daylight savings time flag (1 means Daylight time is in effect): 0
The time is Wed Jan 02 17:36:06.416 2019

Mateusz@Mateusz-i7 /f/t/ft
$ m64-12- 82

Mateusz@Mateusz-i7 /f/t/ft
$ gcc -Wall -o f64-12.exe f.c

Mateusz@Mateusz-i7 /f/t/ft
$ f64-12
Seconds since midnight, January 1, 1970 (UTC): 1546447001
Milliseconds: 583
Minutes between UTC and local time: -60
Daylight savings time flag (1 means Daylight time is in effect): 0
The time is Wed Jan 02 17:36:41.583 2019

Mateusz@Mateusz-i7 /f/t/ft
$ m64-14- 82

Mateusz@Mateusz-i7 /f/t/ft
$ gcc -Wall -o f64-14.exe f.c
f.c: In function 'main':
f.c:28:64: warning: format '%d' expects argument of type 'int', but argument 2 
has type 'time_t' {aka 'long long int'} [-Wformat=]
printf( "Seconds since midnight, January 1, 1970 (UTC): %I64d\n",
^
%I64lld
time1);
~

Mateusz@Mateusz-i7 /f/t/ft
$ f64-14
Seconds since midnight, January 1, 1970 (UTC): 1546447049
Milliseconds: 498
Minutes between UTC and local time: -60
Daylight savings time flag (1 means Daylight time is in effect): 0
The time is Wed Jan  2 17:37:29.498 2019

Mateusz@Mateusz-i7 /f/t/ft
$ m32- 82

Mateusz@Mateusz-i7 /f/t/ft
$ gcc -Wall -o f32.exe f.c
f.c: In function 'main':
f.c:28:64: warning: format '%I64d' expects argument of type 'long long int', 
but argument 2 has type 'time_t' {aka 'long int'} [-Wformat=]
printf( "Seconds since midnight, January 1, 1970 (UTC): %I64d\n",
^
%ld
time1);
~
f.c:28:64: warning: format '%I64d' expects argument of type 'long long int', 
but argument 2 has type 'time_t' {aka 'long int'} [-Wformat=]
printf( "Seconds since midnight, January 1, 1970 (UTC): %I64d\n",
^
%ld
time1);
~

Mateusz@Mateusz-i7 /f/t/ft
$ f32
Seconds since midnight, January 1, 1970 (UTC): 1546447100
Milliseconds: 970
Minutes between UTC and local time: -60
Daylight savings time flag (1 means Daylight time is in effect): 0
The time is Wed Jan 02 17:38:20.970 2019

Mateusz@Mateusz-i7 /f/t/ft
$ m32-12- 82

Mateusz@Mateusz-i7 /f/t/ft
$ gcc -Wall -o f32-12.exe f.c
f.c: In function 'main':
f.c:28:64: warning: format '%I64d' expects argument of type 'long long int', 
but argument 2 has type 'time_t' {aka 'long int'} [-Wformat=]
printf( "Seconds since midnight, January 1, 1970 (UTC): %I64d\n",
^
%ld
time1);
~
f.c:28:64: warning: format '%I64d' expects argument of type 'long long int', 
but argument 2 has type 'time_t' {aka 'long int'} [-Wformat=]
printf( "Seconds since midnight, January 1, 1970 (UTC): %I64d\n",
^
%ld
time1);
~


Re: [Mingw-w64-public] [PATCH] Add _ftime aliases for all msvcr versions

2019-01-02 Thread JonY via Mingw-w64-public
On 1/2/19 1:10 PM, Johannes Pfau wrote:
> Hello all,
> 
> I'm currently adding (some basic) MinGW support to the D code which
> was recently merged into GCC9. The D runtime library already has full
> windows support, developed by DMD and LLVM D compiler devs. However,
> this needs MSVC runtime versions >= 120. So I'm now trying to add
> proper support for targeting newer MSVC libs to the GCC/MinGW ecosystem. 
> 
> It turns out libgomp uses _ftime, but this symbol is only exposed for
> msvcrt.dll and I get linker errors for any other MSVC version.
> Therefore this patch adds the _ftime aliases to all msvcr .def
> files. According to timeb.h, there should be a _ftime symbol which
> maps to _ftime64 on _WIN64 and _ftime32 for anything else.
> 
> This is my first MinGW patch, so please feel free to point out if
> there's anything wrong with the patch.
> BTW: How do you handle branches for the patches? The attached patch
> is against the v6.x branch.
> 
> Best regards,
> Johannes


Ideally, the patch should be against master, and then cherry-picked to
v6.x. If there are conflicts, please prepare the patch for both branches.

I'll let LH, Jacek and the others comment on the patch.


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