[git commit master 1/1] sleep: employ __USE_EXTERN_INLINES (with necessary fixes)

Denys Vlasenko dvlasenk at redhat.com
Fri Oct 22 13:24:13 UTC 2010


commit: http://git.uclibc.org/uClibc/commit/?id=251a3c19cb4bba47fcd38c697b3d7679b3edb137
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master

__USE_EXTERN_INLINES was unused and had bit-rotted, had to fix it
when it didn't work as intended at first.

    text	   data	    bss	    dec	    hex	filename
-    168	      0	      0	    168	     a8	libc/unistd/sleep.o
+    146	      0	      0	    146	     92	libc/unistd/sleep.o

Signed-off-by: Denys Vlasenko <dvlasenk at redhat.com>
---
 libc/signal/sigsetops.c                 |    2 +-
 libc/sysdeps/linux/common/bits/sigset.h |   14 ++++++++++----
 libc/unistd/sleep.c                     |    7 ++++++-
 3 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/libc/signal/sigsetops.c b/libc/signal/sigsetops.c
index c47a87b..e39d32f 100644
--- a/libc/signal/sigsetops.c
+++ b/libc/signal/sigsetops.c
@@ -3,7 +3,7 @@
 
 #include <features.h>
 
-#define _EXTERN_INLINE
+#define __PROVIDE_OUT_OF_LINE_SIGSETFN
 #ifndef __USE_EXTERN_INLINES
 # define __USE_EXTERN_INLINES	1
 #endif
diff --git a/libc/sysdeps/linux/common/bits/sigset.h b/libc/sysdeps/linux/common/bits/sigset.h
index 2f67a4e..7c2ce0e 100644
--- a/libc/sysdeps/linux/common/bits/sigset.h
+++ b/libc/sysdeps/linux/common/bits/sigset.h
@@ -53,10 +53,6 @@ typedef struct {
 #if !defined _SIGSET_H_fns && defined _SIGNAL_H
 # define _SIGSET_H_fns 1
 
-# ifndef _EXTERN_INLINE
-#  define _EXTERN_INLINE extern __inline
-# endif
-
 /* Return a mask that includes the bit for SIG only.  */
 /* Unsigned cast ensures shift/mask insns are used.  */
 # define __sigmask(sig) \
@@ -156,14 +152,24 @@ typedef struct {
 /* These functions needn't check for a bogus signal number -- error
    checking is done in the non __ versions.  */
 
+# if !defined __USE_EXTERN_INLINES || defined __PROVIDE_OUT_OF_LINE_SIGSETFN
 extern int __sigismember (__const __sigset_t *, int);
 libc_hidden_proto(__sigismember)
 extern int __sigaddset (__sigset_t *, int);
 libc_hidden_proto(__sigaddset)
 extern int __sigdelset (__sigset_t *, int);
 libc_hidden_proto(__sigdelset)
+# endif
 
 # ifdef __USE_EXTERN_INLINES
+#  undef _EXTERN_INLINE
+#  ifdef __PROVIDE_OUT_OF_LINE_SIGSETFN
+#   define _EXTERN_INLINE
+#  else /* normal case */
+    /* dropped extern below: otherwise every module with __USE_EXTERN_INLINES
+     * will have its own copy of out-of line function emitted. */
+#   define _EXTERN_INLINE /*extern*/ __always_inline
+#  endif
 #  define __SIGSETFN(NAME, BODY, CONST)					\
 _EXTERN_INLINE int							\
 NAME (CONST __sigset_t *__set, int __sig)				\
diff --git a/libc/unistd/sleep.c b/libc/unistd/sleep.c
index 481e635..438f5e2 100644
--- a/libc/unistd/sleep.c
+++ b/libc/unistd/sleep.c
@@ -20,8 +20,13 @@
 
 #include <errno.h>
 #include <time.h>
-#include <signal.h>
 #include <unistd.h>
+/* Want fast and small __sigemptyset/__sigaddset/__sigismember: */
+/* TODO: make them available (to everybody) without this hack */
+#ifndef __USE_EXTERN_INLINES
+# define __USE_EXTERN_INLINES 1
+#endif
+#include <signal.h>
 
 
 
-- 
1.7.1



More information about the uClibc-cvs mailing list