[Mingw-w64-public] Runtime for Cygwin

2013-06-03 Thread Алексей Павлов
Hi, all!

When using latest mingw-w64 runtime from trunk for Cygwin I have error:
http://pastebin.com/9WVgE1Gu

Regards, Alexey.
--
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Runtime for Cygwin

2013-06-03 Thread Kai Tietz
2013/6/3 Алексей Павлов :
> Hi, all!
>
> When using latest mingw-w64 runtime from trunk for Cygwin I have error:
> http://pastebin.com/9WVgE1Gu
>
> Regards, Alexey.

Hmm, means that Interlocked-Functions getting defined twice with
different prototypes.
Corinna, any idea here?

Regards,
Kai

--
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Runtime for Cygwin

2013-06-03 Thread Алексей Павлов
I have this error only on 64-bit Cygwin


2013/6/3 Kai Tietz 

> 2013/6/3 Алексей Павлов :
> > Hi, all!
> >
> > When using latest mingw-w64 runtime from trunk for Cygwin I have error:
> > http://pastebin.com/9WVgE1Gu
> >
> > Regards, Alexey.
>
> Hmm, means that Interlocked-Functions getting defined twice with
> different prototypes.
> Corinna, any idea here?
>
> Regards,
> Kai
>
>
> --
> Get 100% visibility into Java/.NET code with AppDynamics Lite
> It's a free troubleshooting tool designed for production
> Get down to code-level detail for bottlenecks, with <2% overhead.
> Download for free and get started troubleshooting in minutes.
> http://p.sf.net/sfu/appdyn_d2d_ap2
> ___
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
--
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Runtime for Cygwin

2013-06-04 Thread Kai Tietz
Hmm, could you try if the following patch solves your problem?

Kai

Index: winnt.h
===
--- winnt.h(Revision 5878)
+++ winnt.h(Arbeitskopie)
@@ -1542,10 +1542,10 @@ extern "C" {
 VOID __stosq(PDWORD64 Destination,DWORD64 Value,SIZE_T Count);

 #ifndef __CRT__NO_INLINE
-__CRT_INLINE __buildstos(__stosb, BYTE)
-__CRT_INLINE __buildstos(__stosw, WORD)
-__CRT_INLINE __buildstos(__stosd, DWORD)
-__CRT_INLINE __buildstos(__stosq, DWORD64)
+__CRT_INLINE __buildstos(__stosb, VOID, PBYTE, BYTE, SIZE_T)
+__CRT_INLINE __buildstos(__stosw, VOID, PWORD, WORD, SIZE_T)
+__CRT_INLINE __buildstos(__stosd, VOID, PDWORD, DWORD, SIZE_T)
+__CRT_INLINE __buildstos(__stosq, VOID, PDWORD64, DWORD64, SIZE_T)
 #endif /* __CRT__NO_INLINE */

 #define MultiplyHigh __mulh
Index: psdk_inc/intrin-mac.h
===
--- psdk_inc/intrin-mac.h(Revision 5878)
+++ psdk_inc/intrin-mac.h(Arbeitskopie)
@@ -15,7 +15,8 @@
FunctionName: Any valid function name
DataType: BYTE, WORD, DWORD or DWORD64 */

-#define __buildstos(x, y) void x(y *Dest, y Data, size_t Count) \
+#define __buildstos(x, r0, t0, t1, t2) \
+r0 x(t0 Dest, t1 Data, t2 Count) \
 { \
__asm__ __volatile__ ("rep stos%z[Data]" \
   :  /* no outputs */ \

--
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Runtime for Cygwin

2013-06-04 Thread Алексей Павлов
2013/6/4 Kai Tietz 

> Hmm, could you try if the following patch solves your problem?
>
> Kai
>
> Index: winnt.h
> ===
> --- winnt.h(Revision 5878)
> +++ winnt.h(Arbeitskopie)
> @@ -1542,10 +1542,10 @@ extern "C" {
>  VOID __stosq(PDWORD64 Destination,DWORD64 Value,SIZE_T Count);
>
>  #ifndef __CRT__NO_INLINE
> -__CRT_INLINE __buildstos(__stosb, BYTE)
> -__CRT_INLINE __buildstos(__stosw, WORD)
> -__CRT_INLINE __buildstos(__stosd, DWORD)
> -__CRT_INLINE __buildstos(__stosq, DWORD64)
> +__CRT_INLINE __buildstos(__stosb, VOID, PBYTE, BYTE, SIZE_T)
> +__CRT_INLINE __buildstos(__stosw, VOID, PWORD, WORD, SIZE_T)
> +__CRT_INLINE __buildstos(__stosd, VOID, PDWORD, DWORD, SIZE_T)
> +__CRT_INLINE __buildstos(__stosq, VOID, PDWORD64, DWORD64, SIZE_T)
>  #endif /* __CRT__NO_INLINE */
>
>  #define MultiplyHigh __mulh
> Index: psdk_inc/intrin-mac.h
> ===
> --- psdk_inc/intrin-mac.h(Revision 5878)
> +++ psdk_inc/intrin-mac.h(Arbeitskopie)
> @@ -15,7 +15,8 @@
> FunctionName: Any valid function name
> DataType: BYTE, WORD, DWORD or DWORD64 */
>
> -#define __buildstos(x, y) void x(y *Dest, y Data, size_t Count) \
> +#define __buildstos(x, r0, t0, t1, t2) \
> +r0 x(t0 Dest, t1 Data, t2 Count) \
>  { \
> __asm__ __volatile__ ("rep stos%z[Data]" \
>:  /* no outputs */ \
>
> Hi, Kai!
I test your patch but without success. I have error:


make[3]: Entering directory
'/work/build/runtime/x86_64-pc-cygwin/winsup/cygwin'

../../../../../Cygwin32/winsup/cygwin/gendef --cpu=x86_64
--output-def=cygwin.def
--tlsoffsets=../../../../../Cygwin32/winsup/cygwin/tlsoffsets64.h
../../../../../Cygwin32/winsup/cygwin/x86_64.din
../../../../../Cygwin32/winsup/cygwin/common.din

../../../../../Cygwin32/winsup/cygwin/mkglobals_h
../../../../../Cygwin32/winsup/cygwin/globals.cc > globals.h

c++wrap -O2 -g -fno-rtti -fno-exceptions -Wall -Wstrict-aliasing
-Wwrite-strings -fno-common -pipe -fbuiltin -fmessage-length=0 -MMD -Werror
-fmerge-constants -ftracer -mcmodel=small -c -o _cygwin_crt0_common.o
../../../../../Cygwin32/winsup/cygwin/lib/_cygwin_crt0_common.cc

In file included from /usr/include/w32api/windef.h:139:0,

 from /usr/include/w32api/windows.h:69,

 from ../../../../../Cygwin32/winsup/cygwin/winlean.h:52,

 from ../../../../../Cygwin32/winsup/cygwin/winsup.h:76,

 from
../../../../../Cygwin32/winsup/cygwin/lib/_cygwin_crt0_common.cc:12:

/usr/include/w32api/winnt.h:1545:39: error: macro "__buildstos" requires 5
arguments, but only 2 given

 __CRT_INLINE __buildstos(__stosb, BYTE)

   ^

/usr/include/w32api/winnt.h:1546:39: error: macro "__buildstos" requires 5
arguments, but only 2 given

 __CRT_INLINE __buildstos(__stosw, WORD)

   ^

/usr/include/w32api/winnt.h:1547:40: error: macro "__buildstos" requires 5
arguments, but only 2 given

 __CRT_INLINE __buildstos(__stosd, DWORD)

^

/usr/include/w32api/winnt.h:1548:42: error: macro "__buildstos" requires 5
arguments, but only 2 given

 __CRT_INLINE __buildstos(__stosq, DWORD64)

  ^

In file included from /usr/include/w32api/windef.h:139:0,

 from /usr/include/w32api/windows.h:69,

 from ../../../../../Cygwin32/winsup/cygwin/winlean.h:52,

 from ../../../../../Cygwin32/winsup/cygwin/winsup.h:76,

 from
../../../../../Cygwin32/winsup/cygwin/lib/_cygwin_crt0_common.cc:12:

/usr/include/w32api/winnt.h:1545:14: error: ‘__buildstos’ does not name a
type

 __CRT_INLINE __buildstos(__stosb, BYTE)

  ^

../../../../../Cygwin32/winsup/cygwin/../Makefile.common:43: recipe for
target '_cygwin_crt0_common.o' failed

make[3]: *** [_cygwin_crt0_common.o] Error 1

make[3]: Leaving directory
'/work/build/runtime/x86_64-pc-cygwin/winsup/cygwin'

Makefile:82: recipe for target 'cygwin' failed

make[2]: *** [cygwin] Error 1

Regards, Alexey.
--
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Runtime for Cygwin

2013-06-04 Thread Алексей Павлов
Oh, I am sorry! I change winnt.h bat forgot to click save button)

It works now Kai!


2013/6/4 Kai Tietz 

> You missed the hunk for winnt.h header.
>
> Kai
>
>
> --
> How ServiceNow helps IT people transform IT departments:
> 1. A cloud service to automate IT design, transition and operations
> 2. Dashboards that offer high-level views of enterprise services
> 3. A single system of record for all IT processes
> http://p.sf.net/sfu/servicenow-d2d-j
> ___
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
--
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Runtime for Cygwin

2013-06-04 Thread Kai Tietz
You missed the hunk for winnt.h header.

Kai

--
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Runtime for Cygwin

2013-06-04 Thread dw

> When using latest mingw-w64 runtime from trunk for Cygwin I have 
> error: http://pastebin.com/9WVgE1Gu

I would like to experiment with some alternate solutions to what ktietz 
proposed, but I need to be sure I understand what is going wrong.

My attempts to reproduce the problem have not been successful.  Can you 
produce a small sample?

dw

--
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Runtime for Cygwin

2013-06-04 Thread Алексей Павлов
2013/6/5 dw 

>
> > When using latest mingw-w64 runtime from trunk for Cygwin I have
> > error: http://pastebin.com/9WVgE1Gu
>
> I would like to experiment with some alternate solutions to what ktietz
> proposed, but I need to be sure I understand what is going wrong.
>
> My attempts to reproduce the problem have not been successful.  Can you
> produce a small sample?
>
> Try to get latest trunk version of mingw-w64 and build runtime for Cygwin.
Then Install new builded runtime into Cygwin and try to build Cygwin.dll.
This error is only on my 64-bit build (gcc-4.8.0 or gcc-4.8.1)

Regards,
Alexey.
--
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Runtime for Cygwin

2013-06-05 Thread Kai Tietz
2013/6/5 dw :
>
>> When using latest mingw-w64 runtime from trunk for Cygwin I have
>> error: http://pastebin.com/9WVgE1Gu
>
> I would like to experiment with some alternate solutions to what ktietz
> proposed, but I need to be sure I understand what is going wrong.
>
> My attempts to reproduce the problem have not been successful.  Can you
> produce a small sample?
>
> dw

Hi dw,

this difference here is in signature.  So we should try to keep
signatures equivalent to its prototypes.  Not sure what makes on
cygwin really the difference (I guess SIZE_T might be something else
as size_t or something like due they use LP64 instead of LLP64), but
in general we should keep signatures for C++'s sake compatible.

Kai

--
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Runtime for Cygwin

2013-06-05 Thread dw
Ok, I get it now.  As everyone was trying to tell me (including myself), 
the problem was in SIZE_T/size_t.  I just couldn't get my head around 
the fact that these two lines are different:


typedef unsigned long int size_t;
typedef unsigned long long SIZE_T;

Under CygWin64, they are both 8 bytes long, unsigned integers, but the 
compiler still treats them as different types (thanks to jon_y for 
finally pounding this home).


So, the question now is, which one should we be using for __stos*? Even 
before I began my work on the asm stuff, winnt.h was using SIZE_T and 
the files in the instrincs folder were using size_t (for example check 
out __movsw.c which still does this).  As ktietz says, we should keep 
signatures compatible.  So let's pick one and use it in all 3 places 
(winnt.h, intrin-mac.h & intrinsics\*.c).


I believe that the most correct definition for __stosb is the one from 
MS 
, 
which looks like this:


void __stosb(unsigned char* Dest, unsigned char Data, size_t Count);

As it happens, this is what intrin-mac.h and intrinsics\__stos*.c are 
already using.  The only thing I think needs changing is winnt.h.  My 
proposed patch is attached.


*Note that I am fudging a bit on __stosd, which MS declares as "unsigned 
long."  I'm pretty sure this isn't what we want in gcc, so I've changed 
this to unsigned int.


dw
Index: mingw-w64-crt/intrincs/__stosd.c
===
--- mingw-w64-crt/intrincs/__stosd.c(revision 5877)
+++ mingw-w64-crt/intrincs/__stosd.c(working copy)
@@ -1,4 +1,4 @@
 #include 
 #include 
 
-__buildstos(__stosd, unsigned __LONG32)
+__buildstos(__stosd, unsigned int)
Index: mingw-w64-headers/crt/intrin.h
===
--- mingw-w64-headers/crt/intrin.h  (revision 5877)
+++ mingw-w64-headers/crt/intrin.h  (working copy)
@@ -1031,7 +1031,7 @@
 __MACHINEX64(__MINGW_EXTENSION void _mm_stream_si64x(__int64 *,__int64))
 __MACHINEI(void __stosb(unsigned char *,unsigned char,size_t))
 __MACHINEI(void __stosw(unsigned short *,unsigned short,size_t))
-__MACHINEI(void __stosd(unsigned __LONG32 *,unsigned __LONG32,size_t))
+__MACHINEI(void __stosd(unsigned int *,unsigned int,size_t))
 __MACHINEX64(__MINGW_EXTENSION void __stosq(unsigned __int64 *,unsigned 
__int64,size_t))
 __MACHINEIW64(unsigned char _bittest(__LONG32 const *a,__LONG32 b))
 __MACHINEIW64(unsigned char _bittestandset(__LONG32 *a,__LONG32 b))
Index: mingw-w64-headers/include/winnt.h
===
--- mingw-w64-headers/include/winnt.h   (revision 5877)
+++ mingw-w64-headers/include/winnt.h   (working copy)
@@ -1536,16 +1536,16 @@
 VOID __movsw(PWORD Destination,WORD const *Source,SIZE_T Count);
 VOID __movsd(PDWORD Destination,DWORD const *Source,SIZE_T Count);
 VOID __movsq(PDWORD64 Destination,DWORD64 const *Source,SIZE_T Count);
-VOID __stosb(PBYTE Destination,BYTE Value,SIZE_T Count);
-VOID __stosw(PWORD Destination,WORD Value,SIZE_T Count);
-VOID __stosd(PDWORD Destination,DWORD Value,SIZE_T Count);
-VOID __stosq(PDWORD64 Destination,DWORD64 Value,SIZE_T Count);
+void __stosb(unsigned char *Destination, unsigned char Value, size_t 
Count);
+void __stosw(unsigned short *Destination, unsigned short Value, size_t 
Count);
+void __stosd(unsigned int *Destination, unsigned int Value, size_t Count);
+void __stosq(unsigned __int64 *Destination, unsigned __int64 Value, size_t 
Count);
 
 #ifndef __CRT__NO_INLINE
-__CRT_INLINE __buildstos(__stosb, BYTE)
-__CRT_INLINE __buildstos(__stosw, WORD)
-__CRT_INLINE __buildstos(__stosd, DWORD)
-__CRT_INLINE __buildstos(__stosq, DWORD64)
+__CRT_INLINE __buildstos(__stosb, unsigned char)
+__CRT_INLINE __buildstos(__stosw, unsigned short)
+__CRT_INLINE __buildstos(__stosd, unsigned int)
+__CRT_INLINE __buildstos(__stosq, unsigned __int64)
 #endif /* __CRT__NO_INLINE */
 
 #define MultiplyHigh __mulh
--
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Runtime for Cygwin

2013-06-05 Thread Kai Tietz
No, this patch isn't ok.  The type size_t isn't adequate for
platform-headers.  AFAI researched prototype in platform-header is
using SIZE_T.
The existing prototypes have to remain in winnt.h header.  The
prototype of the inline-function has to match the signature of the
existing and valid prototype.

Kai

--
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Runtime for Cygwin

2013-06-05 Thread dw

> AFAI researched prototype in platform-header is using SIZE_T.
The question is, which header do you want to be consistent with? Even 
files within the PSDK don't agree.

 From the platform sdk winnt.h we see:

VOID
__stosb (
 __out_ecount_full(Count) PBYTE  Destination,
 __in BYTE  Value,
 __in SIZE_T Count
 );

And from the platform sdk intrin.h we see:

__MACHINEI(void __stosb(unsigned char *, unsigned char, size_t))

And for good measure, in the MSVC runtime, we see

VC\crt\src\intrin.h:__MACHINEI(void __stosb(unsigned char *, unsigned 
char, size_t))

Unfortunately, MS can get away with mixing SIZE_T with size_t, since 
they don't change the size of their ints.

But if you feel strongly, I suppose we can change everything to SIZE_T.  
This will make use compatible with the PSDK, but incompatible with the CRT.

dw

--
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Runtime for Cygwin

2013-06-05 Thread Kai Tietz
2013/6/6 dw :
>
>> AFAI researched prototype in platform-header is using SIZE_T.
> The question is, which header do you want to be consistent with? Even
> files within the PSDK don't agree.
>
>  From the platform sdk winnt.h we see:
>
> VOID
> __stosb (
>  __out_ecount_full(Count) PBYTE  Destination,
>  __in BYTE  Value,
>  __in SIZE_T Count
>  );
>
> And from the platform sdk intrin.h we see:
>
> __MACHINEI(void __stosb(unsigned char *, unsigned char, size_t))
>
> And for good measure, in the MSVC runtime, we see
>
> VC\crt\src\intrin.h:__MACHINEI(void __stosb(unsigned char *, unsigned
> char, size_t))
>
> Unfortunately, MS can get away with mixing SIZE_T with size_t, since
> they don't change the size of their ints.
>
> But if you feel strongly, I suppose we can change everything to SIZE_T.
> This will make use compatible with the PSDK, but incompatible with the CRT.
>
> dw

You miss the point, why intrin.h header can use size_t here even for
mingw-w64.  The point is that LP64 target provides type size_t proper
for its ABI.  Same we do for mingw case.  The intrin.h header is a
C-runtime header and due this header additional makes sure we have
C-linkage, we have no issues about signatures here.
Later is btw the cause why implementation in .c can use size_t
instead, due it uses C and therefore has no special signatures, too.
So signature of inline-function has to be same as for its prototype.
For C++ signatures have to be same, as otherwise C++ will see it as
two different functions.  One with C-linkage, and one with C++'s.
As the shared prototype for those functions are coming from winnt.h
header, therefore functions are belonging to platform-header.

Kai

--
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Runtime for Cygwin

2013-06-06 Thread dw



You miss the point,

Umm, ok.

So, the end result here is that winnt.h should use SIZE_T, and intrin.h 
should use size_t.  Something like this (attached)?


dw
Index: mingw-w64-crt/intrincs/__stosb.c
===
--- mingw-w64-crt/intrincs/__stosb.c(revision 5883)
+++ mingw-w64-crt/intrincs/__stosb.c(working copy)
@@ -1,4 +1,4 @@
 #include 
 #include 
 
-__buildstos(__stosb, unsigned char)
+__buildstos(__stosb, unsigned char, size_t)
Index: mingw-w64-crt/intrincs/__stosd.c
===
--- mingw-w64-crt/intrincs/__stosd.c(revision 5883)
+++ mingw-w64-crt/intrincs/__stosd.c(working copy)
@@ -1,4 +1,4 @@
 #include 
 #include 
 
-__buildstos(__stosd, unsigned __LONG32)
+__buildstos(__stosd, unsigned int, size_t)
Index: mingw-w64-crt/intrincs/__stosq.c
===
--- mingw-w64-crt/intrincs/__stosq.c(revision 5883)
+++ mingw-w64-crt/intrincs/__stosq.c(working copy)
@@ -1,4 +1,4 @@
 #include 
 #include 
 
-__buildstos(__stosq, unsigned __int64)
+__buildstos(__stosq, unsigned __int64, size_t)
Index: mingw-w64-crt/intrincs/__stosw.c
===
--- mingw-w64-crt/intrincs/__stosw.c(revision 5883)
+++ mingw-w64-crt/intrincs/__stosw.c(working copy)
@@ -1,4 +1,4 @@
 #include 
 #include 
 
-__buildstos(__stosw, unsigned short)
+__buildstos(__stosw, unsigned short, size_t)
Index: mingw-w64-headers/crt/intrin.h
===
--- mingw-w64-headers/crt/intrin.h  (revision 5883)
+++ mingw-w64-headers/crt/intrin.h  (working copy)
@@ -1031,7 +1031,7 @@
 __MACHINEX64(__MINGW_EXTENSION void _mm_stream_si64x(__int64 *,__int64))
 __MACHINEI(void __stosb(unsigned char *,unsigned char,size_t))
 __MACHINEI(void __stosw(unsigned short *,unsigned short,size_t))
-__MACHINEI(void __stosd(unsigned __LONG32 *,unsigned __LONG32,size_t))
+__MACHINEI(void __stosd(unsigned int *,unsigned int,size_t))
 __MACHINEX64(__MINGW_EXTENSION void __stosq(unsigned __int64 *,unsigned 
__int64,size_t))
 __MACHINEIW64(unsigned char _bittest(__LONG32 const *a,__LONG32 b))
 __MACHINEIW64(unsigned char _bittestandset(__LONG32 *a,__LONG32 b))
Index: mingw-w64-headers/include/psdk_inc/intrin-mac.h
===
--- mingw-w64-headers/include/psdk_inc/intrin-mac.h (revision 5883)
+++ mingw-w64-headers/include/psdk_inc/intrin-mac.h (working copy)
@@ -11,11 +11,12 @@
 
 /* This macro is used by __stosb, __stosw, __stosd, __stosq */
 
-/* Parameters: (FunctionName, DataType, Operator)
+/* Parameters: (FunctionName, DataType, Operator, size)
FunctionName: Any valid function name
-   DataType: BYTE, WORD, DWORD or DWORD64 */
+   DataType: BYTE, WORD, DWORD or DWORD64 
+   size: One of either SIZE_T or size_t */
 
-#define __buildstos(x, y) void x(y *Dest, y Data, size_t Count) \
+#define __buildstos(x, y, t1) void x(y *Dest, y Data, t1 Count) \
 { \
__asm__ __volatile__ ("rep stos%z[Data]" \
   :  /* no outputs */ \
Index: mingw-w64-headers/include/winnt.h
===
--- mingw-w64-headers/include/winnt.h   (revision 5883)
+++ mingw-w64-headers/include/winnt.h   (working copy)
@@ -1536,16 +1536,16 @@
 VOID __movsw(PWORD Destination,WORD const *Source,SIZE_T Count);
 VOID __movsd(PDWORD Destination,DWORD const *Source,SIZE_T Count);
 VOID __movsq(PDWORD64 Destination,DWORD64 const *Source,SIZE_T Count);
-VOID __stosb(PBYTE Destination,BYTE Value,SIZE_T Count);
-VOID __stosw(PWORD Destination,WORD Value,SIZE_T Count);
-VOID __stosd(PDWORD Destination,DWORD Value,SIZE_T Count);
-VOID __stosq(PDWORD64 Destination,DWORD64 Value,SIZE_T Count);
+void __stosb(unsigned char *Destination, unsigned char Value, SIZE_T 
Count);
+void __stosw(unsigned short *Destination, unsigned short Value, SIZE_T 
Count);
+void __stosd(unsigned int *Destination, unsigned int Value, SIZE_T Count);
+void __stosq(unsigned __int64 *Destination, unsigned __int64 Value, SIZE_T 
Count);
 
 #ifndef __CRT__NO_INLINE
-__CRT_INLINE __buildstos(__stosb, BYTE)
-__CRT_INLINE __buildstos(__stosw, WORD)
-__CRT_INLINE __buildstos(__stosd, DWORD)
-__CRT_INLINE __buildstos(__stosq, DWORD64)
+__CRT_INLINE __buildstos(__stosb, unsigned char, SIZE_T)
+__CRT_INLINE __buildstos(__stosw, unsigned short, SIZE_T)
+__CRT_INLINE __buildstos(__stosd, unsigned int, SIZE_T)
+__CRT_INLINE __buildstos(__stosq, unsigned __int64, SIZE_T)
 #endif /* __CRT__NO_INLINE */
 
 #define MultiplyHigh __mulh
--
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards t

Re: [Mingw-w64-public] Runtime for Cygwin

2013-06-07 Thread Kai Tietz
2013/6/7 dw :
>
>> You miss the point,
>
> Umm, ok.
>
> So, the end result here is that winnt.h should use SIZE_T, and intrin.h
> should use size_t.  Something like this (attached)?

Near, but not exactly what I wrote.  Please keep signature in
platform-headers as they are in prototypes.
There is no reason to modify it here, and I don't see either a reason
to modify intrin.h prototype either.

> dw

Kai

--
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Runtime for Cygwin

2013-06-11 Thread dw

Please keep signature in platform-headers as they are in prototypes.


I'm trying to understand exactly what the requirement is here. You've 
been doing this kind of work for a long time, so if you say there's a 
reason to do this I expect there is.


As I look at your patch (or my second one), I see these downsides:

 * Using different definitions between winnt.h and intrin.h is going to
   continue to cause conflicts.  While your patch resolves the problem
   of winnt.h conflicting with itself, trying to #include both files
   will still cause errors.
 * I'm uncertain about which definition to put in __stosb.c. Both
   prototypes are implemented in the same .c file.  So, use the
   definition from winnt.h?  Or intrin.h?  If they are not virtually
   identical, the linker won't find it.  If they must be identical, why
   have 2?
 * We are adding complexity to the macro.  This makes maintenance harder.

On the plus side I see:

 * The prototype in winnt.h still looks like MS's.


Near, but not exactly what I wrote.


I know they aren't.  But there are downsides to this solution. Indeed to 
every solution that isn't "use the exact same definition for this 
function everywhere (ie my first proposed patch)."


That fact that you continue to push for keeping them different confuses 
me.  I assume that's because you know something I don't. Help me understand.


> I don't see either a reason to modify intrin.h prototype either.

I made the change to intrin.h as a result of the (somewhat bewildering) 
fact that __LONG32 isn't always 32bits.  I'm sure there's a good reason 
for this, but I believe __stosd should always work 4 bytes at a time.


dw
--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Runtime for Cygwin

2013-06-11 Thread dw
Sorry.  Looking back, you did try to describe some of the issues. 
However, this hasn't helped clear things up.  The problems are still 
essentially what the email I just sent said:

> The point is that LP64 target provides type size_t proper for its ABI.

Yes it does.  However, winnt.h still causes compile errors when used 
with intrin.h.  There should be no reason you can't use intrinsics at 
the same time you are using the platform files.

> makes sure we have C-linkage, we have no issues about signatures here.

But we do if you include both files.

> instead, due it uses C and therefore has no special signatures, too.

Both winnt.h and intrin.h use extern "C".

 > For C++ signatures have to be same, as otherwise C++ will see it as 
two different functions.

Since the prototypes in both files are marked as extern "C", I don't see 
how this applies.

I'm sorry, but I still just see conflicts.

dw

--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public