[PATCH] Cygwin: remove most occurrences of __stdcall, WINAPI, and, __cdecl

Takashi Yano takashi.yano@nifty.ne.jp
Tue Jun 7 16:49:16 GMT 2022


On Mon, 6 Jun 2022 12:24:15 -0400
Ken Brown wrote:
> On 6/5/2022 4:24 PM, Jon Turney wrote:
> > On 03/06/2022 15:00, Ken Brown wrote:
> >> remove most occurrences of __stdcall, WINAPI, and __cdecl
> >>
> >> These have no effect on x86_64.  Retain only a few occurrences of
> >> __cdecl in files imported from other sources.
> > 
> > While you are correct that it has no effect on x86_64, I'd incline towards 
> > retaining WINAPI on Windows API functions, because it's part of the function 
> > signature.  But other people might have other opinions on that...
> 
> I ended up retaining all occurrences of WINAPI.  Those that don't directly occur 
> in Windows API functions are mostly used for thread functions passed to 
> CreateThread, and the latter expects a WINAPI function.

_dll_crt0() is declared as
extern void __stdcall _dll_crt0 ()
  __declspec (dllimport) __attribute__ ((noreturn));
in winsup/cygwin/lib/cygwin_crt0.c, however, this patch
removes __stdcall from winsup.h and dcrt0.cc as follows.

diff --git b/winsup/cygwin/dcrt0.cc a/winsup/cygwin/dcrt0.cc
index 0d6c1c3b9..71215ace6 100644
--- b/winsup/cygwin/dcrt0.cc
+++ a/winsup/cygwin/dcrt0.cc
@@ -1013,7 +1013,7 @@ __cygwin_exit_return:			\n\
 ");
 }
 
-extern "C" void __stdcall
+extern "C" void
 _dll_crt0 ()
 {
 #ifdef __x86_64__
diff --git b/winsup/cygwin/winsup.h a/winsup/cygwin/winsup.h
index 9d204434b..8774f3bec 100644
--- b/winsup/cygwin/winsup.h
+++ a/winsup/cygwin/winsup.h
@@ -147,7 +147,7 @@ extern int cygserver_running;
 class per_process;
 /* cygwin .dll initialization */
 void dll_crt0 (per_process *) __asm__ (_SYMSTR (dll_crt0__FP11per_process));
-extern "C" void __stdcall _dll_crt0 ();
+extern "C" void _dll_crt0 ();
 void dll_crt0_1 (void *);
 void dll_dllcrt0_1 (void *);
 
To be consistent these, shouldn't _dll_crt0() retain __stdcall?

Changing cygwin_crt0.c is a bit weird because it looks as if
it might affect binary compatibility, even if it really doesn't.

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>


More information about the Cygwin-patches mailing list