* [PATCH] Use __always_inline instead of __inline for checking wrappers
@ 2005-03-10 14:08 Jakub Jelinek
2005-03-13 8:11 ` Roland McGrath
2005-03-19 0:16 ` Ulrich Drepper
0 siblings, 2 replies; 3+ messages in thread
From: Jakub Jelinek @ 2005-03-10 14:08 UTC (permalink / raw)
To: Ulrich Drepper, Roland McGrath; +Cc: Glibc hackers
Hi!
This is on top of patch from yesterday. Seems to work just fine.
2005-03-10 Jakub Jelinek <jakub@redhat.com>
* 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Use __always_inline instead of __inline for checking wrappers
2005-03-10 14:08 [PATCH] Use __always_inline instead of __inline for checking wrappers Jakub Jelinek
@ 2005-03-13 8:11 ` Roland McGrath
2005-03-19 0:16 ` Ulrich Drepper
1 sibling, 0 replies; 3+ messages in thread
From: Roland McGrath @ 2005-03-13 8:11 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Ulrich Drepper, Glibc hackers
Do you use __always_inline just to make the decl shorter? I don't think
there is really any need for the macro, at least not for the sake of
checking wrappers such as these. Those will never be enabled with a GCC
version too old to support __attribute__ ((__always_inline__)).
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Use __always_inline instead of __inline for checking wrappers
2005-03-10 14:08 [PATCH] Use __always_inline instead of __inline for checking wrappers Jakub Jelinek
2005-03-13 8:11 ` Roland McGrath
@ 2005-03-19 0:16 ` Ulrich Drepper
1 sibling, 0 replies; 3+ messages in thread
From: Ulrich Drepper @ 2005-03-19 0:16 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Glibc hackers
[-- Attachment #1: Type: text/plain, Size: 109 bytes --]
Applied.
--
⧠Ulrich Drepper ⧠Red Hat, Inc. ⧠444 Castro St ⧠Mountain View, CA â
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 251 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-03-19 0:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-10 14:08 [PATCH] Use __always_inline instead of __inline for checking wrappers Jakub Jelinek
2005-03-13 8:11 ` Roland McGrath
2005-03-19 0:16 ` Ulrich Drepper
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).