Cygwin: remove most occurrences of __stdcall and __cdecl

These have no effect on x86_64.  Retain a few occurrences of __cdecl
in files imported from other sources.

Also retain all occurrences of WINAPI, even though the latter is
simply a macro that expands to __stdcall.  Most of these occurrences
are associated with Windows API functions, and removing them might
make the code confusing instead of simpler.
This commit is contained in:
Ken Brown 2022-06-06 12:00:45 -04:00
parent cb4b4548c8
commit 30c5411d07
49 changed files with 147 additions and 147 deletions

View File

@ -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
{

View File

@ -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;

View File

@ -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")));

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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];

View File

@ -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;

View File

@ -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;
@ -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);

View File

@ -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:

View File

@ -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 ();

View File

@ -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 */

View File

@ -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];

View File

@ -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 };

View File

@ -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);

View File

@ -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);

View File

@ -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)

View File

@ -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);

View File

@ -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)
{

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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)

View File

@ -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;

View File

@ -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? */

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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 */

View File

@ -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;

View File

@ -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)
{

View File

@ -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)

View File

@ -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 *);

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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))

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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))

View File

@ -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;
};

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -68,7 +68,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