Git development
 help / color / mirror / Atom feed
* quick question about __stdcall at run-command.c mingw.c
@ 2009-08-16 23:19 Frank Li
  2009-08-17  0:03 ` [msysGit] " Pat Thoyts
  0 siblings, 1 reply; 6+ messages in thread
From: Frank Li @ 2009-08-16 23:19 UTC (permalink / raw)
  To: git, msysGit


I am tring to clear VC build patch.

I found __stdcall position break MSVC build.

static __stdcall unsigned run_thread(void *data)

MSVC require __stdcall should be between return type and function name.
like
static unsigned __stdcall run_thread(void *data)

I think msys gcc should support MSVC format.

Should I directly change to MSVC format or add _MSC_VER marcro like

#if defined(__MINGW32__)
static __stdcall unsigned run_thread(void *data)
#elif defined(_MSC_VER) /*MSVC must put __stdcall between return value
and function*/
static unsigned __stdcall run_thread(void *data)
#endif

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [msysGit] quick question about __stdcall at run-command.c mingw.c
  2009-08-16 23:19 quick question about __stdcall at run-command.c mingw.c Frank Li
@ 2009-08-17  0:03 ` Pat Thoyts
  2009-08-17  7:52   ` Johannes Sixt
  0 siblings, 1 reply; 6+ messages in thread
From: Pat Thoyts @ 2009-08-17  0:03 UTC (permalink / raw)
  To: Frank Li; +Cc: git, msysGit

2009/8/17 Frank Li <lznuaa@gmail.com>:
>
> I am tring to clear VC build patch.
>
> I found __stdcall position break MSVC build.
>
> static __stdcall unsigned run_thread(void *data)
>
> MSVC require __stdcall should be between return type and function name.
> like
> static unsigned __stdcall run_thread(void *data)
>
> I think msys gcc should support MSVC format.
>
> Should I directly change to MSVC format or add _MSC_VER marcro like
>
> #if defined(__MINGW32__)
> static __stdcall unsigned run_thread(void *data)
> #elif defined(_MSC_VER) /*MSVC must put __stdcall between return value
> and function*/
> static unsigned __stdcall run_thread(void *data)
> #endif

The win32 api prototype used for thread entry functions is declared as
a DWORD (WINAPI *LPTHREAD_START_ROUTINE)(LPVOID) type in the mingw
headers and WINAPI as #define WINAPI __stdcall. This is true for the
MSVC headers as well. So gcc and msvc are happy using the same
definition for such a function and just "static unsigned long WINAPI
run_thread(void *)" might well be sensible.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [msysGit] quick question about __stdcall at run-command.c mingw.c
  2009-08-17  0:03 ` [msysGit] " Pat Thoyts
@ 2009-08-17  7:52   ` Johannes Sixt
  2009-08-17  8:21     ` Johannes Schindelin
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Sixt @ 2009-08-17  7:52 UTC (permalink / raw)
  To: Pat Thoyts, Frank Li; +Cc: git, msysGit

Pat Thoyts schrieb:
> 2009/8/17 Frank Li <lznuaa@gmail.com>:
>> I am tring to clear VC build patch.
>>
>> I found __stdcall position break MSVC build.
>>
>> static __stdcall unsigned run_thread(void *data)
>>
>> MSVC require __stdcall should be between return type and function name.
>> like
>> static unsigned __stdcall run_thread(void *data)
>>
>> I think msys gcc should support MSVC format.
>>
>> Should I directly change to MSVC format or add _MSC_VER marcro like
>>
>> #if defined(__MINGW32__)
>> static __stdcall unsigned run_thread(void *data)
>> #elif defined(_MSC_VER) /*MSVC must put __stdcall between return value
>> and function*/
>> static unsigned __stdcall run_thread(void *data)
>> #endif
> 
> The win32 api prototype used for thread entry functions is declared as
> a DWORD (WINAPI *LPTHREAD_START_ROUTINE)(LPVOID) type in the mingw
> headers and WINAPI as #define WINAPI __stdcall. This is true for the
> MSVC headers as well. So gcc and msvc are happy using the same
> definition for such a function and just "static unsigned long WINAPI
> run_thread(void *)" might well be sensible.

Change the code to

	static unsigned __stdcall run_thread(void *data)

The documentation explictly says: "The routine at start_address passed to
_beginthreadex must use the __stdcall calling convention...". So __stdcall
it is.

-- Hannes

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [msysGit] quick question about __stdcall at run-command.c mingw.c
  2009-08-17  7:52   ` Johannes Sixt
@ 2009-08-17  8:21     ` Johannes Schindelin
  2009-08-17  8:43       ` Johannes Sixt
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Schindelin @ 2009-08-17  8:21 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Pat Thoyts, Frank Li, git, msysGit

Hi,

On Mon, 17 Aug 2009, Johannes Sixt wrote:

> Pat Thoyts schrieb:
> > 2009/8/17 Frank Li <lznuaa@gmail.com>:
> >> I am tring to clear VC build patch.
> >>
> >> I found __stdcall position break MSVC build.
> >>
> >> static __stdcall unsigned run_thread(void *data)
> >>
> >> MSVC require __stdcall should be between return type and function 
> >> name. like static unsigned __stdcall run_thread(void *data)
> >>
> >> I think msys gcc should support MSVC format.

I think that it does.

But it is _your_ duty to check.

> >> Should I directly change to MSVC format or add _MSC_VER marcro like
> >>
> >> #if defined(__MINGW32__)
> >> static __stdcall unsigned run_thread(void *data)
> >> #elif defined(_MSC_VER) /*MSVC must put __stdcall between return value
> >> and function*/
> >> static unsigned __stdcall run_thread(void *data)
> >> #endif

Noooo! NO _MSC_VER crap in mingw.c.  Really.  I am able to repeat that as 
often as you want me, but I'd prefer not to.

> > The win32 api prototype used for thread entry functions is declared as
> > a DWORD (WINAPI *LPTHREAD_START_ROUTINE)(LPVOID) type in the mingw
> > headers and WINAPI as #define WINAPI __stdcall. This is true for the
> > MSVC headers as well. So gcc and msvc are happy using the same
> > definition for such a function and just "static unsigned long WINAPI
> > run_thread(void *)" might well be sensible.
> 
> Change the code to
> 
> 	static unsigned __stdcall run_thread(void *data)
> 
> The documentation explictly says: "The routine at start_address passed to
> _beginthreadex must use the __stdcall calling convention...". So __stdcall
> it is.

I could not agree more.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [msysGit] quick question about __stdcall at run-command.c mingw.c
  2009-08-17  8:21     ` Johannes Schindelin
@ 2009-08-17  8:43       ` Johannes Sixt
  2009-08-17  9:12         ` Johannes Schindelin
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Sixt @ 2009-08-17  8:43 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Pat Thoyts, Frank Li, git, msysGit

Johannes Schindelin schrieb:
> On Mon, 17 Aug 2009, Johannes Sixt wrote:
>> Pat Thoyts schrieb:
>>> 2009/8/17 Frank Li <lznuaa@gmail.com>:
>>>> I am tring to clear VC build patch.
>>>>
>>>> I found __stdcall position break MSVC build.
>>>>
>>>> static __stdcall unsigned run_thread(void *data)
>>>>
>>>> MSVC require __stdcall should be between return type and function 
>>>> name. like static unsigned __stdcall run_thread(void *data)
>>>>
>>>> I think msys gcc should support MSVC format.
> 
> I think that it does.
> 
> But it is _your_ duty to check.

Cool down. Asking for "please could you check whether this works" *if* you
don't have the infrastructure to test it yourself is certainly dutyful enough.

Do you have an Irix, Solaris, HP box on your desk next to your Linux, so
that you don't have to ask others to test your patches?

-- Hannes

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [msysGit] quick question about __stdcall at run-command.c mingw.c
  2009-08-17  8:43       ` Johannes Sixt
@ 2009-08-17  9:12         ` Johannes Schindelin
  0 siblings, 0 replies; 6+ messages in thread
From: Johannes Schindelin @ 2009-08-17  9:12 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Pat Thoyts, Frank Li, git, msysGit

Hi,

On Mon, 17 Aug 2009, Johannes Sixt wrote:

> Johannes Schindelin schrieb:
> > On Mon, 17 Aug 2009, Johannes Sixt wrote:
> >> Pat Thoyts schrieb:
> >>> 2009/8/17 Frank Li <lznuaa@gmail.com>:
> >>>> I am tring to clear VC build patch.
> >>>>
> >>>> I found __stdcall position break MSVC build.
> >>>>
> >>>> static __stdcall unsigned run_thread(void *data)
> >>>>
> >>>> MSVC require __stdcall should be between return type and function 
> >>>> name. like static unsigned __stdcall run_thread(void *data)
> >>>>
> >>>> I think msys gcc should support MSVC format.
> > 
> > I think that it does.
> > 
> > But it is _your_ duty to check.
> 
> Cool down. Asking for "please could you check whether this works" *if* 
> you don't have the infrastructure to test it yourself is certainly 
> dutyful enough.
> 
> Do you have an Irix, Solaris, HP box on your desk next to your Linux, so 
> that you don't have to ask others to test your patches?

This is Windows.  Frank has Windows.

Downloading msysGit does not incur any cost.  Actually running the whole 
thing from the net installer just takes a little time and a two-digit 
megabyte download.

I put a lot of work into making this procedure as painless to use (for 
other people, it caused me a lot of pain).  So Frank might just as well 
not let my effort go to hell.

Of course, Frank could ask one of the few msysGit contributors to try to 
compile something he prepared, wait for the results and possibly fix 
things for another round.  This appears as a rather poor use of 
everybody's time, methinks.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-08-17  9:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-16 23:19 quick question about __stdcall at run-command.c mingw.c Frank Li
2009-08-17  0:03 ` [msysGit] " Pat Thoyts
2009-08-17  7:52   ` Johannes Sixt
2009-08-17  8:21     ` Johannes Schindelin
2009-08-17  8:43       ` Johannes Sixt
2009-08-17  9:12         ` Johannes Schindelin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox