Use aliases instead of #defines for the varargs functions when using

gcc.
This commit is contained in:
Alexandre Julliard 2003-03-26 01:29:56 +00:00
parent 1c7afd87f6
commit 98f020234c
4 changed files with 40 additions and 13 deletions

View File

@ -40,9 +40,7 @@ unsigned short _outpw(unsigned short, unsigned short);
#ifndef USE_MSVCRT_PREFIX #ifndef USE_MSVCRT_PREFIX
static inline char* cgets(char* str) { return _cgets(str); } static inline char* cgets(char* str) { return _cgets(str); }
#define cprintf _cprintf
static inline int cputs(const char* str) { return _cputs(str); } static inline int cputs(const char* str) { return _cputs(str); }
#define cscanf _cscanf
static inline int getch(void) { return _getch(); } static inline int getch(void) { return _getch(); }
static inline int getche(void) { return _getche(); } static inline int getche(void) { return _getche(); }
static inline int kbhit(void) { return _kbhit(); } static inline int kbhit(void) { return _kbhit(); }
@ -54,6 +52,15 @@ static inline unsigned short inpw(unsigned short i) { return _inpw(i); }
static inline int outp(unsigned short i, int j) { return _outp(i, j); } static inline int outp(unsigned short i, int j) { return _outp(i, j); }
static inline unsigned short outpw(unsigned short i, unsigned short j) { return _outpw(i, j); } static inline unsigned short outpw(unsigned short i, unsigned short j) { return _outpw(i, j); }
#endif #endif
#ifdef __GNUC__
extern int cprintf(const char*,...) __attribute__((alias("_cprintf"),format(printf,1,2)));
extern int cscanf(const char*,...) __attribute__((alias("_cscanf"),format(scanf,1,2)));
#else
#define cprintf _cprintf
#define cscanf _cscanf
#endif /* __GNUC__ */
#endif /* USE_MSVCRT_PREFIX */ #endif /* USE_MSVCRT_PREFIX */
#endif /* __WINE_CONIO_H */ #endif /* __WINE_CONIO_H */

View File

@ -169,10 +169,8 @@ static inline int isatty(int fd) { return _isatty(fd); }
static inline int locking(int fd, int mode, long size) { return _locking(fd, mode, size); } static inline int locking(int fd, int mode, long size) { return _locking(fd, mode, size); }
static inline long lseek(int fd, long off, int where) { return _lseek(fd, off, where); } static inline long lseek(int fd, long off, int where) { return _lseek(fd, off, where); }
static inline char* mktemp(char* pat) { return _mktemp(pat); } static inline char* mktemp(char* pat) { return _mktemp(pat); }
#define open _open
static inline int read(int fd, void* buf, unsigned int size) { return _read(fd, buf, size); } static inline int read(int fd, void* buf, unsigned int size) { return _read(fd, buf, size); }
static inline int setmode(int fd, int mode) { return _setmode(fd, mode); } static inline int setmode(int fd, int mode) { return _setmode(fd, mode); }
#define sopen _sopen
static inline long tell(int fd) { return _tell(fd); } static inline long tell(int fd) { return _tell(fd); }
#ifndef MSVCRT_UMASK_DEFINED #ifndef MSVCRT_UMASK_DEFINED
static inline int umask(int fd) { return _umask(fd); } static inline int umask(int fd) { return _umask(fd); }
@ -183,6 +181,15 @@ static inline int unlink(const char* path) { return _unlink(path); }
#define MSVCRT_UNLINK_DEFINED #define MSVCRT_UNLINK_DEFINED
#endif #endif
static inline int write(int fd, const void* buf, unsigned int size) { return _write(fd, buf, size); } static inline int write(int fd, const void* buf, unsigned int size) { return _write(fd, buf, size); }
#ifdef __GNUC__
extern int open(const char*,int,...) __attribute__((alias("_open")));
extern int sopen(const char*,int,int,...) __attribute__((alias("_sopen")));
#else
#define open _open
#define sopen _sopen
#endif /* __GNUC__ */
#endif /* USE _MSVCRT_PREFIX */ #endif /* USE _MSVCRT_PREFIX */
#endif /* __WINE_IO_H */ #endif /* __WINE_IO_H */

View File

@ -123,22 +123,35 @@ int _wsystem(const MSVCRT(wchar_t)*);
static inline int cwait(int *status, int pid, int action) { return _cwait(status, pid, action); } static inline int cwait(int *status, int pid, int action) { return _cwait(status, pid, action); }
static inline int getpid(void) { return _getpid(); } static inline int getpid(void) { return _getpid(); }
#define execl _execl
#define execle _execle
#define execlp _execlp
#define execlpe _execlpe
static inline int execv(const char* name, char* const* argv) { return _execv(name, argv); } static inline int execv(const char* name, char* const* argv) { return _execv(name, argv); }
static inline int execve(const char* name, char* const* argv, const char* const* envv) { return _execve(name, argv, envv); } static inline int execve(const char* name, char* const* argv, const char* const* envv) { return _execve(name, argv, envv); }
static inline int execvp(const char* name, char* const* argv) { return _execvp(name, argv); } static inline int execvp(const char* name, char* const* argv) { return _execvp(name, argv); }
static inline int execvpe(const char* name, char* const* argv, const char* const* envv) { return _execvpe(name, argv, envv); } static inline int execvpe(const char* name, char* const* argv, const char* const* envv) { return _execvpe(name, argv, envv); }
#define spawnl _spawnl
#define spawnle _spawnle
#define spawnlp _spawnlp
#define spawnlpe _spawnlpe
static inline int spawnv(int flags, const char* name, const char* const* argv) { return _spawnv(flags, name, argv); } static inline int spawnv(int flags, const char* name, const char* const* argv) { return _spawnv(flags, name, argv); }
static inline int spawnve(int flags, const char* name, const char* const* argv, const char* const* envv) { return _spawnve(flags, name, argv, envv); } static inline int spawnve(int flags, const char* name, const char* const* argv, const char* const* envv) { return _spawnve(flags, name, argv, envv); }
static inline int spawnvp(int flags, const char* name, const char* const* argv) { return _spawnvp(flags, name, argv); } static inline int spawnvp(int flags, const char* name, const char* const* argv) { return _spawnvp(flags, name, argv); }
static inline int spawnvpe(int flags, const char* name, const char* const* argv, const char* const* envv) { return _spawnvpe(flags, name, argv, envv); } static inline int spawnvpe(int flags, const char* name, const char* const* argv, const char* const* envv) { return _spawnvpe(flags, name, argv, envv); }
#ifdef __GNUC__
extern int execl(const char*,const char*,...) __attribute__((alias("_execl")));
extern int execle(const char*,const char*,...) __attribute__((alias("_execle")));
extern int execlp(const char*,const char*,...) __attribute__((alias("_execlp")));
extern int execlpe(const char*,const char*,...) __attribute__((alias("_execlpe")));
extern int spawnl(int,const char*,const char*,...) __attribute__((alias("_spawnl")));
extern int spawnle(int,const char*,const char*,...) __attribute__((alias("_spawnle")));
extern int spawnlp(int,const char*,const char*,...) __attribute__((alias("_spawnlp")));
extern int spawnlpe(int,const char*,const char*,...) __attribute__((alias("_spawnlpe")));
#else
#define execl _execl
#define execle _execle
#define execlp _execlp
#define execlpe _execlpe
#define spawnl _spawnl
#define spawnle _spawnle
#define spawnlp _spawnlp
#define spawnlpe _spawnlpe
#endif /* __GNUC__ */
#endif /* USE_MSVCRT_PREFIX */ #endif /* USE_MSVCRT_PREFIX */
#endif /* __WINE_PROCESS_H */ #endif /* __WINE_PROCESS_H */

View File

@ -272,7 +272,7 @@ static inline MSVCRT(wint_t) fgetwchar(void) { return _fgetwchar(); }
static inline MSVCRT(wint_t) fputwchar(MSVCRT(wint_t) wc) { return _fputwchar(wc); } static inline MSVCRT(wint_t) fputwchar(MSVCRT(wint_t) wc) { return _fputwchar(wc); }
static inline int getw(MSVCRT(FILE)* file) { return _getw(file); } static inline int getw(MSVCRT(FILE)* file) { return _getw(file); }
static inline int putw(int val, MSVCRT(FILE)* file) { return _putw(val, file); } static inline int putw(int val, MSVCRT(FILE)* file) { return _putw(val, file); }
#define wpopen _wpopen static inline MSVCRT(FILE)* wpopen(const MSVCRT(wchar_t)* command,const MSVCRT(wchar_t)* mode) { return _wpopen(command, mode); }
#endif /* USE_MSVCRT_PREFIX */ #endif /* USE_MSVCRT_PREFIX */
#endif /* __WINE_STDIO_H */ #endif /* __WINE_STDIO_H */