This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] Use __NO_INLINE__ checks in glibc headers


Hi!

Now that gcc defines __NO_INLINE__ unless -O1+ was used and no -fno-inline was
specified, here is a patch to actually use it in glibc, so that -O2 -fno-inline 
#include <string.h>
work.
Alternatively, the ctype/stdlib/wchar checks could be replaced by simple
#ifdef __USE_EXTERN_INLINES, since the other conditions are guarded in
features.h (and anyone who uses -D__USE_EXTERN_INLINES with -fno-inline or
-O1 and up just deserves what he wanted). If you'd like me to prepare this
variant of the patch, just let me know.

2001-05-05  Jakub Jelinek  <jakub@redhat.com>

	* ctype/ctype.h (tolower, toupper): Only define as extern inline if
	__NO_INLINE__ is not defined.
	* include/features.h (__USE_EXTERN_INLINES): Likewise.
	* stdlib/stdlib.h (strtod, ...): Likewise.
	* wcsmbs/wchar (mbrlen): Likewise.
	* string/string.h: Only include bits/string.h and bits/string2.h
	if __NO_INLINE__ is not defined.

--- libc/ctype/ctype.h.jj	Thu Sep 14 09:09:36 2000
+++ libc/ctype/ctype.h	Sat May  5 15:54:12 2001
@@ -164,7 +164,7 @@ __exctype (_tolower);
 # endif
 
 # if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ \
- && defined __USE_EXTERN_INLINES
+     && !defined __NO_INLINE__ && defined __USE_EXTERN_INLINES
 extern __inline int
 tolower (int __c) __THROW
 {
--- libc/include/features.h.jj	Thu Nov  9 10:09:04 2000
+++ libc/include/features.h	Sat May  5 15:53:53 2001
@@ -293,7 +293,8 @@
 #endif	/* !ASSEMBLER */
 
 /* Decide whether we can define 'extern inline' functions in headers.  */
-#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__
+#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \
+    && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__
 # define __USE_EXTERN_INLINES	1
 #endif
 
--- libc/stdlib/stdlib.h.jj	Thu Feb  8 13:20:28 2001
+++ libc/stdlib/stdlib.h	Sat May  5 15:53:33 2001
@@ -288,7 +288,7 @@ extern unsigned long long int __strtoull
 #endif /* GCC */
 
 #if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ \
-    && defined __USE_EXTERN_INLINES
+    && !defined __NO_INLINE__ && defined __USE_EXTERN_INLINES
 /* Define inline functions which call the internal entry points.  */
 
 extern __inline double
--- libc/string/string.h.jj	Tue Apr 17 23:58:43 2001
+++ libc/string/string.h	Sat May  5 15:53:11 2001
@@ -333,7 +333,8 @@ extern char *basename (__const char *__f
 
 
 #if defined __GNUC__ && __GNUC__ >= 2
-# if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ && !defined __cplusplus
+# if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ \
+     && !defined __NO_INLINE__ && !defined __cplusplus
 /* When using GNU CC we provide some optimized versions of selected
    functions from this header.  There are two kinds of optimizations:
 
--- libc/wcsmbs/wchar.h.jj	Tue Apr 17 23:59:00 2001
+++ libc/wcsmbs/wchar.h	Sat May  5 15:52:57 2001
@@ -285,7 +285,7 @@ extern size_t mbrlen (__const char *__re
 		      mbstate_t *__restrict __ps) __THROW;
 
 #if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ \
-    && defined __USE_EXTERN_INLINES
+    && !defined __NO_INLINE__ && defined __USE_EXTERN_INLINES
 /* Define inline function as optimization.  */
 extern __inline size_t mbrlen (__const char *__restrict __s, size_t __n,
 			       mbstate_t *__restrict __ps) __THROW

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]