fortify-headers

standalone fortify-source implementation
git clone git://git.2f30.org/fortify-headers.git
Log | Files | Refs | README | LICENSE

commit 22e7e51007f3a28ded43f6cb8f0ff59a7a691175
parent c2c9d0c6c8a1d74f748aa2ad9442957a37091062
Author: Trutz Behn <me@trutz.be>
Date:   Sat, 14 Mar 2015 20:06:48 +0100

Use __typeof__ to in part avoid replicating function types

Diffstat:
include/poll.h | 6++----
include/stdio.h | 21+++++++--------------
include/stdlib.h | 3+--
include/string.h | 36++++++++++++------------------------
include/strings.h | 6++----
include/sys/socket.h | 12++++--------
include/unistd.h | 36++++++++++++------------------------
include/wchar.h | 48++++++++++++++++--------------------------------
8 files changed, 56 insertions(+), 112 deletions(-)

diff --git a/include/poll.h b/include/poll.h @@ -11,8 +11,7 @@ extern "C" { #undef poll -extern int __poll_orig(struct pollfd *, nfds_t, int) - __asm__(__USER_LABEL_PREFIX__ "poll"); +__typeof__(poll) __poll_orig __asm__(__USER_LABEL_PREFIX__ "poll"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) int poll(struct pollfd *fds, nfds_t nfds, int timeout) { @@ -25,8 +24,7 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout) #ifdef _GNU_SOURCE #undef ppoll -extern int __ppoll_orig(struct pollfd *, nfds_t, const struct timespec *, const sigset_t *) - __asm__(__USER_LABEL_PREFIX__ "ppoll"); +__typeof__(ppoll) __ppoll_orig __asm__(__USER_LABEL_PREFIX__ "ppoll"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) int ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout, const sigset_t *mask) { diff --git a/include/stdio.h b/include/stdio.h @@ -17,8 +17,7 @@ extern "C" { #undef snprintf #undef sprintf -extern char *__fgets_orig(char *, int, FILE *) - __asm__(__USER_LABEL_PREFIX__ "fgets"); +__typeof__(fgets) __fgets_orig __asm__(__USER_LABEL_PREFIX__ "fgets"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) char *fgets(char *s, int n, FILE *fp) { @@ -29,8 +28,7 @@ char *fgets(char *s, int n, FILE *fp) return __fgets_orig(s, n, fp); } -extern size_t __fread_orig(void *, size_t, size_t, FILE *) - __asm__(__USER_LABEL_PREFIX__ "fread"); +__typeof__(fread) __fread_orig __asm__(__USER_LABEL_PREFIX__ "fread"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) size_t fread(void *dst, size_t n, size_t nmemb, FILE *fp) { @@ -43,8 +41,7 @@ size_t fread(void *dst, size_t n, size_t nmemb, FILE *fp) return __fread_orig(dst, n, nmemb, fp); } -extern size_t __fwrite_orig(const void *, size_t, size_t, FILE *) - __asm__(__USER_LABEL_PREFIX__ "fwrite"); +__typeof__(fwrite) __fwrite_orig __asm__(__USER_LABEL_PREFIX__ "fwrite"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) size_t fwrite(const void *dst, size_t n, size_t nmemb, FILE *fp) { @@ -57,8 +54,7 @@ size_t fwrite(const void *dst, size_t n, size_t nmemb, FILE *fp) return __fwrite_orig(dst, n, nmemb, fp); } -extern int __vsnprintf_orig(char *, size_t, const char *, __builtin_va_list) - __asm__(__USER_LABEL_PREFIX__ "vsnprintf"); +__typeof__(vsnprintf) __vsnprintf_orig __asm__(__USER_LABEL_PREFIX__ "vsnprintf"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) int vsnprintf(char *s, size_t n, const char *fmt, __builtin_va_list ap) { @@ -69,8 +65,7 @@ int vsnprintf(char *s, size_t n, const char *fmt, __builtin_va_list ap) return __vsnprintf_orig(s, n, fmt, ap); } -extern int __vsprintf_orig(char *, const char *, __builtin_va_list) - __asm__(__USER_LABEL_PREFIX__ "vsprintf"); +__typeof__(vsprintf) __vsprintf_orig __asm__(__USER_LABEL_PREFIX__ "vsprintf"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) int vsprintf(char *s, const char *fmt, __builtin_va_list ap) { @@ -87,8 +82,7 @@ int vsprintf(char *s, const char *fmt, __builtin_va_list ap) return r; } -extern int __snprintf_orig(char *, size_t, const char *, ...) - __asm__(__USER_LABEL_PREFIX__ "snprintf"); +__typeof__(snprintf) __snprintf_orig __asm__(__USER_LABEL_PREFIX__ "snprintf"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) int snprintf(char *s, size_t n, const char *fmt, ...) { @@ -99,8 +93,7 @@ int snprintf(char *s, size_t n, const char *fmt, ...) return __snprintf_orig(s, n, fmt, __builtin_va_arg_pack()); } -extern int __sprintf_orig(char *, const char *, ...) - __asm__(__USER_LABEL_PREFIX__ "sprintf"); +__typeof__(sprintf) __sprintf_orig __asm__(__USER_LABEL_PREFIX__ "sprintf"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) int sprintf(char *s, const char *fmt, ...) { diff --git a/include/stdlib.h b/include/stdlib.h @@ -15,8 +15,7 @@ extern "C" { #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #undef realpath -extern char *__realpath_orig(const char *, char *) - __asm__(__USER_LABEL_PREFIX__ "realpath"); +__typeof__(realpath) __realpath_orig __asm__(__USER_LABEL_PREFIX__ "realpath"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) char *realpath(const char *path, char *resolved) { diff --git a/include/string.h b/include/string.h @@ -19,8 +19,7 @@ extern "C" { #undef strncat #undef strncpy -extern void *__memcpy_orig(void *, const void *, size_t) - __asm__(__USER_LABEL_PREFIX__ "memcpy"); +__typeof__(memcpy) __memcpy_orig __asm__(__USER_LABEL_PREFIX__ "memcpy"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) void *memcpy(void *dest, const void *src, size_t n) { @@ -38,8 +37,7 @@ void *memcpy(void *dest, const void *src, size_t n) return __memcpy_orig(dest, src, n); } -extern void *__memmove_orig(void *, const void *, size_t) - __asm__(__USER_LABEL_PREFIX__ "memmove"); +__typeof__(memmove) __memmove_orig __asm__(__USER_LABEL_PREFIX__ "memmove"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) void *memmove(void *dest, const void *src, size_t n) { @@ -50,8 +48,7 @@ void *memmove(void *dest, const void *src, size_t n) return __memmove_orig(dest, src, n); } -extern void *__memset_orig(void *, int, size_t) - __asm__(__USER_LABEL_PREFIX__ "memset"); +__typeof__(memset) __memset_orig __asm__(__USER_LABEL_PREFIX__ "memset"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) void *memset(void *dest, int c, size_t n) { @@ -62,8 +59,7 @@ void *memset(void *dest, int c, size_t n) return __memset_orig(dest, c, n); } -extern char *__stpcpy_orig(char *, const char *) - __asm__(__USER_LABEL_PREFIX__ "stpcpy"); +__typeof__(stpcpy) __stpcpy_orig __asm__(__USER_LABEL_PREFIX__ "stpcpy"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) char *stpcpy(char *dest, const char *src) { @@ -74,8 +70,7 @@ char *stpcpy(char *dest, const char *src) return __stpcpy_orig(dest, src); } -extern char *__stpncpy_orig(char *, const char *, size_t) - __asm__(__USER_LABEL_PREFIX__ "stpncpy"); +__typeof__(stpncpy) __stpncpy_orig __asm__(__USER_LABEL_PREFIX__ "stpncpy"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) char *stpncpy(char *dest, const char *src, size_t n) { @@ -86,8 +81,7 @@ char *stpncpy(char *dest, const char *src, size_t n) return __stpncpy_orig(dest, src, n); } -extern char *__strcat_orig(char *, const char *) - __asm__(__USER_LABEL_PREFIX__ "strcat"); +__typeof__(strcat) __strcat_orig __asm__(__USER_LABEL_PREFIX__ "strcat"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) char *strcat(char *dest, const char *src) { @@ -98,8 +92,7 @@ char *strcat(char *dest, const char *src) return __strcat_orig(dest, src); } -extern char *__strcpy_orig(char *, const char *) - __asm__(__USER_LABEL_PREFIX__ "strcpy"); +__typeof__(strcpy) __strcpy_orig __asm__(__USER_LABEL_PREFIX__ "strcpy"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) char *strcpy(char *dest, const char *src) { @@ -110,8 +103,7 @@ char *strcpy(char *dest, const char *src) return __strcpy_orig(dest, src); } -extern char *__strncat_orig(char *, const char *, size_t) - __asm__(__USER_LABEL_PREFIX__ "strncat"); +__typeof__(strncat) __strncat_orig __asm__(__USER_LABEL_PREFIX__ "strncat"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) char *strncat(char *dest, const char *src, size_t n) { @@ -129,8 +121,7 @@ char *strncat(char *dest, const char *src, size_t n) return __strncat_orig(dest, src, n); } -extern char *__strncpy_orig(char *, const char *, size_t) - __asm__(__USER_LABEL_PREFIX__ "strncpy"); +__typeof__(strncpy) __strncpy_orig __asm__(__USER_LABEL_PREFIX__ "strncpy"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) char *strncpy(char *dest, const char *src, size_t n) { @@ -143,8 +134,7 @@ char *strncpy(char *dest, const char *src, size_t n) #ifdef _GNU_SOURCE #undef mempcpy -extern void *__mempcpy_orig(void *, const void *, size_t n) - __asm__(__USER_LABEL_PREFIX__ "mempcpy"); +__typeof__(mempcpy) __mempcpy_orig __asm__(__USER_LABEL_PREFIX__ "mempcpy"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) void *mempcpy(void *dest, const void *src, size_t n) { @@ -159,8 +149,7 @@ void *mempcpy(void *dest, const void *src, size_t n) #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #undef strlcat #undef strlcpy -extern size_t __strlcat_orig(char *, const char *, size_t) - __asm__(__USER_LABEL_PREFIX__ "strlcat"); +__typeof__(strlcat) __strlcat_orig __asm__(__USER_LABEL_PREFIX__ "strlcat"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) size_t strlcat(char *dest, const char *src, size_t n) { @@ -171,8 +160,7 @@ size_t strlcat(char *dest, const char *src, size_t n) return __strlcat_orig(dest, src, n); } -extern size_t __strlcpy_orig(char *, const char *, size_t) - __asm__(__USER_LABEL_PREFIX__ "strlcpy"); +__typeof__(strlcpy) __strlcpy_orig __asm__(__USER_LABEL_PREFIX__ "strlcpy"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) size_t strlcpy(char *dest, const char *src, size_t n) { diff --git a/include/strings.h b/include/strings.h @@ -14,8 +14,7 @@ extern "C" { || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700) #undef bcopy #undef bzero -extern void __bcopy_orig(const void *, void *, size_t) - __asm__(__USER_LABEL_PREFIX__ "bcopy"); +__typeof__(bcopy) __bcopy_orig __asm__(__USER_LABEL_PREFIX__ "bcopy"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) void bcopy(const void *src, void *dest, size_t n) { @@ -26,8 +25,7 @@ void bcopy(const void *src, void *dest, size_t n) return __bcopy_orig(src, dest, n); } -extern void __bzero_orig(void *, size_t) - __asm__(__USER_LABEL_PREFIX__ "bzero"); +__typeof__(bzero) __bzero_orig __asm__(__USER_LABEL_PREFIX__ "bzero"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) void bzero(void *src, size_t n) { diff --git a/include/sys/socket.h b/include/sys/socket.h @@ -14,8 +14,7 @@ extern "C" { #undef send #undef sendto -extern ssize_t __recv_orig(int, void *, size_t, int) - __asm__(__USER_LABEL_PREFIX__ "recv"); +__typeof__(recv) __recv_orig __asm__(__USER_LABEL_PREFIX__ "recv"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) ssize_t recv(int sockfd, void *buf, size_t n, int flags) { @@ -26,8 +25,7 @@ ssize_t recv(int sockfd, void *buf, size_t n, int flags) return __recv_orig(sockfd, buf, n, flags); } -extern ssize_t __recvfrom_orig(int, void *, size_t, int, struct sockaddr *, socklen_t *) - __asm__(__USER_LABEL_PREFIX__ "recvfrom"); +__typeof__(recvfrom) __recvfrom_orig __asm__(__USER_LABEL_PREFIX__ "recvfrom"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) ssize_t recvfrom(int sockfd, void *buf, size_t n, int flags, struct sockaddr *sa, socklen_t *salen) @@ -39,8 +37,7 @@ ssize_t recvfrom(int sockfd, void *buf, size_t n, int flags, return __recvfrom_orig(sockfd, buf, n, flags, sa, salen); } -extern ssize_t __send_orig(int, const void *, size_t, int) - __asm__(__USER_LABEL_PREFIX__ "send"); +__typeof__(send) __send_orig __asm__(__USER_LABEL_PREFIX__ "send"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) ssize_t send(int sockfd, const void *buf, size_t n, int flags) { @@ -51,8 +48,7 @@ ssize_t send(int sockfd, const void *buf, size_t n, int flags) return __send_orig(sockfd, buf, n, flags); } -extern ssize_t __sendto_orig(int, const void *, size_t, int, const struct sockaddr *, socklen_t) - __asm__(__USER_LABEL_PREFIX__ "sendto"); +__typeof__(sendto) __sendto_orig __asm__(__USER_LABEL_PREFIX__ "sendto"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) ssize_t sendto(int sockfd, const void *buf, size_t n, int flags, const struct sockaddr *sa, socklen_t salen) diff --git a/include/unistd.h b/include/unistd.h @@ -21,8 +21,7 @@ extern "C" { #undef ttyname_r #undef write -extern size_t __confstr_orig(int, char *, size_t) - __asm__(__USER_LABEL_PREFIX__ "confstr"); +__typeof__(confstr) __confstr_orig __asm__(__USER_LABEL_PREFIX__ "confstr"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) size_t confstr(int name, char *buf, size_t len) { @@ -33,8 +32,7 @@ size_t confstr(int name, char *buf, size_t len) return __confstr_orig(name, buf, len); } -extern char *__getcwd_orig(char *, size_t) - __asm__(__USER_LABEL_PREFIX__ "getcwd"); +__typeof__(getcwd) __getcwd_orig __asm__(__USER_LABEL_PREFIX__ "getcwd"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) char *getcwd(char *buf, size_t len) { @@ -47,8 +45,7 @@ char *getcwd(char *buf, size_t len) #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #undef getdomainname -extern int __getdomainname_orig(char *, size_t) - __asm__(__USER_LABEL_PREFIX__ "getdomainname"); +__typeof__(getdomainname) __getdomainname_orig __asm__(__USER_LABEL_PREFIX__ "getdomainname"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) int getdomainname(char *name, size_t len) { @@ -60,8 +57,7 @@ int getdomainname(char *name, size_t len) } #endif -extern int __getgroups_orig(int, gid_t *) - __asm__(__USER_LABEL_PREFIX__ "getgroups"); +__typeof__(getgroups) __getgroups_orig __asm__(__USER_LABEL_PREFIX__ "getgroups"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) int getgroups(int len, gid_t *set) { @@ -72,8 +68,7 @@ int getgroups(int len, gid_t *set) return __getgroups_orig(len, set); } -extern int __gethostname_orig(char *, size_t) - __asm__(__USER_LABEL_PREFIX__ "gethostname"); +__typeof__(gethostname) __gethostname_orig __asm__(__USER_LABEL_PREFIX__ "gethostname"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) int gethostname(char *name, size_t len) { @@ -84,8 +79,7 @@ int gethostname(char *name, size_t len) return __gethostname_orig(name, len); } -extern int __getlogin_r_orig(char *, size_t) - __asm__(__USER_LABEL_PREFIX__ "getlogin_r"); +__typeof__(getlogin_r) __getlogin_r_orig __asm__(__USER_LABEL_PREFIX__ "getlogin_r"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) int getlogin_r(char *name, size_t len) { @@ -96,8 +90,7 @@ int getlogin_r(char *name, size_t len) return __getlogin_r_orig(name, len); } -extern ssize_t __pread_orig(int, void *, size_t, off_t) - __asm__(__USER_LABEL_PREFIX__ "pread"); +__typeof__(pread) __pread_orig __asm__(__USER_LABEL_PREFIX__ "pread"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) ssize_t pread(int fd, void *buf, size_t n, off_t offset) { @@ -108,8 +101,7 @@ ssize_t pread(int fd, void *buf, size_t n, off_t offset) return __pread_orig(fd, buf, n, offset); } -extern ssize_t __read_orig(int, void *, size_t) - __asm__(__USER_LABEL_PREFIX__ "read"); +__typeof__(read) __read_orig __asm__(__USER_LABEL_PREFIX__ "read"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) ssize_t read(int fd, void *buf, size_t n) { @@ -120,8 +112,7 @@ ssize_t read(int fd, void *buf, size_t n) return __read_orig(fd, buf, n); } -extern ssize_t __readlink_orig(const char *, char *, size_t) - __asm__(__USER_LABEL_PREFIX__ "readlink"); +__typeof__(readlink) __readlink_orig __asm__(__USER_LABEL_PREFIX__ "readlink"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) ssize_t readlink(const char *path, char *buf, size_t n) { @@ -132,8 +123,7 @@ ssize_t readlink(const char *path, char *buf, size_t n) return __readlink_orig(path, buf, n); } -extern ssize_t __readlinkat_orig(int, const char *, char *, size_t) - __asm__(__USER_LABEL_PREFIX__ "readlinkat"); +__typeof__(readlinkat) __readlinkat_orig __asm__(__USER_LABEL_PREFIX__ "readlinkat"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) ssize_t readlinkat(int fd, const char *path, char *buf, size_t n) { @@ -144,8 +134,7 @@ ssize_t readlinkat(int fd, const char *path, char *buf, size_t n) return __readlinkat_orig(fd, path, buf, n); } -extern int __ttyname_r_orig(int, char *, size_t) - __asm__(__USER_LABEL_PREFIX__ "ttyname_r"); +__typeof__(ttyname_r) __ttyname_r_orig __asm__(__USER_LABEL_PREFIX__ "ttyname_r"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) int ttyname_r(int fd, char *name, size_t n) { @@ -156,8 +145,7 @@ int ttyname_r(int fd, char *name, size_t n) return __ttyname_r_orig(fd, name, n); } -extern ssize_t __write_orig(int, const void *, size_t) - __asm__(__USER_LABEL_PREFIX__ "write"); +__typeof__(write) __write_orig __asm__(__USER_LABEL_PREFIX__ "write"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) ssize_t write(int fd, const void *buf, size_t n) { diff --git a/include/wchar.h b/include/wchar.h @@ -27,8 +27,7 @@ extern "C" { #undef wmemmove #undef wmemset -extern wchar_t *__fgetws_orig(wchar_t *, int, FILE *) - __asm__(__USER_LABEL_PREFIX__ "fgetws"); +__typeof__(fgetws) __fgetws_orig __asm__(__USER_LABEL_PREFIX__ "fgetws"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) wchar_t *fgetws(wchar_t *s, int n, FILE *fp) { @@ -39,8 +38,7 @@ wchar_t *fgetws(wchar_t *s, int n, FILE *fp) return __fgetws_orig(s, n, fp); } -extern size_t __mbsnrtowcs_orig(wchar_t *, const char **, size_t, size_t, mbstate_t *) - __asm__(__USER_LABEL_PREFIX__ "mbsnrtowcs"); +__typeof__(mbsnrtowcs) __mbsnrtowcs_orig __asm__(__USER_LABEL_PREFIX__ "mbsnrtowcs"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) size_t mbsnrtowcs(wchar_t *d, const char **s, size_t n, size_t wn, mbstate_t *st) { @@ -60,8 +58,7 @@ size_t mbsnrtowcs(wchar_t *d, const char **s, size_t n, size_t wn, mbstate_t *st return r; } -extern size_t __mbsrtowcs_orig(wchar_t *, const char **, size_t, mbstate_t *) - __asm__(__USER_LABEL_PREFIX__ "mbsrtowcs"); +__typeof__(mbsrtowcs) __mbsrtowcs_orig __asm__(__USER_LABEL_PREFIX__ "mbsrtowcs"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) size_t mbsrtowcs(wchar_t *d, const char **s, size_t wn, mbstate_t *st) { @@ -75,8 +72,7 @@ size_t mbsrtowcs(wchar_t *d, const char **s, size_t wn, mbstate_t *st) return r; } -extern size_t __mbstowcs_orig(wchar_t *, const char *, size_t) - __asm__(__USER_LABEL_PREFIX__ "mbstowcs"); +__typeof__(mbstowcs) __mbstowcs_orig __asm__(__USER_LABEL_PREFIX__ "mbstowcs"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) size_t mbstowcs(wchar_t *ws, const char *s, size_t wn) { @@ -87,8 +83,7 @@ size_t mbstowcs(wchar_t *ws, const char *s, size_t wn) return __mbstowcs_orig(ws, s, wn); } -extern size_t __wcrtomb_orig(char *, wchar_t, mbstate_t *) - __asm__(__USER_LABEL_PREFIX__ "wcrtomb"); +__typeof__(wcrtomb) __wcrtomb_orig __asm__(__USER_LABEL_PREFIX__ "wcrtomb"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) size_t wcrtomb(char *s, wchar_t wc, mbstate_t *st) { @@ -99,8 +94,7 @@ size_t wcrtomb(char *s, wchar_t wc, mbstate_t *st) return __wcrtomb_orig(s, wc, st); } -extern wchar_t *__wcscat_orig(wchar_t *, const wchar_t *) - __asm__(__USER_LABEL_PREFIX__ "wcscat"); +__typeof__(wcscat) __wcscat_orig __asm__(__USER_LABEL_PREFIX__ "wcscat"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) wchar_t *wcscat(wchar_t *d, const wchar_t *s) { @@ -111,8 +105,7 @@ wchar_t *wcscat(wchar_t *d, const wchar_t *s) return __wcscat_orig(d, s); } -extern wchar_t *__wcscpy_orig(wchar_t *, const wchar_t *) - __asm__(__USER_LABEL_PREFIX__ "wcscpy"); +__typeof__(wcscpy) __wcscpy_orig __asm__(__USER_LABEL_PREFIX__ "wcscpy"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) wchar_t *wcscpy(wchar_t *d, const wchar_t *s) { @@ -123,8 +116,7 @@ wchar_t *wcscpy(wchar_t *d, const wchar_t *s) return __wcscpy_orig(d, s); } -extern wchar_t *__wcsncat_orig(wchar_t *, const wchar_t *, size_t) - __asm__(__USER_LABEL_PREFIX__ "wcsncat"); +__typeof__(wcsncat) __wcsncat_orig __asm__(__USER_LABEL_PREFIX__ "wcsncat"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) wchar_t *wcsncat(wchar_t *d, const wchar_t *s, size_t n) { @@ -142,8 +134,7 @@ wchar_t *wcsncat(wchar_t *d, const wchar_t *s, size_t n) return __wcsncat_orig(d, s, n); } -extern wchar_t *__wcsncpy_orig(wchar_t *, const wchar_t *, size_t) - __asm__(__USER_LABEL_PREFIX__ "wcsncpy"); +__typeof__(wcsncpy) __wcsncpy_orig __asm__(__USER_LABEL_PREFIX__ "wcsncpy"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) wchar_t *wcsncpy(wchar_t *d, const wchar_t *s, size_t n) { @@ -154,8 +145,7 @@ wchar_t *wcsncpy(wchar_t *d, const wchar_t *s, size_t n) return __wcsncpy_orig(d, s, n); } -extern size_t __wcsnrtombs_orig(char *, const wchar_t **, size_t, size_t, mbstate_t *) - __asm__(__USER_LABEL_PREFIX__ "wcsnrtombs"); +__typeof__(wcsnrtombs) __wcsnrtombs_orig __asm__(__USER_LABEL_PREFIX__ "wcsnrtombs"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) size_t wcsnrtombs(char *d, const wchar_t **s, size_t wn, size_t n, mbstate_t *st) { @@ -175,8 +165,7 @@ size_t wcsnrtombs(char *d, const wchar_t **s, size_t wn, size_t n, mbstate_t *st return r; } -extern size_t __wcsrtombs_orig(char *, const wchar_t **, size_t, mbstate_t *) - __asm__(__USER_LABEL_PREFIX__ "wcsrtombs"); +__typeof__(wcsrtombs) __wcsrtombs_orig __asm__(__USER_LABEL_PREFIX__ "wcsrtombs"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) size_t wcsrtombs(char *d, const wchar_t **s, size_t n, mbstate_t *st) { @@ -189,8 +178,7 @@ size_t wcsrtombs(char *d, const wchar_t **s, size_t n, mbstate_t *st) return r; } -extern size_t __wcstombs_orig(char *, const wchar_t *, size_t) - __asm__(__USER_LABEL_PREFIX__ "wcstombs"); +__typeof__(wcstombs) __wcstombs_orig __asm__(__USER_LABEL_PREFIX__ "wcstombs"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) size_t wcstombs(char *s, const wchar_t *ws, size_t n) { @@ -201,8 +189,7 @@ size_t wcstombs(char *s, const wchar_t *ws, size_t n) return __wcstombs_orig(s, ws, n); } -extern int __wctomb_orig(char *, wchar_t) - __asm__(__USER_LABEL_PREFIX__ "wctomb"); +__typeof__(wctomb) __wctomb_orig __asm__(__USER_LABEL_PREFIX__ "wctomb"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) int wctomb(char *s, wchar_t wc) { @@ -213,8 +200,7 @@ int wctomb(char *s, wchar_t wc) return __wctomb_orig(s, wc); } -extern wchar_t *__wmemcpy_orig(wchar_t *, const wchar_t *, size_t) - __asm__(__USER_LABEL_PREFIX__ "wmemcpy"); +__typeof__(wmemcpy) __wmemcpy_orig __asm__(__USER_LABEL_PREFIX__ "wmemcpy"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) wchar_t *wmemcpy(wchar_t *d, const wchar_t *s, size_t n) { @@ -225,8 +211,7 @@ wchar_t *wmemcpy(wchar_t *d, const wchar_t *s, size_t n) return __wmemcpy_orig(d, s, n); } -extern wchar_t *__wmemmove_orig(wchar_t *, const wchar_t *, size_t) - __asm__(__USER_LABEL_PREFIX__ "wmemmove"); +__typeof__(wmemmove) __wmemmove_orig __asm__(__USER_LABEL_PREFIX__ "wmemmove"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) wchar_t *wmemmove(wchar_t *d, const wchar_t *s, size_t n) { @@ -237,8 +222,7 @@ wchar_t *wmemmove(wchar_t *d, const wchar_t *s, size_t n) return __wmemmove_orig(d, s, n); } -extern wchar_t *__wmemset_orig(wchar_t *, wchar_t, size_t) - __asm__(__USER_LABEL_PREFIX__ "wmemset"); +__typeof__(wmemset) __wmemset_orig __asm__(__USER_LABEL_PREFIX__ "wmemset"); extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) wchar_t *wmemset(wchar_t *s, wchar_t c, size_t n) {