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

Ken Brown kbrown@cornell.edu
Fri Jun 3 14:00:19 GMT 2022


Patch attached.
-------------- next part --------------
From f3e156ec3b22e426fc79138270f6e15c8156eb7b Mon Sep 17 00:00:00 2001
From: Ken Brown <kbrown@cornell.edu>
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/ntsecapi.h

diff --git a/winsup/cygserver/bsd_helper.cc b/winsup/cygserver/bsd_helper.cc
index 38639647e..1e1ba09bb 100644
--- a/winsup/cygserver/bsd_helper.cc
+++ b/winsup/cygserver/bsd_helper.cc
@@ -111,7 +111,7 @@ ipc_p_vmspace (struct proc *proc)
   return ret;
 }
 
-static DWORD WINAPI
+static DWORD
 ipcexit_hookthread (const LPVOID param)
 {
   ipc_hookthread_storage *shs = (ipc_hookthread_storage *) param;
diff --git a/winsup/cygserver/process.cc b/winsup/cygserver/process.cc
index c26341470..03264d0d7 100644
--- a/winsup/cygserver/process.cc
+++ b/winsup/cygserver/process.cc
@@ -279,7 +279,7 @@ struct pcache_wait_t
   HANDLE *hdls;
 };
 
-static DWORD WINAPI
+static DWORD
 pcache_wait_thread (const LPVOID param)
 {
   pcache_wait_t *p = (pcache_wait_t *) param;
diff --git a/winsup/cygserver/threaded_queue.cc b/winsup/cygserver/threaded_queue.cc
index 72f2a5fdd..b030c8907 100644
--- a/winsup/cygserver/threaded_queue.cc
+++ b/winsup/cygserver/threaded_queue.cc
@@ -187,7 +187,7 @@ threaded_queue::add (queue_request *const therequest)
     }
 }
 
-/*static*/ DWORD WINAPI
+/*static*/ DWORD
 threaded_queue::start_routine (const LPVOID lpParam)
 {
   class threaded_queue *const queue = (class threaded_queue *) lpParam;
@@ -382,7 +382,7 @@ queue_submission_loop::stop ()
   return was_running;
 }
 
-/*static*/ DWORD WINAPI
+/*static*/ DWORD
 queue_submission_loop::start_routine (const LPVOID lpParam)
 {
   class queue_submission_loop *const submission_loop =
diff --git a/winsup/cygserver/threaded_queue.h b/winsup/cygserver/threaded_queue.h
index 44819d2fb..1c55be35f 100644
--- a/winsup/cygserver/threaded_queue.h
+++ b/winsup/cygserver/threaded_queue.h
@@ -60,7 +60,7 @@ private:
   CRITICAL_SECTION _queue_lock;
   HANDLE _requests_sem;		// == _requests_count
 
-  static DWORD WINAPI start_routine (LPVOID /* this */);
+  static DWORD start_routine (LPVOID /* this */);
 
   void create_workers (size_t initial_workers);
   void worker_loop ();
@@ -94,7 +94,7 @@ private:
   DWORD _tid;
   queue_submission_loop *_next;
 
-  static DWORD WINAPI start_routine (LPVOID /* this */);
+  static DWORD start_routine (LPVOID /* this */);
   virtual void request_loop () = 0;
 };
 
diff --git a/winsup/cygserver/woutsup.h b/winsup/cygserver/woutsup.h
index 7b799f156..3e87c4fca 100644
--- a/winsup/cygserver/woutsup.h
+++ b/winsup/cygserver/woutsup.h
@@ -30,7 +30,7 @@ details. */
 #include "bsd_mutex.h"
 
 /* The one function we use from winuser.h most of the time */
-extern "C" DWORD WINAPI GetLastError (void);
+extern "C" DWORD GetLastError (void);
 
 extern int cygserver_running;
 
diff --git a/winsup/cygwin/advapi32.cc b/winsup/cygwin/advapi32.cc
index 56c96c915..3769f2782 100644
--- a/winsup/cygwin/advapi32.cc
+++ b/winsup/cygwin/advapi32.cc
@@ -21,7 +21,7 @@ details. */
    is not easy to understand.  In all other case, use the ntdll.dll
    equivalent. */
 
-BOOL WINAPI
+BOOL
 RevertToSelf ()
 {
   HANDLE tok = NULL;
@@ -31,7 +31,7 @@ RevertToSelf ()
   DEFAULT_NTSTATUS_TO_BOOL_RETURN
 }
 
-BOOL WINAPI
+BOOL
 DuplicateTokenEx (HANDLE tok, DWORD access, LPSECURITY_ATTRIBUTES sec_attr,
 		  SECURITY_IMPERSONATION_LEVEL level, TOKEN_TYPE type,
 		  PHANDLE new_tok)
@@ -46,7 +46,7 @@ DuplicateTokenEx (HANDLE tok, DWORD access, LPSECURITY_ATTRIBUTES sec_attr,
   DEFAULT_NTSTATUS_TO_BOOL_RETURN
 }
 
-BOOL WINAPI
+BOOL
 ImpersonateLoggedOnUser (HANDLE tok)
 {
   NTSTATUS status;
@@ -86,7 +86,7 @@ ImpersonateLoggedOnUser (HANDLE tok)
   DEFAULT_NTSTATUS_TO_BOOL_RETURN
 }
 
-BOOL WINAPI
+BOOL
 ImpersonateNamedPipeClient (HANDLE pipe)
 {
   IO_STATUS_BLOCK io;
diff --git a/winsup/cygwin/aio.cc b/winsup/cygwin/aio.cc
index 4d1c2ee45..1c17aa7f6 100644
--- a/winsup/cygwin/aio.cc
+++ b/winsup/cygwin/aio.cc
@@ -200,7 +200,7 @@ aionotify (struct aiocb *aio)
     }
 }
 
-static DWORD WINAPI __attribute__ ((noreturn))
+static DWORD __attribute__ ((noreturn))
 aiowaiter (void *unused)
 { /* One instance, called on its own cygthread; runs until program exits */
   struct aiocb *aio;
@@ -327,7 +327,7 @@ asyncwrite (struct aiocb *aio)
 }
 
 /* Have to forward ref because of chicken v. egg situation */
-static DWORD WINAPI __attribute__ ((noreturn)) aioworker (void *);
+static DWORD __attribute__ ((noreturn)) aioworker (void *);
 
 static void
 aioinit (void)
@@ -400,7 +400,7 @@ aioqueue (struct aiocb *aio)
   return 0;
 }
 
-static DWORD WINAPI __attribute__ ((noreturn))
+static DWORD __attribute__ ((noreturn))
 aioworker (void *unused)
 { /* Multiple instances; called on own cygthreads; runs 'til program exits */
   struct aiocb *aio;
diff --git a/winsup/cygwin/autoload.cc b/winsup/cygwin/autoload.cc
index 668e64650..890a319db 100644
--- a/winsup/cygwin/autoload.cc
+++ b/winsup/cygwin/autoload.cc
@@ -362,10 +362,10 @@ wsock_init (struct func_info *func)
 
   if (!wsock_started)
     {
-      int __stdcall (*wsastartup) (int, WSADATA *);
+      int (*wsastartup) (int, WSADATA *);
 
       /* Don't use autoload to load WSAStartup to eliminate recursion. */
-      wsastartup = (int __stdcall (*)(int, WSADATA *))
+      wsastartup = (int (*)(int, WSADATA *))
 		   GetProcAddress ((HMODULE) (dll->handle), "WSAStartup");
       if (wsastartup)
 	{
diff --git a/winsup/cygwin/child_info.h b/winsup/cygwin/child_info.h
index 453339317..ba7ae0b6d 100644
--- a/winsup/cygwin/child_info.h
+++ b/winsup/cygwin/child_info.h
@@ -198,7 +198,7 @@ extern child_info_spawn ch_spawn;
 #define have_execed ch_spawn.has_execed ()
 #define have_execed_cygwin ch_spawn.has_execed_cygwin ()
 
-void __stdcall init_child_info (DWORD, child_info *, HANDLE);
+void init_child_info (DWORD, child_info *, HANDLE);
 
 extern "C" {
 extern child_info *child_proc_info;
diff --git a/winsup/cygwin/clock.cc b/winsup/cygwin/clock.cc
index e010ed488..1e2e9ef04 100644
--- a/winsup/cygwin/clock.cc
+++ b/winsup/cygwin/clock.cc
@@ -142,8 +142,8 @@ clk_thread_t::now (clockid_t clockid, struct timespec *ts)
   return 0;
 }
 
-extern "C" void WINAPI QueryUnbiasedInterruptTimePrecise (PULONGLONG);
-extern "C" void WINAPI QueryInterruptTimePrecise (PULONGLONG);
+extern "C" void QueryUnbiasedInterruptTimePrecise (PULONGLONG);
+extern "C" void QueryInterruptTimePrecise (PULONGLONG);
 
 int
 clk_monotonic_t::now (clockid_t clockid, struct timespec *ts)
diff --git a/winsup/cygwin/cygerrno.h b/winsup/cygwin/cygerrno.h
index b982bc27d..940bfa5e0 100644
--- a/winsup/cygwin/cygerrno.h
+++ b/winsup/cygwin/cygerrno.h
@@ -45,7 +45,7 @@ void __set_winsock_errno (const char *fn, int ln);
 #define set_winsock_errno() __set_winsock_errno (__FUNCTION__, __LINE__)
 
 #define get_errno()  (errno)
-extern "C" void __stdcall set_sig_errno (int e);
+extern "C" void set_sig_errno (int e);
 
 class save_errno
   {
diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc
index e05bfbc48..65f95c924 100644
--- a/winsup/cygwin/cygheap.cc
+++ b/winsup/cygwin/cygheap.cc
@@ -69,11 +69,11 @@ static NO_COPY uint32_t nthreads;
 
 extern "C" {
 static void _cfree (void *);
-static void *__stdcall _csbrk (int);
+static void *_csbrk (int);
 }
 
 /* Called by fork or spawn to reallocate cygwin heap */
-void __stdcall
+void
 cygheap_fixup_in_child (bool execed)
 {
   cygheap_max = cygheap = (init_cygheap *) _cygheap_start;
@@ -239,7 +239,7 @@ init_cygheap::init_installation_root ()
     }
 }
 
-void __stdcall
+void
 cygheap_init ()
 {
   cygheap_protect.init ("cygheap_protect");
@@ -293,7 +293,7 @@ setup_cygheap ()
 #define somekinda_printf malloc_printf
 #endif
 
-static void *__stdcall
+static void *
 _csbrk (int sbs)
 {
   void *prebrk = cygheap_max;
diff --git a/winsup/cygwin/cygheap.h b/winsup/cygwin/cygheap.h
index 528c61ed6..7f36c5837 100644
--- a/winsup/cygwin/cygheap.h
+++ b/winsup/cygwin/cygheap.h
@@ -719,7 +719,7 @@ class cygheap_fdenum : public cygheap_fdmanip
   }
 };
 
-void __stdcall cygheap_fixup_in_child (bool);
-void __stdcall cygheap_init ();
+void cygheap_fixup_in_child (bool);
+void cygheap_init ();
 void setup_cygheap ();
 extern char _cygheap_start[] __attribute__((section(".idata")));
diff --git a/winsup/cygwin/cygthread.cc b/winsup/cygwin/cygthread.cc
index 66a317934..54918e767 100644
--- a/winsup/cygwin/cygthread.cc
+++ b/winsup/cygwin/cygthread.cc
@@ -52,7 +52,7 @@ cygthread::callfunc (bool issimplestub)
 /* Initial stub called by cygthread constructor. Performs initial
    per-thread initialization and loops waiting for another thread function
    to execute.  */
-DWORD WINAPI
+DWORD
 cygthread::stub (VOID *arg)
 {
   cygthread *info = (cygthread *) arg;
@@ -122,7 +122,7 @@ cygthread::stub (VOID *arg)
 
 /* Overflow stub called by cygthread constructor. Calls specified function
    and then exits the thread.  */
-DWORD WINAPI
+DWORD
 cygthread::simplestub (VOID *arg)
 {
   cygthread *info = (cygthread *) arg;
diff --git a/winsup/cygwin/cygthread.h b/winsup/cygwin/cygthread.h
index ed57c9301..241180f2b 100644
--- a/winsup/cygwin/cygthread.h
+++ b/winsup/cygwin/cygthread.h
@@ -7,7 +7,7 @@ details. */
 #ifndef _CYGTHREAD_H
 #define _CYGTHREAD_H
 
-typedef void WINAPI (*LPVOID_THREAD_START_ROUTINE) (void *) __attribute__((noreturn));		// Input queue thread
+typedef void (*LPVOID_THREAD_START_ROUTINE) (void *) __attribute__((noreturn));		// Input queue thread
 
 class cygthread
 {
@@ -32,8 +32,8 @@ class cygthread
   static void CALLBACK async_create (ULONG_PTR);
  public:
   bool terminate_thread ();
-  static DWORD WINAPI stub (VOID *);
-  static DWORD WINAPI simplestub (VOID *);
+  static DWORD stub (VOID *);
+  static DWORD simplestub (VOID *);
   static DWORD main_thread_id;
   static const char *name (DWORD = 0);
   void callfunc (bool) __attribute__ ((noinline, ));
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index 9cc436cda..c460e15a0 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -61,7 +61,7 @@ do_global_dtors ()
     }
 }
 
-static void __stdcall
+static void
 do_global_ctors (void (**in_pfunc)(), int force)
 {
   if (!force && in_forkee)
@@ -84,7 +84,7 @@ do_global_ctors (void (**in_pfunc)(), int force)
  * A \@file is replaced with @file so that echo \@foo would print
  * @foo and not the contents of foo.
  */
-static bool __stdcall
+static bool
 insert_file (char *name, char *&cmd)
 {
   HANDLE f;
@@ -203,7 +203,7 @@ quoted (char *cmd, int winshell)
 			    && isalpha ((s)[2]) \
 			    && strchr ((s) + 3, '\\')))
 
-static int __stdcall
+static int
 globify (char *word, char **&argv, int &argc, int &argvlen)
 {
   if (*word != '~' && strpbrk (word, "?*[\"\'(){}") == NULL)
@@ -290,7 +290,7 @@ globify (char *word, char **&argv, int &argc, int &argvlen)
 
 /* Build argv, argc from string passed from Windows.  */
 
-static void __stdcall
+static void
 build_argv (char *cmd, char **&argv, int &argc, int winshell)
 {
   int argvlen = 0;
@@ -365,7 +365,7 @@ build_argv (char *cmd, char **&argv, int &argc, int winshell)
 }
 
 /* sanity and sync check */
-void __stdcall
+void
 check_sanity_and_sync (per_process *p)
 {
   /* Sanity check to make sure developers didn't change the per_process    */
@@ -1013,7 +1013,7 @@ __cygwin_exit_return:			\n\
 ");
 }
 
-extern "C" void __stdcall
+extern "C" void
 _dll_crt0 ()
 {
   /* Starting with Windows 10 rel 1511, the main stack of an application is
diff --git a/winsup/cygwin/debug.cc b/winsup/cygwin/debug.cc
index f21a8c518..efa101ba7 100644
--- a/winsup/cygwin/debug.cc
+++ b/winsup/cygwin/debug.cc
@@ -38,7 +38,7 @@ class lock_debug
 
 muto NO_COPY lock_debug::locker;
 
-static bool __stdcall mark_closed (const char *, int, HANDLE, const char *, bool);
+static bool mark_closed (const char *, int, HANDLE, const char *, bool);
 
 void
 debug_init ()
@@ -47,7 +47,7 @@ debug_init ()
 }
 
 /* Find a registered handle in the linked list of handles. */
-static handle_list * __stdcall
+static handle_list *
 find_handle (HANDLE h)
 {
   handle_list *hl;
@@ -87,7 +87,7 @@ setclexec (HANDLE oh, HANDLE nh, bool not_inheriting)
 }
 
 /* Create a new handle record */
-static handle_list * __stdcall
+static handle_list *
 newh ()
 {
   handle_list *hl;
@@ -155,7 +155,7 @@ add_handle (const char *func, int ln, HANDLE h, const char *name, bool inh)
   debug_printf ("protecting handle '%s'(%p), inherited flag %d", hl->name, hl->h, hl->inherited);
 }
 
-static void __stdcall
+static void
 delete_handle (handle_list *hl)
 {
   handle_list *hnuke = hl->next;
@@ -176,7 +176,7 @@ debug_fixup_after_fork_exec ()
       delete_handle (hl);	// removes hl->next
 }
 
-static bool __stdcall
+static bool
 mark_closed (const char *func, int ln, HANDLE h, const char *name, bool force)
 {
   handle_list *hl;
diff --git a/winsup/cygwin/dll_init.cc b/winsup/cygwin/dll_init.cc
index 649af1153..b486eaa1f 100644
--- a/winsup/cygwin/dll_init.cc
+++ b/winsup/cygwin/dll_init.cc
@@ -25,7 +25,7 @@ details. */
 #include <assert.h>
 #include <tls_pbuf.h>
 
-extern void __stdcall check_sanity_and_sync (per_process *);
+extern void check_sanity_and_sync (per_process *);
 
 #define fabort fork_info->abort
 
diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc
index 474c470a6..6b2394814 100644
--- a/winsup/cygwin/dtable.cc
+++ b/winsup/cygwin/dtable.cc
@@ -58,7 +58,7 @@ dtable_init ()
     cygheap->fdtab.extend (NOFILE_INCR, 0);
 }
 
-void __stdcall
+void
 set_std_handle (int fd)
 {
   fhandler_base *fh = cygheap->fdtab[fd];
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index ab593ab64..ca60bd8d4 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -169,7 +169,7 @@ strbrk(char *&buf)
 
 /* Parse a string of the form "something=stuff somethingelse=more-stuff",
    silently ignoring unknown "somethings".  */
-static void __stdcall
+static void
 parse_options (const char *inbuf)
 {
   int istrue;
@@ -562,7 +562,7 @@ secure_getenv (const char *name)
 }
 
 /* Return number of environment entries, including terminating NULL. */
-static int __stdcall
+static int
 envsize (const char * const *in_envp)
 {
   const char * const *envp;
@@ -578,7 +578,7 @@ envsize (const char * const *in_envp)
 /* Takes similar arguments to setenv except that overwrite is
    either -1, 0, or 1.  0 or 1 signify that the function should
    perform similarly to setenv.  Otherwise putenv is assumed. */
-static int __stdcall
+static int
 _addenv (const char *name, const char *value, int overwrite)
 {
   int issetenv = overwrite >= 0;
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index b8d46504d..0297c0eb7 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -55,7 +55,7 @@ PWCHAR debugger_command;
 extern uint8_t _sigbe;
 extern uint8_t _sigdelayed_end;
 
-static BOOL WINAPI ctrl_c_handler (DWORD);
+static BOOL ctrl_c_handler (DWORD);
 
 static const struct
 {
@@ -528,7 +528,7 @@ exception::myfault (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in,
    TODO: What we do here is to handle only __try/__except blocks in Cygwin.
          "Normal" exceptions will simply exit the process.  Still, better
 	 than nothing... */
-LONG WINAPI
+LONG
 myfault_altstack_handler (EXCEPTION_POINTERS *exc)
 {
   _cygtls& me = _my_tls;
@@ -756,7 +756,7 @@ exception::handle (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in,
    attempts to block unblockable signals will be silently ignored.
    This is counter to what appears to be documented in some UNIX
    man pages, e.g. Linux.  */
-int __stdcall
+int
 handle_sigsuspend (sigset_t tempmask)
 {
   sigset_t oldmask = _my_tls.sigmask;	// Remember for restoration
@@ -868,7 +868,7 @@ _cygtls::interrupt_setup (siginfo_t& si, void *handler, struct sigaction& siga)
 		  signal_arrived, si.si_signo);
 }
 
-extern "C" void __stdcall
+extern "C" void
 set_sig_errno (int e)
 {
   *_my_tls.errno_addr = e;
@@ -976,7 +976,7 @@ has_visible_window_station ()
 }
 
 /* Keyboard interrupt handler.  */
-static BOOL WINAPI
+static BOOL
 ctrl_c_handler (DWORD type)
 {
   static bool saw_close;
@@ -1093,7 +1093,7 @@ ctrl_c_handler (DWORD type)
 }
 
 /* Function used by low level sig wrappers. */
-extern "C" void __stdcall
+extern "C" void
 set_process_mask (sigset_t newmask)
 {
   set_signal_mask (_my_tls.sigmask, newmask);
@@ -1207,7 +1207,7 @@ set_signal_mask (sigset_t& setmask, sigset_t newmask)
 }
 
 
-DWORD WINAPI
+DWORD
 dumpstack_overflow_wrapper (PVOID arg)
 {
   cygwin_exception *exc = (cygwin_exception *) arg;
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index 88507357b..5671fea3c 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -142,7 +142,7 @@ char *fhandler_base::get_proc_fd_name (char *buf)
 
 /* Detect if we are sitting at EOF for conditions where Windows
    returns an error but UNIX doesn't.  */
-int __stdcall
+int
 is_at_eof (HANDLE h)
 {
   IO_STATUS_BLOCK io;
@@ -871,7 +871,7 @@ out:
   debug_printf ("returning %d, %s mode", len, rbinary () ? "binary" : "text");
 }
 
-ssize_t __stdcall
+ssize_t
 fhandler_base::write (const void *ptr, size_t len)
 {
   ssize_t res;
@@ -967,7 +967,7 @@ fhandler_base::write (const void *ptr, size_t len)
   return res;
 }
 
-ssize_t __stdcall
+ssize_t
 fhandler_base::readv (const struct iovec *const iov, const int iovcnt,
 		      ssize_t tot)
 {
@@ -1024,7 +1024,7 @@ fhandler_base::readv (const struct iovec *const iov, const int iovcnt,
   return len;
 }
 
-ssize_t __stdcall
+ssize_t
 fhandler_base::writev (const struct iovec *const iov, const int iovcnt,
 		       ssize_t tot)
 {
@@ -1501,7 +1501,7 @@ fhandler_dev_null::fhandler_dev_null () :
 {
 }
 
-ssize_t __stdcall
+ssize_t
 fhandler_dev_null::write (const void *ptr, size_t len)
 {
   /* Shortcut.  This also fixes a problem with the NUL device on 64 bit:
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index a2a4ec150..dfad07f72 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -404,9 +404,9 @@ public:
   virtual int fcntl (int cmd, intptr_t);
   virtual char const *ttyname () { return get_name (); }
   virtual void read (void *ptr, size_t& len);
-  virtual ssize_t __stdcall write (const void *ptr, size_t len);
-  virtual ssize_t __stdcall readv (const struct iovec *, int iovcnt, ssize_t tot = -1);
-  virtual ssize_t __stdcall writev (const struct iovec *, int iovcnt, ssize_t tot = -1);
+  virtual ssize_t write (const void *ptr, size_t len);
+  virtual ssize_t readv (const struct iovec *, int iovcnt, ssize_t tot = -1);
+  virtual ssize_t writev (const struct iovec *, int iovcnt, ssize_t tot = -1);
   virtual ssize_t pread (void *, size_t, off_t, void *aio = NULL);
   virtual ssize_t pwrite (void *, size_t, off_t, void *aio = NULL);
   virtual off_t lseek (off_t offset, int whence);
@@ -593,14 +593,14 @@ class fhandler_socket: public fhandler_base
 			    struct sockaddr *from, int *fromlen) = 0;
   virtual ssize_t recvmsg (struct msghdr *msg, int flags) = 0;
   virtual void read (void *ptr, size_t& len) = 0;
-  virtual ssize_t __stdcall readv (const struct iovec *, int iovcnt,
+  virtual ssize_t readv (const struct iovec *, int iovcnt,
 				   ssize_t tot = -1) = 0;
 
   virtual ssize_t sendto (const void *ptr, size_t len, int flags,
 	      const struct sockaddr *to, int tolen) = 0;
   virtual ssize_t sendmsg (const struct msghdr *msg, int flags) = 0;
-  virtual ssize_t __stdcall write (const void *ptr, size_t len) = 0;
-  virtual ssize_t __stdcall writev (const struct iovec *, int iovcnt, ssize_t tot = -1) = 0;
+  virtual ssize_t write (const void *ptr, size_t len) = 0;
+  virtual ssize_t writev (const struct iovec *, int iovcnt, ssize_t tot = -1) = 0;
   virtual int setsockopt (int level, int optname, const void *optval,
 			  __socklen_t optlen) = 0;
   virtual int getsockopt (int level, int optname, const void *optval,
@@ -712,9 +712,9 @@ class fhandler_socket_wsock: public fhandler_socket
 		    struct sockaddr *from, int *fromlen);
   ssize_t recvmsg (struct msghdr *msg, int flags);
   void read (void *ptr, size_t& len);
-  ssize_t __stdcall readv (const struct iovec *, int iovcnt, ssize_t tot = -1);
-  ssize_t __stdcall write (const void *ptr, size_t len);
-  ssize_t __stdcall writev (const struct iovec *, int iovcnt, ssize_t tot = -1);
+  ssize_t readv (const struct iovec *, int iovcnt, ssize_t tot = -1);
+  ssize_t write (const void *ptr, size_t len);
+  ssize_t writev (const struct iovec *, int iovcnt, ssize_t tot = -1);
   int shutdown (int how);
   int close ();
 
@@ -1121,14 +1121,14 @@ class fhandler_socket_unix : public fhandler_socket
   ssize_t recvfrom (void *ptr, size_t len, int flags,
 		    struct sockaddr *from, int *fromlen);
   void read (void *ptr, size_t& len);
-  ssize_t __stdcall readv (const struct iovec *const iov, int iovcnt,
+  ssize_t readv (const struct iovec *const iov, int iovcnt,
 			   ssize_t tot = -1);
 
   ssize_t sendmsg (const struct msghdr *msg, int flags);
   ssize_t sendto (const void *ptr, size_t len, int flags,
 		  const struct sockaddr *to, int tolen);
-  ssize_t __stdcall write (const void *ptr, size_t len);
-  ssize_t __stdcall writev (const struct iovec *const iov, int iovcnt,
+  ssize_t write (const void *ptr, size_t len);
+  ssize_t writev (const struct iovec *const iov, int iovcnt,
 			    ssize_t tot = -1);
   int setsockopt (int level, int optname, const void *optval,
 		  __socklen_t optlen);
@@ -2202,7 +2202,7 @@ private:
   int dup (fhandler_base *, int);
 
   void read (void *ptr, size_t& len);
-  ssize_t __stdcall write (const void *ptr, size_t len);
+  ssize_t write (const void *ptr, size_t len);
   void doecho (const void *str, DWORD len);
   int close ();
   static bool exists ()
@@ -2386,7 +2386,7 @@ class fhandler_pty_slave: public fhandler_pty_common
 
   int open (int flags, mode_t mode = 0);
   bool open_setup (int flags);
-  ssize_t __stdcall write (const void *ptr, size_t len);
+  ssize_t write (const void *ptr, size_t len);
   void read (void *ptr, size_t& len);
   int init (HANDLE, DWORD, mode_t);
 
@@ -2501,7 +2501,7 @@ public:
   int accept_input ();
   int open (int flags, mode_t mode = 0);
   bool open_setup (int flags);
-  ssize_t __stdcall write (const void *ptr, size_t len);
+  ssize_t write (const void *ptr, size_t len);
   void read (void *ptr, size_t& len);
   int close ();
   void cleanup ();
@@ -2571,14 +2571,14 @@ class fhandler_dev_null: public fhandler_base
     return fh;
   }
 
-  ssize_t __stdcall write (const void *ptr, size_t len);
+  ssize_t write (const void *ptr, size_t len);
 };
 
 class fhandler_dev_zero: public fhandler_base
 {
  public:
   fhandler_dev_zero ();
-  ssize_t __stdcall write (const void *ptr, size_t len);
+  ssize_t write (const void *ptr, size_t len);
   void read (void *ptr, size_t& len);
   off_t lseek (off_t, int) { return 0; }
 
@@ -2617,7 +2617,7 @@ class fhandler_dev_random: public fhandler_base
   int pseudo_read (void *ptr, size_t len);
 
  public:
-  ssize_t __stdcall write (const void *ptr, size_t len);
+  ssize_t write (const void *ptr, size_t len);
   void read (void *ptr, size_t& len);
   off_t lseek (off_t, int) { return 0; }
 
@@ -2652,7 +2652,7 @@ class fhandler_dev_clipboard: public fhandler_base
   fhandler_dev_clipboard ();
   int is_windows () { return 1; }
   int fstat (struct stat *buf);
-  ssize_t __stdcall write (const void *ptr, size_t len);
+  ssize_t write (const void *ptr, size_t len);
   void read (void *ptr, size_t& len);
   off_t lseek (off_t offset, int whence);
   int close ();
@@ -2688,7 +2688,7 @@ class fhandler_windows: public fhandler_base
   int is_windows () { return 1; }
   HWND get_hwnd () { return hWnd_; }
   int open (int flags, mode_t mode = 0);
-  ssize_t __stdcall write (const void *ptr, size_t len);
+  ssize_t write (const void *ptr, size_t len);
   void read (void *ptr, size_t& len);
   int ioctl (unsigned int cmd, void *);
   off_t lseek (off_t, int) { return 0; }
@@ -2734,7 +2734,7 @@ class fhandler_dev_dsp: public fhandler_base
   fhandler_dev_dsp *base () const {return (fhandler_dev_dsp *)archetype;}
 
   int open (int, mode_t mode = 0);
-  ssize_t __stdcall write (const void *, size_t);
+  ssize_t write (const void *, size_t);
   void read (void *, size_t&);
   int ioctl (unsigned int, void *);
   int close ();
@@ -2742,7 +2742,7 @@ class fhandler_dev_dsp: public fhandler_base
   void fixup_after_exec ();
 
  private:
-  ssize_t __stdcall _write (const void *, size_t);
+  ssize_t _write (const void *, size_t);
   void _read (void *, size_t&);
   int _ioctl (unsigned int, void *);
   void _fixup_after_fork (HANDLE);
@@ -2789,7 +2789,7 @@ class fhandler_virtual : public fhandler_base
   void seekdir (DIR *, long);
   void rewinddir (DIR *);
   int closedir (DIR *);
-  ssize_t __stdcall write (const void *ptr, size_t len);
+  ssize_t write (const void *ptr, size_t len);
   void read (void *ptr, size_t& len);
   off_t lseek (off_t, int);
   int dup (fhandler_base *child, int);
@@ -2867,7 +2867,7 @@ class fhandler_procsys: public fhandler_virtual
   int open (int flags, mode_t mode = 0);
   int close ();
   void read (void *ptr, size_t& len);
-  ssize_t __stdcall write (const void *ptr, size_t len);
+  ssize_t write (const void *ptr, size_t len);
   int fstat (struct stat *buf);
   bool fill_filebuf ();
 
@@ -3122,7 +3122,7 @@ class fhandler_signalfd : public fhandler_base
   int signalfd (const sigset_t *mask, int flags);
   int fstat (struct stat *buf);
   void read (void *ptr, size_t& len);
-  ssize_t __stdcall write (const void *, size_t);
+  ssize_t write (const void *, size_t);
 
   int poll ();
   inline sigset_t get_sigset () const { return sigset; }
@@ -3167,7 +3167,7 @@ class fhandler_timerfd : public fhandler_base
 
   int fstat (struct stat *buf);
   void read (void *ptr, size_t& len);
-  ssize_t __stdcall write (const void *, size_t);
+  ssize_t write (const void *, size_t);
   int dup (fhandler_base *child, int);
   int ioctl (unsigned int, void *);
   int close ();
diff --git a/winsup/cygwin/fhandler_clipboard.cc b/winsup/cygwin/fhandler_clipboard.cc
index ae6de4551..4886968b2 100644
--- a/winsup/cygwin/fhandler_clipboard.cc
+++ b/winsup/cygwin/fhandler_clipboard.cc
@@ -121,7 +121,7 @@ fhandler_dev_clipboard::set_clipboard (const void *buf, size_t len)
 }
 
 /* FIXME: arbitrary seeking is not handled */
-ssize_t __stdcall
+ssize_t
 fhandler_dev_clipboard::write (const void *buf, size_t len)
 {
   /* write to our membuffer */
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index 45b786dd5..3be6e88d7 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -158,7 +158,7 @@ console_unit::console_unit (HWND me0):
     api_fatal ("console device allocation failure - too many consoles in use, max consoles is 32");
 }
 
-static DWORD WINAPI
+static DWORD
 cons_master_thread (VOID *arg)
 {
   fhandler_console *fh = (fhandler_console *) arg;
@@ -3311,7 +3311,7 @@ do_print:
   return found + trunc_buf.len;
 }
 
-ssize_t __stdcall
+ssize_t
 fhandler_console::write (const void *vsrc, size_t len)
 {
   bg_check_types bg = bg_check (SIGTTOU);
@@ -3778,7 +3778,7 @@ fhandler_console::set_close_on_exec (bool val)
   close_on_exec (val);
 }
 
-void __stdcall
+void
 set_console_title (char *title)
 {
   wchar_t buf[TITLESIZE + 1];
@@ -3819,7 +3819,7 @@ DEF_HOOK (CreateProcessA);
 DEF_HOOK (CreateProcessW);
 DEF_HOOK (ContinueDebugEvent);
 
-static BOOL WINAPI
+static BOOL
 CreateProcessA_Hooked
      (LPCSTR n, LPSTR c, LPSECURITY_ATTRIBUTES pa, LPSECURITY_ATTRIBUTES ta,
       BOOL inh, DWORD f, LPVOID e, LPCSTR d,
@@ -3834,7 +3834,7 @@ CreateProcessA_Hooked
   return CreateProcessA_Orig (n, c, pa, ta, inh, f, e, d, si, pi);
 }
 
-static BOOL WINAPI
+static BOOL
 CreateProcessW_Hooked
      (LPCWSTR n, LPWSTR c, LPSECURITY_ATTRIBUTES pa, LPSECURITY_ATTRIBUTES ta,
       BOOL inh, DWORD f, LPVOID e, LPCWSTR d,
@@ -3849,7 +3849,7 @@ CreateProcessW_Hooked
   return CreateProcessW_Orig (n, c, pa, ta, inh, f, e, d, si, pi);
 }
 
-static BOOL WINAPI
+static BOOL
 ContinueDebugEvent_Hooked
      (DWORD p, DWORD t, DWORD s)
 {
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index f7728e36e..22d8aba83 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -1578,7 +1578,7 @@ fhandler_disk_file::pread (void *buf, size_t count, off_t offset, void *aio)
      Windows mandatory locking semantics disallow to use another HANDLE. */
   if (rbinary () && !mandatory_locking ())
     {
-      extern int __stdcall is_at_eof (HANDLE h);
+      extern int is_at_eof (HANDLE h);
       NTSTATUS status;
       IO_STATUS_BLOCK io;
       LARGE_INTEGER off = { QuadPart:offset };
diff --git a/winsup/cygwin/fhandler_dsp.cc b/winsup/cygwin/fhandler_dsp.cc
index 4d4824b56..c37bedea5 100644
--- a/winsup/cygwin/fhandler_dsp.cc
+++ b/winsup/cygwin/fhandler_dsp.cc
@@ -1020,7 +1020,7 @@ fhandler_dev_dsp::fhandler_dev_dsp ():
   dev ().parse (FH_OSS_DSP);
 }
 
-ssize_t __stdcall
+ssize_t
 fhandler_dev_dsp::write (const void *ptr, size_t len)
 {
   return base ()->_write (ptr, len);
@@ -1093,7 +1093,7 @@ fhandler_dev_dsp::open (int flags, mode_t)
 #define IS_WRITE() ((get_flags() & O_ACCMODE) != O_RDONLY)
 #define IS_READ() ((get_flags() & O_ACCMODE) != O_WRONLY)
 
-ssize_t __stdcall
+ssize_t
 fhandler_dev_dsp::_write (const void *ptr, size_t len)
 {
   debug_printf ("ptr=%p len=%ld", ptr, len);
diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc
index fa4ac7890..1d3e42908 100644
--- a/winsup/cygwin/fhandler_fifo.cc
+++ b/winsup/cygwin/fhandler_fifo.cc
@@ -446,7 +446,7 @@ fhandler_fifo::update_shared_handlers ()
   return 0;
 }
 
-static DWORD WINAPI
+static DWORD
 fifo_reader_thread (LPVOID param)
 {
   fhandler_fifo *fh = (fhandler_fifo *) param;
diff --git a/winsup/cygwin/fhandler_netdrive.cc b/winsup/cygwin/fhandler_netdrive.cc
index 306d77dd2..58ab8811b 100644
--- a/winsup/cygwin/fhandler_netdrive.cc
+++ b/winsup/cygwin/fhandler_netdrive.cc
@@ -63,7 +63,7 @@ wnet_dbg_out (const char *func, DWORD ndi_ret)
     debug_printf ("WNetGetLastError failed: %u", gle_ret);
 }
 
-static DWORD WINAPI
+static DWORD
 thread_netdrive (void *arg)
 {
   netdriveinf *ndi = (netdriveinf *) arg;
diff --git a/winsup/cygwin/fhandler_procsys.cc b/winsup/cygwin/fhandler_procsys.cc
index a5fd85f43..cd1d35984 100644
--- a/winsup/cygwin/fhandler_procsys.cc
+++ b/winsup/cygwin/fhandler_procsys.cc
@@ -432,7 +432,7 @@ fhandler_procsys::read (void *ptr, size_t& len)
   fhandler_base::raw_read (ptr, len);
 }
 
-ssize_t __stdcall
+ssize_t
 fhandler_procsys::write (const void *ptr, size_t len)
 {
   return fhandler_base::raw_write (ptr, len);
diff --git a/winsup/cygwin/fhandler_random.cc b/winsup/cygwin/fhandler_random.cc
index c0f37b55e..495e3a94b 100644
--- a/winsup/cygwin/fhandler_random.cc
+++ b/winsup/cygwin/fhandler_random.cc
@@ -36,7 +36,7 @@ fhandler_dev_random::pseudo_write (const void *ptr, size_t len)
   return len;
 }
 
-ssize_t __stdcall
+ssize_t
 fhandler_dev_random::write (const void *ptr, size_t len)
 {
   if (!len)
diff --git a/winsup/cygwin/fhandler_signalfd.cc b/winsup/cygwin/fhandler_signalfd.cc
index 97305515f..bdd8bc93e 100644
--- a/winsup/cygwin/fhandler_signalfd.cc
+++ b/winsup/cygwin/fhandler_signalfd.cc
@@ -140,7 +140,7 @@ fhandler_signalfd::read (void *ptr, size_t& len)
   return;
 }
 
-ssize_t __stdcall
+ssize_t
 fhandler_signalfd::write (const void *, size_t)
 {
   set_errno (EINVAL);
diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc
index 55e0432b6..3bfad951b 100644
--- a/winsup/cygwin/fhandler_socket_unix.cc
+++ b/winsup/cygwin/fhandler_socket_unix.cc
@@ -928,7 +928,7 @@ struct conn_wait_info_t
 };
 
 /* Just hop to the wait_pipe_thread method. */
-DWORD WINAPI
+DWORD
 connect_wait_func (LPVOID param)
 {
   conn_wait_info_t *wait_info = (conn_wait_info_t *) param;
@@ -1911,7 +1911,7 @@ fhandler_socket_unix::read (void *ptr, size_t& len)
   len = recvmsg (&msg, 0);
 }
 
-ssize_t __stdcall
+ssize_t
 fhandler_socket_unix::readv (const struct iovec *const iov, int iovcnt,
 			     ssize_t tot)
 {
@@ -1953,7 +1953,7 @@ fhandler_socket_unix::sendto (const void *in_ptr, size_t len, int flags,
   return sendmsg (&msg, flags);
 }
 
-ssize_t __stdcall
+ssize_t
 fhandler_socket_unix::write (const void *ptr, size_t len)
 {
   struct iovec iov;
@@ -1971,7 +1971,7 @@ fhandler_socket_unix::write (const void *ptr, size_t len)
   return sendmsg (&msg, 0);
 }
 
-ssize_t __stdcall
+ssize_t
 fhandler_socket_unix::writev (const struct iovec *const iov, int iovcnt,
 			      ssize_t tot)
 {
diff --git a/winsup/cygwin/fhandler_timerfd.cc b/winsup/cygwin/fhandler_timerfd.cc
index 6bc4e0d68..9269494db 100644
--- a/winsup/cygwin/fhandler_timerfd.cc
+++ b/winsup/cygwin/fhandler_timerfd.cc
@@ -143,7 +143,7 @@ fhandler_timerfd::read (void *ptr, size_t& len)
   return;
 }
 
-ssize_t __stdcall
+ssize_t
 fhandler_timerfd::write (const void *, size_t)
 {
   set_errno (EINVAL);
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index e3f774a6b..0f9dec570 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -268,7 +268,7 @@ atexit_func (void)
 DEF_HOOK (CreateProcessA);
 DEF_HOOK (CreateProcessW);
 
-static BOOL WINAPI
+static BOOL
 CreateProcessA_Hooked
      (LPCSTR n, LPSTR c, LPSECURITY_ATTRIBUTES pa, LPSECURITY_ATTRIBUTES ta,
       BOOL inh, DWORD f, LPVOID e, LPCSTR d,
@@ -307,7 +307,7 @@ CreateProcessA_Hooked
   return ret;
 }
 
-static BOOL WINAPI
+static BOOL
 CreateProcessW_Hooked
      (LPCWSTR n, LPWSTR c, LPSECURITY_ATTRIBUTES pa, LPSECURITY_ATTRIBUTES ta,
       BOOL inh, DWORD f, LPVOID e, LPCWSTR d,
@@ -1241,7 +1241,7 @@ fhandler_pty_slave::reset_switch_to_nat_pipe (void)
   ReleaseMutex (pipe_sw_mutex);
 }
 
-ssize_t __stdcall
+ssize_t
 fhandler_pty_slave::write (const void *ptr, size_t len)
 {
   ssize_t towrite = len;
@@ -2171,7 +2171,7 @@ fhandler_pty_master::close ()
   return 0;
 }
 
-ssize_t __stdcall
+ssize_t
 fhandler_pty_master::write (const void *ptr, size_t len)
 {
   ssize_t ret;
@@ -2666,7 +2666,7 @@ reply:
   return 0;
 }
 
-static DWORD WINAPI
+static DWORD
 pty_master_thread (VOID *arg)
 {
   fhandler_pty_master::master_thread_param_t p;
@@ -2873,7 +2873,7 @@ fhandler_pty_master::pty_master_fwd_thread (const master_fwd_thread_param_t *p)
   return 0;
 }
 
-static DWORD WINAPI
+static DWORD
 pty_master_fwd_thread (VOID *arg)
 {
   fhandler_pty_master::master_fwd_thread_param_t p;
diff --git a/winsup/cygwin/fhandler_virtual.cc b/winsup/cygwin/fhandler_virtual.cc
index bdd454d1c..21ff4f35e 100644
--- a/winsup/cygwin/fhandler_virtual.cc
+++ b/winsup/cygwin/fhandler_virtual.cc
@@ -202,7 +202,7 @@ fhandler_virtual::read (void *ptr, size_t& len)
   position += len;
 }
 
-ssize_t __stdcall
+ssize_t
 fhandler_virtual::write (const void *ptr, size_t len)
 {
   set_errno (EACCES);
diff --git a/winsup/cygwin/fhandler_windows.cc b/winsup/cygwin/fhandler_windows.cc
index 947cfd5a0..90ab48daa 100644
--- a/winsup/cygwin/fhandler_windows.cc
+++ b/winsup/cygwin/fhandler_windows.cc
@@ -54,7 +54,7 @@ fhandler_windows::open (int flags, mode_t mode)
   return fhandler_base::open ((flags & ~O_TEXT) | O_BINARY, mode);
 }
 
-ssize_t __stdcall
+ssize_t
 fhandler_windows::write (const void *buf, size_t)
 {
   MSG *ptr = (MSG *) buf;
diff --git a/winsup/cygwin/fhandler_zero.cc b/winsup/cygwin/fhandler_zero.cc
index 563768574..9d8fe004d 100644
--- a/winsup/cygwin/fhandler_zero.cc
+++ b/winsup/cygwin/fhandler_zero.cc
@@ -19,7 +19,7 @@ fhandler_dev_zero::fhandler_dev_zero ()
 {
 }
 
-ssize_t __stdcall
+ssize_t
 fhandler_dev_zero::write (const void *, size_t len)
 {
   if (get_device () == FH_FULL)
diff --git a/winsup/cygwin/flock.cc b/winsup/cygwin/flock.cc
index 2f12fc07e..50db7fe28 100644
--- a/winsup/cygwin/flock.cc
+++ b/winsup/cygwin/flock.cc
@@ -642,7 +642,7 @@ lockf_t::create_lock_obj_attr (lockfattr_t *attr, ULONG flags, void *sd_buf)
   return &attr->attr;
 }
 
-DWORD WINAPI
+DWORD
 create_lock_in_parent (PVOID param)
 {
   HANDLE lf_obj;
@@ -721,7 +721,7 @@ err:
   return 1;
 }
 
-DWORD WINAPI
+DWORD
 delete_lock_in_parent (PVOID param)
 {
   inode_t *node, *next_node;
@@ -1870,7 +1870,7 @@ struct lock_parms {
   NTSTATUS	   status;
 };
 
-static DWORD WINAPI
+static DWORD
 blocking_lock_thr (LPVOID param)
 {
   struct lock_parms *lp = (struct lock_parms *) param;
diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc
index 65f3e051b..012819b61 100644
--- a/winsup/cygwin/fork.cc
+++ b/winsup/cygwin/fork.cc
@@ -44,8 +44,8 @@ class frok
   int child_pid;
   int this_errno;
   HANDLE hchild;
-  int __stdcall parent (volatile char * volatile here);
-  int __stdcall child (volatile char * volatile here);
+  int parent (volatile char * volatile here);
+  int child (volatile char * volatile here);
   bool error (const char *fmt, ...);
   friend int dofork (void **proc, bool *with_forkables);
 };
@@ -59,7 +59,7 @@ resume_child (HANDLE forker_finished)
 }
 
 /* Notify parent that it is time for the next step. */
-static void __stdcall
+static void
 sync_with_parent (const char *s, bool hang_self)
 {
   debug_printf ("signalling parent: %s", s);
@@ -131,7 +131,7 @@ child_info::prefork (bool detached)
     }
 }
 
-int __stdcall
+int
 frok::child (volatile char * volatile here)
 {
   HANDLE& hParent = ch.parent;
@@ -202,7 +202,7 @@ frok::child (volatile char * volatile here)
   return 0;
 }
 
-int __stdcall
+int
 frok::parent (volatile char * volatile stack_here)
 {
   HANDLE forker_finished;
diff --git a/winsup/cygwin/include/cygwin/cygwin_dll.h b/winsup/cygwin/include/cygwin/cygwin_dll.h
index 56b4363ce..2b0d0b6ab 100644
--- a/winsup/cygwin/include/cygwin/cygwin_dll.h
+++ b/winsup/cygwin/include/cygwin/cygwin_dll.h
@@ -22,7 +22,7 @@ details. */
 #define DECLARE_CYGWIN_DLL(Entry)					      \
 									      \
 CDECL_BEGIN								      \
-  int WINAPI Entry (HINSTANCE h, DWORD reason, void *ptr);	              \
+  int Entry (HINSTANCE h, DWORD reason, void *ptr);	              \
   typedef int (*mainfunc) (int, char **, char **);			      \
   extern PVOID cygwin_attach_dll (HMODULE, mainfunc);			      \
   extern void cygwin_detach_dll (PVOID);				      \
@@ -42,7 +42,7 @@ static int __dllMain (int a __attribute__ ((__unused__)),		      \
 									      \
 static PVOID dll_index;							      \
 									      \
-int WINAPI _cygwin_dll_entry (HINSTANCE h, DWORD reason, void *ptr)	      \
+int _cygwin_dll_entry (HINSTANCE h, DWORD reason, void *ptr)	      \
 {									      \
   int ret;								      \
   ret = 1;								      \
@@ -88,7 +88,7 @@ int WINAPI _cygwin_dll_entry (HINSTANCE h, DWORD reason, void *ptr)	      \
 }									      \
 									      \
 /* OBSOLETE: This is only provided for source level compatibility. */         \
-int WINAPI _cygwin_noncygwin_dll_entry (HINSTANCE h, DWORD reason, void *ptr) \
+int _cygwin_noncygwin_dll_entry (HINSTANCE h, DWORD reason, void *ptr) \
 {									      \
   return _cygwin_dll_entry (h, reason, ptr);				      \
 }									      \
diff --git a/winsup/cygwin/include/cygwin/time.h b/winsup/cygwin/include/cygwin/time.h
index a1080a1c0..d7f9d3f75 100644
--- a/winsup/cygwin/include/cygwin/time.h
+++ b/winsup/cygwin/include/cygwin/time.h
@@ -14,11 +14,11 @@ extern "C"
 #endif
 
 /* Not defined in main time.h */
-int __cdecl clock_setres (clockid_t, struct timespec *);
+int clock_setres (clockid_t, struct timespec *);
 
 /* GNU extensions. */
-time_t __cdecl timelocal (struct tm *);
-time_t __cdecl timegm (struct tm *);
+time_t timelocal (struct tm *);
+time_t timegm (struct tm *);
 
 #define TIMER_RELTIME  0 /* For compatibility with HP/UX, Solaris, others? */
 
diff --git a/winsup/cygwin/include/sys/ioctl.h b/winsup/cygwin/include/sys/ioctl.h
index 4c7121471..6289e7da7 100644
--- a/winsup/cygwin/include/sys/ioctl.h
+++ b/winsup/cygwin/include/sys/ioctl.h
@@ -61,7 +61,7 @@ __BEGIN_DECLS
 # define _IOWR	_LINUX_IOWR
 #endif /*__USE_LINUX_IOCTL_DEFS */
 
-int __cdecl ioctl (int __fd, int __cmd, ...);
+int ioctl (int __fd, int __cmd, ...);
 
 __END_DECLS
 #endif
diff --git a/winsup/cygwin/init.cc b/winsup/cygwin/init.cc
index d822a3851..ce6484aff 100644
--- a/winsup/cygwin/init.cc
+++ b/winsup/cygwin/init.cc
@@ -19,7 +19,7 @@ unsigned threadfunc_ix[8];
 static bool dll_finished_loading;
 #define OLDFUNC_OFFSET -1
 
-static void WINAPI
+static void
 threadfunc_fe (VOID *arg)
 {
   _cygtls::call ((DWORD (*)  (void *, void *)) TlsGetValue (_my_oldfunc), arg);
@@ -70,7 +70,7 @@ void dll_crt0_0 ();
    need the alloca'd space in the DLL_PROCESS_ATTACH case below... */
 void *alloca_dummy;
 
-extern "C" BOOL WINAPI
+extern "C" BOOL
 dll_entry (HANDLE h, DWORD reason, void *static_load)
 {
   BOOL test_stack_marker;
diff --git a/winsup/cygwin/kernel32.cc b/winsup/cygwin/kernel32.cc
index 05c5d4d70..6248aefd5 100644
--- a/winsup/cygwin/kernel32.cc
+++ b/winsup/cygwin/kernel32.cc
@@ -22,7 +22,7 @@ details. */
 /* Implement CreateEvent/OpenEvent so that named objects are always created in
    Cygwin shared object namespace. */
 
-HANDLE WINAPI
+HANDLE
 CreateEventW (LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset,
 	      BOOL bInitialState, LPCWSTR lpName)
 {
@@ -57,7 +57,7 @@ CreateEventW (LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset,
   return evt;
 }
 
-HANDLE WINAPI
+HANDLE
 CreateEventA (LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset,
 	      BOOL bInitialState, LPCSTR lpName)
 {
@@ -72,7 +72,7 @@ CreateEventA (LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset,
 		       lpName ? name : NULL);
 }
 
-HANDLE WINAPI
+HANDLE
 OpenEventW (DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName)
 {
   HANDLE evt;
@@ -100,7 +100,7 @@ OpenEventW (DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName)
   return evt;
 }
 
-HANDLE WINAPI
+HANDLE
 OpenEventA (DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName)
 {
   WCHAR name[MAX_PATH];
@@ -116,7 +116,7 @@ OpenEventA (DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName)
 /* Implement CreateMutex/OpenMutex so that named objects are always created in
    Cygwin shared object namespace. */
 
-HANDLE WINAPI
+HANDLE
 CreateMutexW (LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwner,
 	      LPCWSTR lpName)
 {
@@ -148,7 +148,7 @@ CreateMutexW (LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwner,
   return mtx;
 }
 
-HANDLE WINAPI
+HANDLE
 CreateMutexA (LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwner,
 	      LPCSTR lpName)
 {
@@ -162,7 +162,7 @@ CreateMutexA (LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwner,
   return CreateMutexW (lpMutexAttributes, bInitialOwner, lpName ? name : NULL);
 }
 
-HANDLE WINAPI
+HANDLE
 OpenMutexW (DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName)
 {
   HANDLE mtx;
@@ -190,7 +190,7 @@ OpenMutexW (DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName)
   return mtx;
 }
 
-HANDLE WINAPI
+HANDLE
 OpenMutexA (DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName)
 {
   WCHAR name[MAX_PATH];
@@ -206,7 +206,7 @@ OpenMutexA (DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName)
 /* Implement CreateSemaphore/OpenSemaphore so that named objects are always
    created in Cygwin shared object namespace. */
 
-HANDLE WINAPI
+HANDLE
 CreateSemaphoreW (LPSECURITY_ATTRIBUTES lpSemaphoreAttributes,
 		  LONG lInitialCount, LONG lMaximumCount, LPCWSTR lpName)
 {
@@ -240,7 +240,7 @@ CreateSemaphoreW (LPSECURITY_ATTRIBUTES lpSemaphoreAttributes,
   return sem;
 }
 
-HANDLE WINAPI
+HANDLE
 CreateSemaphoreA (LPSECURITY_ATTRIBUTES lpSemaphoreAttributes,
 		  LONG lInitialCount, LONG lMaximumCount, LPCSTR lpName)
 {
@@ -255,7 +255,7 @@ CreateSemaphoreA (LPSECURITY_ATTRIBUTES lpSemaphoreAttributes,
 			   lpName ? name : NULL);
 }
 
-HANDLE WINAPI
+HANDLE
 OpenSemaphoreW (DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName)
 {
   HANDLE sem;
@@ -283,7 +283,7 @@ OpenSemaphoreW (DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName)
   return sem;
 }
 
-HANDLE WINAPI
+HANDLE
 OpenSemaphoreA (DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName)
 {
   WCHAR name[MAX_PATH];
@@ -299,7 +299,7 @@ OpenSemaphoreA (DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName)
 /* Implement CreateFileMapping/OpenFileMapping so that named objects are always
    created in Cygwin shared object namespace. */
 
-HANDLE WINAPI
+HANDLE
 CreateFileMappingW (HANDLE hFile, LPSECURITY_ATTRIBUTES lpAttributes,
 		    DWORD flProtect, DWORD dwMaximumSizeHigh,
 		    DWORD dwMaximumSizeLow, LPCWSTR lpName)
@@ -354,7 +354,7 @@ CreateFileMappingW (HANDLE hFile, LPSECURITY_ATTRIBUTES lpAttributes,
   return sect;
 }
 
-HANDLE WINAPI
+HANDLE
 CreateFileMappingA (HANDLE hFile, LPSECURITY_ATTRIBUTES lpAttributes,
 		    DWORD flProtect, DWORD dwMaximumSizeHigh,
 		    DWORD dwMaximumSizeLow, LPCSTR lpName)
@@ -370,7 +370,7 @@ CreateFileMappingA (HANDLE hFile, LPSECURITY_ATTRIBUTES lpAttributes,
 			     dwMaximumSizeLow, lpName ? name : NULL);
 }
 
-HANDLE WINAPI
+HANDLE
 OpenFileMappingW (DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName)
 {
   HANDLE sect;
@@ -398,7 +398,7 @@ OpenFileMappingW (DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName)
   return sect;
 }
 
-HANDLE WINAPI
+HANDLE
 OpenFileMappingA (DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName)
 {
   WCHAR name[MAX_PATH];
@@ -433,7 +433,7 @@ ucmd ()
 /* Cygwin replacement for GetCommandLineW.  Returns a concatenated wide string
    representing the argv list, constructed using roughly the same mechanism as
    child_info_spawn::worker */
-extern "C" LPWSTR WINAPI
+extern "C" LPWSTR
 cygwin_GetCommandLineW (void)
 {
   return ucmd ()->Buffer;
@@ -442,7 +442,7 @@ cygwin_GetCommandLineW (void)
 /* Cygwin replacement for GetCommandLineA.  Returns a concatenated string
    representing the argv list, constructed using roughly the same mechanism
    as child_info_spawn::worker */
-extern "C" LPSTR WINAPI
+extern "C" LPSTR
 cygwin_GetCommandLineA (void)
 {
   static ANSI_STRING cmd;
diff --git a/winsup/cygwin/ldap.cc b/winsup/cygwin/ldap.cc
index 3c9fd13a1..ed2fa3f7f 100644
--- a/winsup/cygwin/ldap.cc
+++ b/winsup/cygwin/ldap.cc
@@ -208,7 +208,7 @@ cyg_ldap::connect_non_ssl (PCWSTR domain)
   return ret;
 }
 
-static DWORD WINAPI
+static DWORD
 ldap_init_thr (LPVOID param)
 {
   cyg_ldap_init *cl = (cyg_ldap_init *) param;
@@ -251,7 +251,7 @@ cyg_ldap::search_s (PWCHAR base, ULONG scope, PWCHAR filter, PWCHAR *attrs)
   return ret;
 }
 
-static DWORD WINAPI
+static DWORD
 ldap_search_thr (LPVOID param)
 {
   cyg_ldap_search *cl = (cyg_ldap_search *) param;
@@ -293,7 +293,7 @@ cyg_ldap::next_page_s ()
   return ret;
 }
 
-static DWORD WINAPI
+static DWORD
 ldap_next_page_thr (LPVOID param)
 {
   cyg_ldap_next_page *cl = (cyg_ldap_next_page *) param;
diff --git a/winsup/cygwin/lib/_cygwin_crt0_common.cc b/winsup/cygwin/lib/_cygwin_crt0_common.cc
index 365015011..d356a50fb 100644
--- a/winsup/cygwin/lib/_cygwin_crt0_common.cc
+++ b/winsup/cygwin/lib/_cygwin_crt0_common.cc
@@ -72,7 +72,7 @@ struct per_process_cxx_malloc __cygwin_cxx_malloc =
 /* Set up pointers to various pieces so the dll can then use them,
    and then jump to the dll.  */
 
-int __stdcall
+int
 _cygwin_crt0_common (MainFunc f, per_process *u)
 {
   per_process *newu = (per_process *) cygwin_internal (CW_USER_DATA);
diff --git a/winsup/cygwin/lib/crt0.h b/winsup/cygwin/lib/crt0.h
index c551de78f..e599b4493 100644
--- a/winsup/cygwin/lib/crt0.h
+++ b/winsup/cygwin/lib/crt0.h
@@ -13,7 +13,7 @@ extern "C" {
 #include "winlean.h"
 struct per_process;
 typedef int (*MainFunc) (int argc, char *argv[], char **env);
-int __stdcall _cygwin_crt0_common (MainFunc, struct per_process *);
+int _cygwin_crt0_common (MainFunc, struct per_process *);
 PVOID dll_dllcrt0 (HMODULE, struct per_process *);
 
 #ifdef __cplusplus
diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc
index d9caf9b73..ef72662ba 100644
--- a/winsup/cygwin/miscfuncs.cc
+++ b/winsup/cygwin/miscfuncs.cc
@@ -199,7 +199,7 @@ nice_to_winprio (int &nice)
 
 /* Minimal overlapped pipe I/O implementation for signal and commune stuff. */
 
-BOOL WINAPI
+BOOL
 CreatePipeOverlapped (PHANDLE hr, PHANDLE hw, LPSECURITY_ATTRIBUTES sa)
 {
   int ret = fhandler_pipe::create (sa, hr, hw, 0, NULL,
@@ -209,7 +209,7 @@ CreatePipeOverlapped (PHANDLE hr, PHANDLE hw, LPSECURITY_ATTRIBUTES sa)
   return ret == 0;
 }
 
-BOOL WINAPI
+BOOL
 ReadPipeOverlapped (HANDLE h, PVOID buf, DWORD len, LPDWORD ret_len,
 		    DWORD timeout)
 {
@@ -229,7 +229,7 @@ ReadPipeOverlapped (HANDLE h, PVOID buf, DWORD len, LPDWORD ret_len,
   return ret;
 }
 
-BOOL WINAPI
+BOOL
 WritePipeOverlapped (HANDLE h, LPCVOID buf, DWORD len, LPDWORD ret_len,
 		     DWORD timeout)
 {
@@ -373,7 +373,7 @@ struct pthread_wrapper_arg
   ULONG guardsize;
 };
 
-DWORD WINAPI
+DWORD
 pthread_wrapper (PVOID arg)
 {
   /* Just plain paranoia. */
@@ -594,7 +594,7 @@ create_new_main_thread_stack (PVOID &allocationbase)
   return ((PBYTE) allocationbase + stacksize - 16);
 }
 
-HANDLE WINAPI
+HANDLE
 CygwinCreateThread (LPTHREAD_START_ROUTINE thread_func, PVOID thread_arg,
 		    PVOID stackaddr, ULONG stacksize, ULONG guardsize,
 		    DWORD creation_flags, LPDWORD thread_id)
diff --git a/winsup/cygwin/miscfuncs.h b/winsup/cygwin/miscfuncs.h
index 565029561..3aa7ad1e4 100644
--- a/winsup/cygwin/miscfuncs.h
+++ b/winsup/cygwin/miscfuncs.h
@@ -49,11 +49,11 @@ DWORD nice_to_winprio (int &);
 
 bool create_pipe (PHANDLE, PHANDLE, LPSECURITY_ATTRIBUTES, DWORD);
 
-BOOL WINAPI CreatePipeOverlapped (PHANDLE read_handle, PHANDLE write_handle,
+BOOL CreatePipeOverlapped (PHANDLE read_handle, PHANDLE write_handle,
 				  LPSECURITY_ATTRIBUTES sa);
-BOOL WINAPI ReadPipeOverlapped (HANDLE h, PVOID buf, DWORD len,
+BOOL ReadPipeOverlapped (HANDLE h, PVOID buf, DWORD len,
 				LPDWORD ret_len, DWORD timeout);
-BOOL WINAPI WritePipeOverlapped (HANDLE h, LPCVOID buf, DWORD len,
+BOOL WritePipeOverlapped (HANDLE h, LPCVOID buf, DWORD len,
 				 LPDWORD ret_len, DWORD timeout);
 
 /* class for per-line reading using native functions.  The caller provides
@@ -110,8 +110,8 @@ ssize_t check_iovec (const struct iovec *, int, bool);
 
 extern PVOID create_new_main_thread_stack (PVOID &allocationbase);
 
-extern "C" DWORD WINAPI pthread_wrapper (PVOID arg);
-extern "C" HANDLE WINAPI CygwinCreateThread (LPTHREAD_START_ROUTINE thread_func,
+extern "C" DWORD pthread_wrapper (PVOID arg);
+extern "C" HANDLE CygwinCreateThread (LPTHREAD_START_ROUTINE thread_func,
 					     PVOID thread_arg, PVOID stackaddr,
 					     ULONG stacksize, ULONG guardsize,
 					     DWORD creation_flags,
diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc
index 948eeec1f..0c70d66f0 100644
--- a/winsup/cygwin/mmap.cc
+++ b/winsup/cygwin/mmap.cc
@@ -1774,7 +1774,7 @@ fhandler_disk_file::fixup_mmap_after_fork (HANDLE h, int prot, int flags,
    none of the mapped areas are in our address space. We need to iterate
    through the map, doing the MapViewOfFile calls.  */
 
-int __stdcall
+int
 fixup_mmaps_after_fork (HANDLE parent)
 {
   /* Iterate over maps */
diff --git a/winsup/cygwin/mount.cc b/winsup/cygwin/mount.cc
index 5eb028980..389f62fad 100644
--- a/winsup/cygwin/mount.cc
+++ b/winsup/cygwin/mount.cc
@@ -47,7 +47,7 @@ int NO_COPY mount_info::root_idx = -1;
    This function is only used to test for valid input strings.
    The later normalization drops the native prefixes. */
 
-static inline bool __stdcall
+static inline bool
 is_native_path (const char *path)
 {
   return isdirsep (path[0])
@@ -57,7 +57,7 @@ is_native_path (const char *path)
 	 && isalpha (path[4]);
 }
 
-static inline bool __stdcall
+static inline bool
 is_unc_share (const char *path)
 {
   const char *p;
diff --git a/winsup/cygwin/ntdll.h b/winsup/cygwin/ntdll.h
index 5cb7cc636..e058d0a74 100644
--- a/winsup/cygwin/ntdll.h
+++ b/winsup/cygwin/ntdll.h
@@ -1528,7 +1528,7 @@ extern "C"
 				   PVOID, ULONG, PULONG);
   NTSTATUS NTAPI NtQuerySystemInformation (SYSTEM_INFORMATION_CLASS,
 					   PVOID, ULONG, PULONG);
-  NTSTATUS WINAPI NtQuerySystemTime (PLARGE_INTEGER);
+  NTSTATUS NtQuerySystemTime (PLARGE_INTEGER);
   NTSTATUS NTAPI NtQuerySecurityObject (HANDLE, SECURITY_INFORMATION,
 					PSECURITY_DESCRIPTOR, ULONG, PULONG);
   NTSTATUS NTAPI NtQuerySymbolicLinkObject (HANDLE, PUNICODE_STRING, PULONG);
diff --git a/winsup/cygwin/ntea.cc b/winsup/cygwin/ntea.cc
index 5094cf324..a400fcb2b 100644
--- a/winsup/cygwin/ntea.cc
+++ b/winsup/cygwin/ntea.cc
@@ -364,7 +364,7 @@ write_ea (HANDLE hdl, path_conv &pc, const char *name, const char *value,
   return ret;
 }
 
-static ssize_t __stdcall
+static ssize_t
 getxattr_worker (path_conv &pc, const char *name, void *value, size_t size)
 {
   int res = -1;
@@ -468,7 +468,7 @@ flistxattr (int fd, char *list, size_t size)
   return res;
 }
 
-static int __stdcall
+static int
 setxattr_worker (path_conv &pc, const char *name, const void *value,
 		 size_t size, int flags)
 {
diff --git a/winsup/cygwin/ntsecapi.h b/winsup/cygwin/ntsecapi.h
deleted file mode 100644
index 8b0a7e77f..000000000
--- a/winsup/cygwin/ntsecapi.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef _CYGWIN_NTSECAPI_H
-#define _CYGWIN_NTSECAPI_H
-
-/* There's a bug in ntsecapi.h (Mingw as well as MSFT).  SystemFunction036
-   is, in fact, a WINAPI function, but it's not defined as such.  Therefore
-   we have to do it correctly here in the ntsecapi.h wrapper. */
-
-#define SystemFunction036	__nonexistant_SystemFunction036__
-
-#include_next <ntsecapi.h>
-
-#undef SystemFunction036
-
-#define RtlGenRandom SystemFunction036
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-BOOLEAN WINAPI RtlGenRandom (PVOID, ULONG);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _CYGWIN_NTSECAPI_H */
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index a54dac89b..2fc9072ce 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -82,7 +82,7 @@ pinfo::thisproc (HANDLE h)
 
 /* Initialize the process table entry for the current task.
    This is not called for forked tasks, only execed ones.  */
-void __stdcall
+void
 pinfo_init (char **envp, int envc)
 {
   if (envp)
@@ -597,7 +597,7 @@ _pinfo::alive ()
   return !!h;
 }
 
-DWORD WINAPI
+DWORD
 commune_process (void *arg)
 {
   siginfo_t& si = *((siginfo_t *) arg);
@@ -1234,7 +1234,7 @@ _pinfo::environ (size_t& n)
    is received on the pipe, it is assumed that the cygwin pid has exited.
    Otherwise, various "signals" can be sent to the parent to inform the
    parent to perform a certain action. */
-static DWORD WINAPI
+static DWORD
 proc_waiter (void *arg)
 {
   pinfo vchild = *(pinfo *) arg;
diff --git a/winsup/cygwin/pinfo.h b/winsup/cygwin/pinfo.h
index 86ba64bb6..463f0e851 100644
--- a/winsup/cygwin/pinfo.h
+++ b/winsup/cygwin/pinfo.h
@@ -131,7 +131,7 @@ public:
   friend class pinfo_minimal;
 };
 
-DWORD WINAPI commune_process (void *);
+DWORD commune_process (void *);
 
 enum parent_alerter
 {
@@ -254,7 +254,7 @@ public:
 pid_t create_cygwin_pid ();
 pid_t cygwin_pid (DWORD);
 
-void __stdcall pinfo_init (char **, int);
+void pinfo_init (char **, int);
 extern pinfo myself;
 
 /* Helper class to allow convenient setting and unsetting a process_state
@@ -291,9 +291,9 @@ public:
 #define myctty() myself->__ctty ()
 
 /* For mmaps across fork(). */
-int __stdcall fixup_mmaps_after_fork (HANDLE parent);
+int fixup_mmaps_after_fork (HANDLE parent);
 /* for shm areas across fork (). */
-int __stdcall fixup_shms_after_fork ();
+int fixup_shms_after_fork ();
 
-void __stdcall fill_rusage (struct rusage *, HANDLE);
-void __stdcall add_rusage (struct rusage *, struct rusage *);
+void fill_rusage (struct rusage *, HANDLE);
+void add_rusage (struct rusage *, struct rusage *);
diff --git a/winsup/cygwin/posix_timer.cc b/winsup/cygwin/posix_timer.cc
index 75cd4fa60..69c758aa7 100644
--- a/winsup/cygwin/posix_timer.cc
+++ b/winsup/cygwin/posix_timer.cc
@@ -228,7 +228,7 @@ out:
   return 0;
 }
 
-static DWORD WINAPI
+static DWORD
 timer_thread (VOID *x)
 {
   timer_tracker *tt = ((timer_tracker *) x);
diff --git a/winsup/cygwin/resource.cc b/winsup/cygwin/resource.cc
index 21e85bd18..aafc2b0b1 100644
--- a/winsup/cygwin/resource.cc
+++ b/winsup/cygwin/resource.cc
@@ -37,7 +37,7 @@ add_timeval (struct timeval *tv1, struct timeval *tv2)
 }
 
 /* add rusage values of r2 to r1 */
-void __stdcall
+void
 add_rusage (struct rusage *r1, struct rusage *r2)
 {
   add_timeval (&r1->ru_utime, &r2->ru_utime);
@@ -59,7 +59,7 @@ add_rusage (struct rusage *r1, struct rusage *r2)
 }
 
 /* FIXME: what about other fields? */
-void __stdcall
+void
 fill_rusage (struct rusage *r, HANDLE h)
 {
   KERNEL_USER_TIMES kut;
diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
index 0fa60bcdb..76ab91bbb 100644
--- a/winsup/cygwin/select.cc
+++ b/winsup/cygwin/select.cc
@@ -770,7 +770,7 @@ out:
 
 static int start_thread_pipe (select_record *me, select_stuff *stuff);
 
-static DWORD WINAPI
+static DWORD
 thread_pipe (void *arg)
 {
   select_pipe_info *pi = (select_pipe_info *) arg;
@@ -973,7 +973,7 @@ out:
 
 static int start_thread_fifo (select_record *me, select_stuff *stuff);
 
-static DWORD WINAPI
+static DWORD
 thread_fifo (void *arg)
 {
   select_fifo_info *pi = (select_fifo_info *) arg;
@@ -1161,7 +1161,7 @@ verify_console (select_record *me, fd_set *rfds, fd_set *wfds,
 
 static int console_startup (select_record *me, select_stuff *stuff);
 
-static DWORD WINAPI
+static DWORD
 thread_console (void *arg)
 {
   select_console_info *ci = (select_console_info *) arg;
@@ -1397,7 +1397,7 @@ out:
 
 static int pty_slave_startup (select_record *me, select_stuff *stuff);
 
-static DWORD WINAPI
+static DWORD
 thread_pty_slave (void *arg)
 {
   select_pipe_info *pi = (select_pipe_info *) arg;
@@ -1773,7 +1773,7 @@ peek_socket (select_record *me, bool)
 
 static int start_thread_socket (select_record *, select_stuff *);
 
-static DWORD WINAPI
+static DWORD
 thread_socket (void *arg)
 {
   select_socket_info *si = (select_socket_info *) arg;
diff --git a/winsup/cygwin/shared.cc b/winsup/cygwin/shared.cc
index c939e0d0f..c549f5e26 100644
--- a/winsup/cygwin/shared.cc
+++ b/winsup/cygwin/shared.cc
@@ -95,14 +95,14 @@ get_session_parent_dir ()
   return session_parent_dir;
 }
 
-char * __stdcall
+char *
 shared_name (char *ret_buf, const char *str, int num)
 {
   __small_sprintf (ret_buf, "%s.%d", str, num);
   return ret_buf;
 }
 
-WCHAR * __stdcall
+WCHAR *
 shared_name (WCHAR *ret_buf, const WCHAR *str, int num)
 {
   __small_swprintf (ret_buf, L"%W.%d", str, num);
@@ -135,14 +135,14 @@ static ptrdiff_t offsets[] =
 
 #define off_addr(x)	((void *)((caddr_t) cygwin_hmodule + offsets[x]))
 
-void * __stdcall
+void *
 open_shared (const WCHAR *name, int n, HANDLE& shared_h, DWORD size,
 	     shared_locations m, PSECURITY_ATTRIBUTES psa, DWORD access)
 {
   return open_shared (name, n, shared_h, size, &m, psa, access);
 }
 
-void * __stdcall
+void *
 open_shared (const WCHAR *name, int n, HANDLE& shared_h, DWORD size,
 	     shared_locations *m, PSECURITY_ATTRIBUTES psa, DWORD access)
 {
@@ -276,7 +276,7 @@ user_info::create (bool reinit)
     user_shared->initialize ();
 }
 
-void __stdcall
+void
 shared_destroy ()
 {
   ForceCloseHandle (cygwin_shared_h);
diff --git a/winsup/cygwin/shared_info.h b/winsup/cygwin/shared_info.h
index 83a1fd187..6c53ec0b8 100644
--- a/winsup/cygwin/shared_info.h
+++ b/winsup/cygwin/shared_info.h
@@ -77,7 +77,7 @@ enum shared_locations
 };
 
 void memory_init ();
-void __stdcall shared_destroy ();
+void shared_destroy ();
 
 #define shared_align_past(p) \
   ((char *) (system_info.dwAllocationGranularity * \
@@ -86,12 +86,12 @@ void __stdcall shared_destroy ();
 
 HANDLE get_shared_parent_dir ();
 HANDLE get_session_parent_dir ();
-char *__stdcall shared_name (char *, const char *, int);
-WCHAR *__stdcall shared_name (WCHAR *, const WCHAR *, int);
-void *__stdcall open_shared (const WCHAR *, int, HANDLE&, DWORD,
+char *shared_name (char *, const char *, int);
+WCHAR *shared_name (WCHAR *, const WCHAR *, int);
+void *open_shared (const WCHAR *, int, HANDLE&, DWORD,
 			     shared_locations, PSECURITY_ATTRIBUTES = &sec_all,
 			     DWORD = FILE_MAP_READ | FILE_MAP_WRITE);
-void *__stdcall open_shared (const WCHAR *, int, HANDLE&, DWORD,
+void *open_shared (const WCHAR *, int, HANDLE&, DWORD,
 			     shared_locations *, PSECURITY_ATTRIBUTES = &sec_all,
 			     DWORD = FILE_MAP_READ | FILE_MAP_WRITE);
 extern void user_shared_create (bool reinit);
diff --git a/winsup/cygwin/shm.cc b/winsup/cygwin/shm.cc
index af079ad86..88d3c0a48 100644
--- a/winsup/cygwin/shm.cc
+++ b/winsup/cygwin/shm.cc
@@ -117,7 +117,7 @@ static NO_COPY muto shm_guard;
 #define SLIST_LOCK()	(shm_guard.init ("shm_guard")->acquire ())
 #define SLIST_UNLOCK()	(shm_guard.release ())
 
-int __stdcall
+int
 fixup_shms_after_fork ()
 {
   if (!SLIST_FIRST (&sph_list))
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index 0ccbc5046..6b1a4137d 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -100,7 +100,7 @@ static int checkstate (waitq *);
 static __inline__ bool get_proc_lock (DWORD, DWORD);
 static int remove_proc (int);
 static bool stopped_or_terminated (waitq *, _pinfo *);
-static void WINAPI wait_sig (VOID *arg);
+static void wait_sig (VOID *arg);
 
 /* wait_sig bookkeeping */
 
@@ -116,7 +116,7 @@ public:
   void clear (int sig) {sigs[sig].si.si_signo = 0;}
   void clear (_cygtls *tls);
   friend void sig_dispatch_pending (bool);
-  friend void WINAPI wait_sig (VOID *arg);
+  friend void wait_sig (VOID *arg);
 };
 
 Static pending_signals sigq;
@@ -1313,7 +1313,7 @@ pending_signals::add (sigpacket& pack)
 
 /* Process signals by waiting for signal data to arrive in a pipe.
    Set a completion event if one was specified. */
-static void WINAPI
+static void
 wait_sig (VOID *)
 {
   _sig_tls = &_my_tls;
diff --git a/winsup/cygwin/sigproc.h b/winsup/cygwin/sigproc.h
index f2d7e3168..7aca80595 100644
--- a/winsup/cygwin/sigproc.h
+++ b/winsup/cygwin/sigproc.h
@@ -64,7 +64,7 @@ int handle_sigprocmask (int sig, const sigset_t *set,
 
 void sig_clear (int);
 void sig_set_pending (int);
-int __stdcall handle_sigsuspend (sigset_t);
+int handle_sigsuspend (sigset_t);
 
 int proc_subproc (DWORD, uintptr_t);
 
diff --git a/winsup/cygwin/strace.cc b/winsup/cygwin/strace.cc
index 35f8a59ae..a1a55d1ec 100644
--- a/winsup/cygwin/strace.cc
+++ b/winsup/cygwin/strace.cc
@@ -90,7 +90,7 @@ strace::microseconds ()
   return (int) (clk->strace_usecs () - process_start);
 }
 
-static int __stdcall
+static int
 getfunc (char *in_dst, const char *func)
 {
   const char *p;
diff --git a/winsup/cygwin/strfuncs.cc b/winsup/cygwin/strfuncs.cc
index f68fcb76f..9a97b3a24 100644
--- a/winsup/cygwin/strfuncs.cc
+++ b/winsup/cygwin/strfuncs.cc
@@ -671,7 +671,7 @@ sys_mbstowcs_alloc (wchar_t **dst_p, int type, const char *src, size_t nms)
 /* Copy string, until c or <nul> is encountered.
    NUL-terminate the destination string (s1).
    Return pointer to terminating byte in dst string.  */
-char * __stdcall
+char *
 strccpy (char *__restrict s1, const char **__restrict s2, char c)
 {
   while (**s2 && **s2 != c)
@@ -738,7 +738,7 @@ const char isalpha_array[] = {
    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0
 };
 
-extern "C" int __stdcall
+extern "C" int
 cygwin_wcscasecmp (const wchar_t *ws, const wchar_t *wt)
 {
   UNICODE_STRING us, ut;
@@ -748,7 +748,7 @@ cygwin_wcscasecmp (const wchar_t *ws, const wchar_t *wt)
   return RtlCompareUnicodeString (&us, &ut, TRUE);
 }
 
-extern "C" int __stdcall
+extern "C" int
 cygwin_wcsncasecmp (const wchar_t  *ws, const wchar_t *wt, size_t n)
 {
   UNICODE_STRING us, ut;
@@ -763,7 +763,7 @@ cygwin_wcsncasecmp (const wchar_t  *ws, const wchar_t *wt, size_t n)
   return RtlCompareUnicodeString (&us, &ut, TRUE);
 }
 
-extern "C" int __stdcall
+extern "C" int
 cygwin_strcasecmp (const char *cs, const char *ct)
 {
   UNICODE_STRING us, ut;
@@ -782,7 +782,7 @@ cygwin_strcasecmp (const char *cs, const char *ct)
   return RtlCompareUnicodeString (&us, &ut, TRUE);
 }
 
-extern "C" int __stdcall
+extern "C" int
 cygwin_strncasecmp (const char *cs, const char *ct, size_t n)
 {
   UNICODE_STRING us, ut;
diff --git a/winsup/cygwin/string.h b/winsup/cygwin/string.h
index 384314442..ec9a030a0 100644
--- a/winsup/cygwin/string.h
+++ b/winsup/cygwin/string.h
@@ -17,7 +17,7 @@ extern "C" {
 
 #undef strchrnul
 #define strchrnul cygwin_strchrnul
-static inline __stdcall char *
+static inline char *
 strchrnul (const char *s, int c)
 {
   while (*s != (char) c && *s != 0)
@@ -68,11 +68,11 @@ ascii_strncasematch (const char *cs, const char *ct, size_t n)
 
 #undef strcasecmp
 #define strcasecmp cygwin_strcasecmp
-int __stdcall cygwin_strcasecmp (const char *, const char *);
+int cygwin_strcasecmp (const char *, const char *);
 
 #undef strncasecmp
 #define strncasecmp cygwin_strncasecmp
-int __stdcall cygwin_strncasecmp (const char *, const char *, size_t);
+int cygwin_strncasecmp (const char *, const char *, size_t);
 
 #define strcasematch(s1,s2)	(!cygwin_strcasecmp ((s1),(s2)))
 #define strncasematch(s1,s2,n)	(!cygwin_strncasecmp ((s1),(s2),(n)))
@@ -82,7 +82,7 @@ char *strupr (char *);
 
 #endif /* __INSIDE_CYGWIN__ */
 
-char *__stdcall strccpy (char *__restrict s1, const char **__restrict s2,
+char *strccpy (char *__restrict s1, const char **__restrict s2,
 			 char c);
 
 #ifdef __cplusplus
diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc
index 72c04dbda..dc59294e7 100644
--- a/winsup/cygwin/thread.cc
+++ b/winsup/cygwin/thread.cc
@@ -1989,7 +1989,7 @@ pthread_spinlock::unlock ()
   return result;
 }
 
-DWORD WINAPI
+DWORD
 pthread::thread_init_wrapper (void *arg)
 {
   exception protect;
diff --git a/winsup/cygwin/thread.h b/winsup/cygwin/thread.h
index ddb2d7dbf..9939c4224 100644
--- a/winsup/cygwin/thread.h
+++ b/winsup/cygwin/thread.h
@@ -430,7 +430,7 @@ public:
   virtual void pop_cleanup_handler (int const execute);
 
   static pthread* self ();
-  static DWORD WINAPI thread_init_wrapper (void *);
+  static DWORD thread_init_wrapper (void *);
 
   virtual unsigned long getsequence_np();
 
diff --git a/winsup/cygwin/timerfd.cc b/winsup/cygwin/timerfd.cc
index f1a4c2804..c692e1bd1 100644
--- a/winsup/cygwin/timerfd.cc
+++ b/winsup/cygwin/timerfd.cc
@@ -225,7 +225,7 @@ canceled:
   return 0;
 }
 
-static DWORD WINAPI
+static DWORD
 timerfd_thread (VOID *arg)
 {
   timerfd_tracker *tt = ((timerfd_tracker *) arg);
diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc
index 60b29b323..4ab432925 100644
--- a/winsup/cygwin/times.cc
+++ b/winsup/cygwin/times.cc
@@ -35,7 +35,7 @@ get_system_time (PLARGE_INTEGER systime)
 }
 
 /* Cygwin internal */
-static uint64_t __stdcall
+static uint64_t
 __to_clock_t (PLARGE_INTEGER src, int flag)
 {
   uint64_t total = src->QuadPart;
@@ -154,7 +154,7 @@ timezone (void)
 }
 
 /* Cygwin internal */
-void __stdcall
+void
 totimeval (struct timeval *dst, PLARGE_INTEGER src, int sub, int flag)
 {
   int64_t x = __to_clock_t (src, flag);
@@ -194,7 +194,7 @@ gettimeofday (struct timeval *__restrict tv, void *__restrict tzvp)
 EXPORT_ALIAS (gettimeofday, _gettimeofday)
 
 /* Cygwin internal */
-void __stdcall
+void
 timespec_to_filetime (const struct timespec *time_in, PLARGE_INTEGER out)
 {
   if (time_in->tv_nsec == UTIME_OMIT)
@@ -205,7 +205,7 @@ timespec_to_filetime (const struct timespec *time_in, PLARGE_INTEGER out)
 }
 
 /* Cygwin internal */
-void __stdcall
+void
 timeval_to_filetime (const struct timeval *time_in, PLARGE_INTEGER out)
 {
   out->QuadPart = time_in->tv_sec * NS100PERSEC
@@ -230,7 +230,7 @@ timeval_to_ms (const struct timeval *time_in, DWORD &ms)
 }
 
 /* Cygwin internal */
-static timeval __stdcall
+static timeval
 time_t_to_timeval (time_t in)
 {
   timeval res;
@@ -265,7 +265,7 @@ timeval_to_timespec (const struct timeval *tvp, struct timespec *tmp)
 
 /* Cygwin internal */
 /* Convert a Win32 time to "UNIX" format. */
-time_t __stdcall
+time_t
 to_time_t (PLARGE_INTEGER ptr)
 {
   /* A file time is the number of 100ns since jan 1 1601
@@ -285,7 +285,7 @@ to_time_t (PLARGE_INTEGER ptr)
 
 /* Cygwin internal */
 /* Convert a Win32 time to "UNIX" timestruc_t format. */
-void __stdcall
+void
 to_timestruc_t (PLARGE_INTEGER ptr, timestruc_t *out)
 {
   /* A file time is the number of 100ns since jan 1 1601
@@ -309,7 +309,7 @@ to_timestruc_t (PLARGE_INTEGER ptr, timestruc_t *out)
 
 /* Cygwin internal */
 /* Get the current time as a "UNIX" timestruc_t format. */
-void __stdcall
+void
 time_as_timestruc_t (timestruc_t * out)
 {
   LARGE_INTEGER systime;
diff --git a/winsup/cygwin/tty.cc b/winsup/cygwin/tty.cc
index 2959fe2ab..a862a444e 100644
--- a/winsup/cygwin/tty.cc
+++ b/winsup/cygwin/tty.cc
@@ -63,7 +63,7 @@ ttyslot (void)
   return device::minor (myself->ctty);
 }
 
-void __stdcall
+void
 tty_list::init_session ()
 {
   char mutex_name[MAX_PATH];
@@ -75,7 +75,7 @@ tty_list::init_session ()
   ProtectHandle (mutex);
 }
 
-void __stdcall
+void
 tty::init_session ()
 {
   if (!myself->cygstarted && NOTSTATE (myself, PID_CYGPARENT))
diff --git a/winsup/cygwin/tty.h b/winsup/cygwin/tty.h
index c4f2b5dd7..3d0ea0c68 100644
--- a/winsup/cygwin/tty.h
+++ b/winsup/cygwin/tty.h
@@ -169,8 +169,8 @@ public:
   bool exists ();
   bool not_allocated (HANDLE&, HANDLE&);
   void set_master_ctl_closed () {master_pid = -1;}
-  static void __stdcall create_master (int);
-  static void __stdcall init_session ();
+  static void create_master (int);
+  static void init_session ();
   void wait_fwd ();
   bool pty_input_state_eq (xfer_dir x) { return pty_input_state == x; }
   bool nat_fg (pid_t pgid);
@@ -192,7 +192,7 @@ public:
   void init ();
   tty_min *get_cttyp ();
   int attach (int n);
-  static void __stdcall init_session ();
+  static void init_session ();
   friend class lock_ttys;
 };
 
diff --git a/winsup/cygwin/window.cc b/winsup/cygwin/window.cc
index 002053869..69430326a 100644
--- a/winsup/cygwin/window.cc
+++ b/winsup/cygwin/window.cc
@@ -52,7 +52,7 @@ process_window_events (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 }
 
 /* Handle windows events.  Inherits ownership of the wininfo lock */
-DWORD WINAPI
+DWORD
 wininfo::winthread ()
 {
   MSG msg;
@@ -92,7 +92,7 @@ wininfo::winthread ()
   return 0;
 }
 
-static DWORD WINAPI
+static DWORD
 winthread (VOID *arg)
 {
   return  ((wininfo *) arg)->winthread ();
diff --git a/winsup/cygwin/wininfo.h b/winsup/cygwin/wininfo.h
index 9dfba1a8c..323d272a5 100644
--- a/winsup/cygwin/wininfo.h
+++ b/winsup/cygwin/wininfo.h
@@ -16,7 +16,7 @@ public:
   int process (HWND, UINT, WPARAM, LPARAM);
   void lock ();
   void release ();
-  DWORD WINAPI winthread ();
+  DWORD winthread ();
 };
 
 extern wininfo winmsg;
diff --git a/winsup/cygwin/winlean.h b/winsup/cygwin/winlean.h
index de7305e26..da9ccbac2 100644
--- a/winsup/cygwin/winlean.h
+++ b/winsup/cygwin/winlean.h
@@ -106,7 +106,7 @@ extern "C" {
 
 /* IsWow64Process2 should be declared in <w32api/wow64apiset.h> but
    isn't yet. */
-BOOL WINAPI IsWow64Process2(HANDLE, USHORT *, USHORT *);
+BOOL IsWow64Process2(HANDLE, USHORT *, USHORT *);
 
 #ifdef __cplusplus
 }
diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h
index 4147dcebf..43dfbf46f 100644
--- a/winsup/cygwin/winsup.h
+++ b/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 *);
 
@@ -182,8 +182,8 @@ const char *find_first_notloaded_dll (class path_conv &);
 
 /**************************** Miscellaneous ******************************/
 
-void __stdcall set_std_handle (int);
-int __stdcall stat_dev (DWORD, int, unsigned long, struct stat *);
+void set_std_handle (int);
+int stat_dev (DWORD, int, unsigned long, struct stat *);
 
 ino_t hash_path_name (ino_t hash, PUNICODE_STRING name);
 ino_t hash_path_name (ino_t hash, PCWSTR name);
@@ -194,16 +194,16 @@ void *hook_or_detect_cygwin (const char *, const void *, WORD&, HANDLE h = NULL)
 void *hook_api (const char *mname, const char *name, const void *fn);
 
 /* Time related */
-void __stdcall totimeval (struct timeval *, PLARGE_INTEGER, int, int);
-time_t __stdcall to_time_t (PLARGE_INTEGER);
-void __stdcall to_timestruc_t (PLARGE_INTEGER, timestruc_t *);
-void __stdcall time_as_timestruc_t (timestruc_t *);
-void __stdcall timeval_to_filetime (const struct timeval *, PLARGE_INTEGER);
-void __stdcall timespec_to_filetime (const struct timespec *, PLARGE_INTEGER);
+void totimeval (struct timeval *, PLARGE_INTEGER, int, int);
+time_t to_time_t (PLARGE_INTEGER);
+void to_timestruc_t (PLARGE_INTEGER, timestruc_t *);
+void time_as_timestruc_t (timestruc_t *);
+void timeval_to_filetime (const struct timeval *, PLARGE_INTEGER);
+void timespec_to_filetime (const struct timespec *, PLARGE_INTEGER);
 bool timeval_to_ms (const struct timeval *, DWORD &);
 
 /* Console related */
-void __stdcall set_console_title (char *);
+void set_console_title (char *);
 void init_console_handler (bool);
 
 extern bool wsock_started;
diff --git a/winsup/testsuite/winsup.api/cygload.cc b/winsup/testsuite/winsup.api/cygload.cc
index faad5ce0e..b8e764058 100644
--- a/winsup/testsuite/winsup.api/cygload.cc
+++ b/winsup/testsuite/winsup.api/cygload.cc
@@ -216,7 +216,7 @@ cygwin::connector::~connector ()
   }
 }
 
-DWORD WINAPI
+DWORD
 cygwin::connector::signal_thread (void *param)
 {
   connector *that = reinterpret_cast < connector * > (param);
@@ -431,7 +431,7 @@ extern "C" int mainCRTStartup ();
 // This just pushes 4K onto the stack, backs up the original stack, and
 // jumps into the regular startup code.  This avoids having to worry about
 // backing up argc and argv.
-extern "C" int __stdcall
+extern "C" int
 cygloadCRTStartup ()
 {
   cygwin::padding padding;
diff --git a/winsup/testsuite/winsup.api/cygload.h b/winsup/testsuite/winsup.api/cygload.h
index 8007fd593..d62cc104c 100644
--- a/winsup/testsuite/winsup.api/cygload.h
+++ b/winsup/testsuite/winsup.api/cygload.h
@@ -111,7 +111,7 @@ namespace cygwin
     // we spawn a thread that does nothing but call sigwait().
 
     // This is the entry point:
-    static DWORD WINAPI signal_thread (void *);
+    static DWORD signal_thread (void *);
     // It runs this:
     void await_signal ();
     // And will execute this on receipt of any signal for which it's
diff --git a/winsup/utils/kill.cc b/winsup/utils/kill.cc
index d0fb54737..04c9774eb 100644
--- a/winsup/utils/kill.cc
+++ b/winsup/utils/kill.cc
@@ -154,7 +154,7 @@ get_debug_priv (void)
   CloseHandle (tok);
 }
 
-static void __stdcall
+static void
 forcekill (pid_t pid, DWORD winpid, int sig, int wait)
 {
   DWORD dwpid;
diff --git a/winsup/utils/loadlib.h b/winsup/utils/loadlib.h
index c83b76478..58566e475 100644
--- a/winsup/utils/loadlib.h
+++ b/winsup/utils/loadlib.h
@@ -21,7 +21,7 @@ static HMODULE _load_sys_library (const wchar_t *dll) __attribute__ ((used));
 static HMODULE
 _load_sys_library (const wchar_t *dll)
 {
-  static BOOL WINAPI (*set_dll_directory)(LPCWSTR);
+  static BOOL (*set_dll_directory)(LPCWSTR);
   static WCHAR sysdir[MAX_PATH];
   static UINT sysdir_len;
 
@@ -37,10 +37,10 @@ _load_sys_library (const wchar_t *dll)
     {
       HMODULE k32 = GetModuleHandleW (L"kernel32.dll");
       if (k32)
-      	set_dll_directory = (BOOL WINAPI (*)(LPCWSTR))
+      	set_dll_directory = (BOOL (*)(LPCWSTR))
 		     GetProcAddress (k32, "SetDllDirectoryW");
       if (!set_dll_directory)
-	set_dll_directory = (BOOL WINAPI (*)(LPCWSTR)) -1;
+	set_dll_directory = (BOOL (*)(LPCWSTR)) -1;
       else
       	set_dll_directory (L"");
     }
diff --git a/winsup/utils/mingw/cygcheck.cc b/winsup/utils/mingw/cygcheck.cc
index a9d2bc2b6..832f7dd98 100644
--- a/winsup/utils/mingw/cygcheck.cc
+++ b/winsup/utils/mingw/cygcheck.cc
@@ -1388,8 +1388,8 @@ dump_sysinfo ()
       if (osversion.dwMajorVersion >= 6)
 	{
 	  HMODULE k32 = GetModuleHandleW (L"kernel32.dll");
-	  BOOL (WINAPI *GetProductInfo) (DWORD, DWORD, DWORD, DWORD, PDWORD) =
-		  (BOOL (WINAPI *)(DWORD, DWORD, DWORD, DWORD, PDWORD))
+	  BOOL (*GetProductInfo) (DWORD, DWORD, DWORD, DWORD, PDWORD) =
+		  (BOOL (*)(DWORD, DWORD, DWORD, DWORD, PDWORD))
 		  GetProcAddress (k32, "GetProductInfo");
 	  if (osversion.dwMajorVersion == 6)
 	    switch (osversion.dwMinorVersion)
diff --git a/winsup/utils/mingw/strace.cc b/winsup/utils/mingw/strace.cc
index 2731fd391..9bf705a3f 100644
--- a/winsup/utils/mingw/strace.cc
+++ b/winsup/utils/mingw/strace.cc
@@ -258,7 +258,7 @@ make_command_line (linebuf & one_line, char **argv)
 
 static DWORD child_pid;
 
-static BOOL WINAPI
+static BOOL
 ctrl_c (DWORD)
 {
   static int tic = 1;
@@ -437,7 +437,7 @@ syst (long long t)
   return &st;
 }
 
-static void __stdcall
+static void
 handle_output_debug_string (DWORD id, LPVOID p, unsigned mask, FILE *ofile)
 {
   int len;
diff --git a/winsup/utils/profiler.cc b/winsup/utils/profiler.cc
index 2be7baf74..b4305cbea 100644
--- a/winsup/utils/profiler.cc
+++ b/winsup/utils/profiler.cc
@@ -227,7 +227,7 @@ bump_bucket (child *c, size_t pc)
 }
 
 /* profiler runs on its own thread; each child has a separate profiler. */
-DWORD WINAPI
+DWORD
 profiler (void *vp)
 {
   child *c = (child *) vp;
@@ -642,7 +642,7 @@ make_command_line (linebuf & one_line, char **argv)
     one_line.add ("", 1);
 }
 
-BOOL WINAPI
+BOOL
 ctrl_c (DWORD)
 {
   static int tic = 1;
diff --git a/winsup/utils/ps.cc b/winsup/utils/ps.cc
index b51657535..e66b0fa54 100644
--- a/winsup/utils/ps.cc
+++ b/winsup/utils/ps.cc
@@ -69,7 +69,7 @@ start_time (external_pinfo *child)
 #define NSPERSEC 10000000LL
 
 /* Convert a Win32 time to "UNIX" format. */
-long __stdcall
+long
 to_time_t (FILETIME *ptr)
 {
   /* A file time is the number of 100ns since jan 1 1601
diff --git a/winsup/utils/regtool.cc b/winsup/utils/regtool.cc
index fd2dd0590..ed2158493 100644
--- 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);
-- 
2.36.1



More information about the Cygwin-patches mailing list