Re: [PATCH] Cygwin: remove most occurrences of __stdcall, WINAPI, and, __cdecl
On 6/7/2022 12:49 PM, Takashi Yano wrote: _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. [...] 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. Thanks for catching this. It was actually an accident that I didn't remove __stdcall from cygwin_crt0.c, but I agree that it's better to retain it in the other two places. I've fixed this. Ken
Re: [PATCH] Cygwin: remove most occurrences of __stdcall, WINAPI, and, __cdecl
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
Re: [PATCH] Cygwin: remove most occurrences of __stdcall, WINAPI, and, __cdecl
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. That sounds good to me. -- Takashi Yano
Re: [PATCH] Cygwin: remove most occurrences of __stdcall, WINAPI, and, __cdecl
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. Ken
Re: [PATCH] Cygwin: remove most occurrences of __stdcall, WINAPI, and, __cdecl
On 03/06/2022 15:00, Ken Brown wrote: --- a/winsup/utils/regtool.cc +++ b/winsup/utils/regtool.cc @@ -590,7 +590,7 @@ cmd_add () } extern "C" { - LONG WINAPI (*regDeleteKeyEx)(HKEY, LPCWSTR, REGSAM, DWORD); + LONG (*regDeleteKeyEx)(HKEY, LPCWSTR, REGSAM, DWORD); } int @@ -603,7 +603,7 @@ cmd_remove () { HMODULE mod = LoadLibrary ("advapi32.dll"); if (mod) - regDeleteKeyEx = (LONG WINAPI (*)(HKEY, LPCWSTR, REGSAM, DWORD)) GetProcAddress (mod, "RegDeleteKeyExW"); + regDeleteKeyEx = (LONG (*)(HKEY, LPCWSTR, REGSAM, DWORD)) GetProcAddress (mod, "RegDeleteKeyExW"); } if (regDeleteKeyEx) rv = (*regDeleteKeyEx) (key, value, wow64, 0); MSDN says RegDeleteKeyExW() is since Windows 2000, so I think this can all be dropped and just link with it directly instead? There may be other instances of that simplification which can happen in utils/ ? Later: This all seems strangely familiar... Oh, it appears I wrote this patch, and then forgot to apply it :( https://cygwin.com/pipermail/cygwin-patches/2022q1/011794.html
Re: [PATCH] Cygwin: remove most occurrences of __stdcall, WINAPI, and, __cdecl
On Sun, 5 Jun 2022 21:24:15 +0100 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 rather incline to Jon's opinion. -- Takashi Yano
Re: [PATCH] Cygwin: remove most occurrences of __stdcall, WINAPI, and, __cdecl
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 agree. I just mindlessly deleted all of them. I'll submit a revised patch. Ken
Re: [PATCH] Cygwin: remove most occurrences of __stdcall, WINAPI, and, __cdecl
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...
[PATCH] Cygwin: remove most occurrences of __stdcall, WINAPI, and, __cdecl
Patch attached.From f3e156ec3b22e426fc79138270f6e15c8156eb7b Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Sun, 29 May 2022 18:59:55 -0400 Subject: [PATCH] Cygwin: 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. --- winsup/cygserver/bsd_helper.cc| 2 +- winsup/cygserver/process.cc | 2 +- winsup/cygserver/threaded_queue.cc| 4 +- winsup/cygserver/threaded_queue.h | 4 +- winsup/cygserver/woutsup.h| 2 +- winsup/cygwin/advapi32.cc | 8 ++-- winsup/cygwin/aio.cc | 6 +-- winsup/cygwin/autoload.cc | 4 +- winsup/cygwin/child_info.h| 2 +- winsup/cygwin/clock.cc| 4 +- winsup/cygwin/cygerrno.h | 2 +- winsup/cygwin/cygheap.cc | 8 ++-- winsup/cygwin/cygheap.h | 4 +- winsup/cygwin/cygthread.cc| 4 +- winsup/cygwin/cygthread.h | 6 +-- winsup/cygwin/dcrt0.cc| 12 +++--- winsup/cygwin/debug.cc| 10 ++--- winsup/cygwin/dll_init.cc | 2 +- winsup/cygwin/dtable.cc | 2 +- winsup/cygwin/environ.cc | 6 +-- winsup/cygwin/exceptions.cc | 14 +++--- winsup/cygwin/fhandler.cc | 10 ++--- winsup/cygwin/fhandler.h | 52 +++ winsup/cygwin/fhandler_clipboard.cc | 2 +- winsup/cygwin/fhandler_console.cc | 12 +++--- winsup/cygwin/fhandler_disk_file.cc | 2 +- winsup/cygwin/fhandler_dsp.cc | 4 +- winsup/cygwin/fhandler_fifo.cc| 2 +- winsup/cygwin/fhandler_netdrive.cc| 2 +- winsup/cygwin/fhandler_procsys.cc | 2 +- winsup/cygwin/fhandler_random.cc | 2 +- winsup/cygwin/fhandler_signalfd.cc| 2 +- winsup/cygwin/fhandler_socket_unix.cc | 8 ++-- winsup/cygwin/fhandler_timerfd.cc | 2 +- winsup/cygwin/fhandler_tty.cc | 12 +++--- winsup/cygwin/fhandler_virtual.cc | 2 +- winsup/cygwin/fhandler_windows.cc | 2 +- winsup/cygwin/fhandler_zero.cc| 2 +- winsup/cygwin/flock.cc| 6 +-- winsup/cygwin/fork.cc | 10 ++--- winsup/cygwin/include/cygwin/cygwin_dll.h | 6 +-- winsup/cygwin/include/cygwin/time.h | 6 +-- winsup/cygwin/include/sys/ioctl.h | 2 +- winsup/cygwin/init.cc | 4 +- winsup/cygwin/kernel32.cc | 36 winsup/cygwin/ldap.cc | 6 +-- winsup/cygwin/lib/_cygwin_crt0_common.cc | 2 +- winsup/cygwin/lib/crt0.h | 2 +- winsup/cygwin/miscfuncs.cc| 10 ++--- winsup/cygwin/miscfuncs.h | 10 ++--- winsup/cygwin/mmap.cc | 2 +- winsup/cygwin/mount.cc| 4 +- winsup/cygwin/ntdll.h | 2 +- winsup/cygwin/ntea.cc | 4 +- winsup/cygwin/ntsecapi.h | 26 winsup/cygwin/pinfo.cc| 6 +-- winsup/cygwin/pinfo.h | 12 +++--- winsup/cygwin/posix_timer.cc | 2 +- winsup/cygwin/resource.cc | 4 +- winsup/cygwin/select.cc | 10 ++--- winsup/cygwin/shared.cc | 10 ++--- winsup/cygwin/shared_info.h | 10 ++--- winsup/cygwin/shm.cc | 2 +- winsup/cygwin/sigproc.cc | 6 +-- winsup/cygwin/sigproc.h | 2 +- winsup/cygwin/strace.cc | 2 +- winsup/cygwin/strfuncs.cc | 10 ++--- winsup/cygwin/string.h| 8 ++-- winsup/cygwin/thread.cc | 2 +- winsup/cygwin/thread.h| 2 +- winsup/cygwin/timerfd.cc | 2 +- winsup/cygwin/times.cc| 16 +++ winsup/cygwin/tty.cc | 4 +- winsup/cygwin/tty.h | 6 +-- winsup/cygwin/window.cc | 4 +- winsup/cygwin/wininfo.h | 2 +- winsup/cygwin/winlean.h | 2 +- winsup/cygwin/winsup.h| 20 - winsup/testsuite/winsup.api/cygload.cc| 4 +- winsup/testsuite/winsup.api/cygload.h | 2 +- winsup/utils/kill.cc | 2 +- winsup/utils/loadlib.h| 6 +-- winsup/utils/mingw/cygcheck.cc| 4 +- winsup/utils/mingw/strace.cc | 4 +- winsup/utils/profiler.cc | 4 +- winsup/utils/ps.cc| 2 +- winsup/utils/regtool.cc | 4 +- 87 files changed, 258 insertions(+), 284 deletions(-) delete mode 100644 winsup/cygwin