From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29372 invoked by alias); 10 Mar 2005 14:08:51 -0000 Mailing-List: contact libc-hacker-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sources.redhat.com Received: (qmail 29217 invoked from network); 10 Mar 2005 14:08:50 -0000 Received: from unknown (HELO sunsite.mff.cuni.cz) (195.113.15.26) by sourceware.org with SMTP; 10 Mar 2005 14:08:50 -0000 Received: from sunsite.mff.cuni.cz (sunsite.mff.cuni.cz [127.0.0.1]) by sunsite.mff.cuni.cz (8.13.1/8.13.1) with ESMTP id j2AE8mXU011156; Thu, 10 Mar 2005 15:08:48 +0100 Received: (from jj@localhost) by sunsite.mff.cuni.cz (8.13.1/8.13.1/Submit) id j2AE8m3I011153; Thu, 10 Mar 2005 15:08:48 +0100 Date: Thu, 10 Mar 2005 14:08:00 -0000 From: Jakub Jelinek To: Ulrich Drepper , Roland McGrath Cc: Glibc hackers Subject: [PATCH] Use __always_inline instead of __inline for checking wrappers Message-ID: <20050310140848.GA4777@sunsite.mff.cuni.cz> Reply-To: Jakub Jelinek Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-SW-Source: 2005-03/txt/msg00036.txt.bz2 Hi! This is on top of patch from yesterday. Seems to work just fine. 2005-03-10 Jakub Jelinek * misc/sys/cdefs.h (__always_inline): Define. * posix/bits/unistd.h (read, pread, pread64, readlink, getcwd, getwd): Use __always_inline instead of __inline. * socket/bits/socket2.h (recv, recvfrom): Likewise. * libio/bits/stdio2.h (gets, fgets, fgets_unlocked): Likewise. * string/bits/string3.h (__memcpy_ichk, __memmove_ichk, __mempcpy_ichk, __memset_ichk, __strcpy_ichk, __stpcpy_ichk, __strncpy_ichk, __strcat_ichk, __strncat_ichk): Use __always_inline instead of __inline__ __attribute__ ((__always_inline__)). --- libc/misc/sys/cdefs.h.jj 2005-03-01 10:34:37.000000000 +0100 +++ libc/misc/sys/cdefs.h 2005-03-01 10:34:37.000000000 +0100 @@ -271,6 +271,13 @@ # define __wur /* Ignore */ #endif +/* Forces a function to be always inlined. */ +#if __GNUC_PREREQ (3,2) +# define __always_inline __inline __attribute__ ((__always_inline__)) +#else +# define __always_inline __inline +#endif + /* It is possible to compile containing GCC extensions even if GCC is run in pedantic mode if the uses are carefully marked using the `__extension__' keyword. But this is not generally available before --- libc/posix/bits/unistd.h.jj 2005-03-10 14:27:23.000000000 +0100 +++ libc/posix/bits/unistd.h 2005-03-10 14:28:23.160186942 +0100 @@ -26,7 +26,7 @@ extern ssize_t __read_chk (int __fd, voi extern ssize_t __REDIRECT (__read_alias, (int __fd, void *__buf, size_t __nbytes), read) __wur; -extern __inline __wur ssize_t +extern __always_inline __wur ssize_t read (int __fd, void *__buf, size_t __nbytes) { if (__bos0 (__buf) != (size_t) -1 @@ -46,8 +46,9 @@ extern ssize_t __REDIRECT (__pread_alias extern ssize_t __REDIRECT (__pread64_alias, (int __fd, void *__buf, size_t __nbytes, __off64_t __offset), pread64) __wur; + # ifndef __USE_FILE_OFFSET64 -extern __inline __wur ssize_t +extern __always_inline __wur ssize_t pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset) { if (__bos0 (__buf) != (size_t) -1 @@ -56,7 +57,7 @@ pread (int __fd, void *__buf, size_t __n return __pread_alias (__fd, __buf, __nbytes, __offset); } # else -extern __inline __wur ssize_t +extern __always_inline __wur ssize_t pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset) { if (__bos0 (__buf) != (size_t) -1 @@ -67,7 +68,7 @@ pread (int __fd, void *__buf, size_t __n # endif # ifdef __USE_LARGEFILE64 -extern __inline __wur ssize_t +extern __always_inline __wur ssize_t pread64 (int __fd, void *__buf, size_t __nbytes, __off64_t __offset) { if (__bos0 (__buf) != (size_t) -1 @@ -87,7 +88,8 @@ extern int __REDIRECT_NTH (__readlink_al (__const char *__restrict __path, char *__restrict __buf, size_t __len), readlink) __nonnull ((1, 2)) __wur; -extern __inline __nonnull ((1, 2)) __wur int + +extern __always_inline __nonnull ((1, 2)) __wur int __NTH (readlink (__const char *__restrict __path, char *__restrict __buf, size_t __len)) { @@ -102,7 +104,8 @@ extern char *__getcwd_chk (char *__buf, __THROW __wur; extern char *__REDIRECT_NTH (__getcwd_alias, (char *__buf, size_t __size), getcwd) __wur; -extern __inline __wur char * + +extern __always_inline __wur char * __NTH (getcwd (char *__buf, size_t __size)) { if (__bos (__buf) != (size_t) -1 @@ -116,7 +119,8 @@ extern char *__getwd_chk (char *__buf, s __THROW __nonnull ((1)) __wur; extern char *__REDIRECT_NTH (__getwd_alias, (char *__buf), getwd) __nonnull ((1)) __wur; -extern __inline __nonnull ((1)) __attribute_deprecated__ __wur char * + +extern __always_inline __nonnull ((1)) __attribute_deprecated__ __wur char * __NTH (getwd (char *__buf)) { if (__bos (__buf) != (size_t) -1) --- libc/socket/bits/socket2.h.jj 2005-03-10 14:27:23.000000000 +0100 +++ libc/socket/bits/socket2.h 2005-03-10 14:28:42.443749301 +0100 @@ -26,7 +26,7 @@ extern ssize_t __recv_chk (int __fd, voi extern ssize_t __REDIRECT (__recv_alias, (int __fd, void *__buf, size_t __n, int __flags), recv); -extern __inline ssize_t +extern __always_inline ssize_t recv (int __fd, void *__buf, size_t __n, int __flags) { if (__bos0 (__buf) != (size_t) -1 @@ -44,7 +44,7 @@ extern ssize_t __REDIRECT (__recvfrom_al int __flags, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len), recvfrom); -extern __inline ssize_t +extern __always_inline ssize_t recvfrom (int __fd, void *__buf, size_t __n, int __flags, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len) { --- libc/libio/bits/stdio2.h.jj 2005-03-10 14:27:23.000000000 +0100 +++ libc/libio/bits/stdio2.h 2005-03-10 14:30:27.678990211 +0100 @@ -74,7 +74,8 @@ extern int __vprintf_chk (int __flag, __ extern char *__gets_chk (char *__str, size_t) __wur; extern char *__REDIRECT (__gets_alias, (char *__str), gets) __wur; -extern __inline __wur char * + +extern __always_inline __wur char * gets (char *__str) { if (__bos (__str) != (size_t) -1) @@ -87,7 +88,8 @@ extern char *__fgets_chk (char *__restri extern char *__REDIRECT (__fgets_alias, (char *__restrict __s, int __n, FILE *__restrict __stream), fgets) __wur; -extern __inline __wur char * + +extern __always_inline __wur char * fgets (char *__restrict __s, int __n, FILE *__restrict __stream) { if (__bos (__s) != (size_t) -1 @@ -102,7 +104,8 @@ extern char *__fgets_unlocked_chk (char extern char *__REDIRECT (__fgets_unlocked_alias, (char *__restrict __s, int __n, FILE *__restrict __stream), fgets_unlocked) __wur; -extern __inline __wur char * + +extern __always_inline __wur char * fgets_unlocked (char *__restrict __s, int __n, FILE *__restrict __stream) { if (__bos (__s) != (size_t) -1 --- libc/string/bits/string3.h.jj 2005-03-01 10:34:46.000000000 +0100 +++ libc/string/bits/string3.h 2005-03-10 14:31:59.041707231 +0100 @@ -44,8 +44,7 @@ ((__bos0 (dest) != (size_t) -1) \ ? __builtin___memcpy_chk (dest, src, len, __bos0 (dest)) \ : __memcpy_ichk (dest, src, len)) -static __inline__ void * -__attribute__ ((__always_inline__)) +static __always_inline void * __memcpy_ichk (void *__restrict __dest, const void *__restrict __src, size_t __len) { @@ -57,8 +56,7 @@ __memcpy_ichk (void *__restrict __dest, ((__bos0 (dest) != (size_t) -1) \ ? __builtin___memmove_chk (dest, src, len, __bos0 (dest)) \ : __memmove_ichk (dest, src, len)) -static __inline__ void * -__attribute__ ((__always_inline__)) +static __always_inline void * __memmove_ichk (void *__dest, const void *__src, size_t __len) { return __builtin___memmove_chk (__dest, __src, __len, __bos0 (__dest)); @@ -70,8 +68,7 @@ __memmove_ichk (void *__dest, const void ((__bos0 (dest) != (size_t) -1) \ ? __builtin___mempcpy_chk (dest, src, len, __bos0 (dest)) \ : __mempcpy_ichk (dest, src, len)) -static __inline__ void * -__attribute__ ((__always_inline__)) +static __always_inline void * __mempcpy_ichk (void *__restrict __dest, const void *__restrict __src, size_t __len) { @@ -93,8 +90,7 @@ __warndecl (__warn_memset_zero_len, : ((__bos0 (dest) != (size_t) -1) \ ? __builtin___memset_chk (dest, ch, len, __bos0 (dest)) \ : __memset_ichk (dest, ch, len))) -static __inline__ void * -__attribute__ ((__always_inline__)) +static __always_inline void * __memset_ichk (void *__dest, int __ch, size_t __len) { return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest)); @@ -116,8 +112,7 @@ __memset_ichk (void *__dest, int __ch, s ((__bos (dest) != (size_t) -1) \ ? __builtin___strcpy_chk (dest, src, __bos (dest)) \ : __strcpy_ichk (dest, src)) -static __inline__ char * -__attribute__ ((__always_inline__)) +static __always_inline char * __strcpy_ichk (char *__restrict __dest, const char *__restrict __src) { return __builtin___strcpy_chk (__dest, __src, __bos (__dest)); @@ -129,8 +124,7 @@ __strcpy_ichk (char *__restrict __dest, ((__bos (dest) != (size_t) -1) \ ? __builtin___stpcpy_chk (dest, src, __bos (dest)) \ : __stpcpy_ichk (dest, src)) -static __inline__ char * -__attribute__ ((__always_inline__)) +static __always_inline char * __stpcpy_ichk (char *__restrict __dest, const char *__restrict __src) { return __builtin___stpcpy_chk (__dest, __src, __bos (__dest)); @@ -142,8 +136,7 @@ __stpcpy_ichk (char *__restrict __dest, ((__bos (dest) != (size_t) -1) \ ? __builtin___strncpy_chk (dest, src, len, __bos (dest)) \ : __strncpy_ichk (dest, src, len)) -static __inline__ char * -__attribute__ ((__always_inline__)) +static __always_inline char * __strncpy_ichk (char *__restrict __dest, const char *__restrict __src, size_t __len) { @@ -155,8 +148,7 @@ __strncpy_ichk (char *__restrict __dest, ((__bos (dest) != (size_t) -1) \ ? __builtin___strcat_chk (dest, src, __bos (dest)) \ : __strcat_ichk (dest, src)) -static __inline__ char * -__attribute__ ((__always_inline__)) +static __always_inline char * __strcat_ichk (char *__restrict __dest, const char *__restrict __src) { return __builtin___strcat_chk (__dest, __src, __bos (__dest)); @@ -167,8 +159,7 @@ __strcat_ichk (char *__restrict __dest, ((__bos (dest) != (size_t) -1) \ ? __builtin___strncat_chk (dest, src, len, __bos (dest)) \ : __strncat_ichk (dest, src, len)) -static __inline__ char * -__attribute__ ((__always_inline__)) +static __always_inline char * __strncat_ichk (char *__restrict __dest, const char *__restrict __src, size_t __len) { Jakub