From f45706ca6ade259d2cf9397c35b0135991470197 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 1 Feb 2006 09:22:45 +0000 Subject: global data uses libc_hidden_data_def, convert all -I hope- and add some new --- libc/inet/in6_addr.c | 4 +--- libc/inet/resolv.c | 2 ++ libc/misc/ctype/ctype.c | 18 +++++++++--------- libc/misc/error/error.c | 2 ++ libc/misc/gnu/obstack.c | 4 ++-- libc/misc/internals/__uClibc_main.c | 4 ++-- libc/misc/locale/locale.c | 4 ++-- libc/misc/time/time.c | 6 +++--- libc/misc/wchar/wchar.c | 2 +- libc/stdio/__fsetlocking.c | 3 +++ libc/stdio/_fopen.c | 4 ++++ libc/stdio/_stdio.c | 10 +++++++--- libc/stdio/_stdio.h | 3 +++ libc/stdio/fflush.c | 1 + libc/stdlib/atexit.c | 2 ++ libc/unistd/getopt.c | 8 ++++---- libm/s_lib_version.c | 2 +- 17 files changed, 49 insertions(+), 30 deletions(-) diff --git a/libc/inet/in6_addr.c b/libc/inet/in6_addr.c index a5303da43..c2ab375e6 100644 --- a/libc/inet/in6_addr.c +++ b/libc/inet/in6_addr.c @@ -24,12 +24,10 @@ #ifdef __UCLIBC_HAS_IPV6__ const struct in6_addr in6addr_any = { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }; -//libc_hidden_proto(in6addr_any) -//libc_hidden_def(in6addr_any) libc_hidden_proto(in6addr_loopback) const struct in6_addr in6addr_loopback = { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }; -libc_hidden_def(in6addr_loopback) +libc_hidden_data_def(in6addr_loopback) #endif /* __UCLIBC_HAS_IPV6__ */ diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index 885413db8..9b9a42aa3 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -237,6 +237,7 @@ extern char * __searchdomain[MAX_SEARCH] attribute_hidden; #ifdef __UCLIBC_HAS_THREADS__ # include extern pthread_mutex_t __resolv_lock; +libc_hidden_proto(__resolv_lock) #endif #define BIGLOCK __pthread_mutex_lock(&__resolv_lock) #define BIGUNLOCK __pthread_mutex_unlock(&__resolv_lock) @@ -1021,6 +1022,7 @@ char * __searchdomain[MAX_SEARCH]; #ifdef __UCLIBC_HAS_THREADS__ # include pthread_mutex_t __resolv_lock = PTHREAD_MUTEX_INITIALIZER; +libc_hidden_data_def(__resolv_lock) #endif /* diff --git a/libc/misc/ctype/ctype.c b/libc/misc/ctype/ctype.c index d470a2e32..6f71b1421 100644 --- a/libc/misc/ctype/ctype.c +++ b/libc/misc/ctype/ctype.c @@ -856,16 +856,16 @@ const __ctype_mask_t __C_ctype_b_data[] = { /* 254 M-~ */ 0, /* 255 M-^? */ 0 }; -libc_hidden_def(__C_ctype_b_data) +libc_hidden_data_def(__C_ctype_b_data) libc_hidden_proto(__C_ctype_b) const __ctype_mask_t *__C_ctype_b = __C_ctype_b_data + __UCLIBC_CTYPE_B_TBL_OFFSET; -libc_hidden_def(__C_ctype_b) +libc_hidden_data_def(__C_ctype_b) #ifndef __UCLIBC_HAS_XLOCALE__ const __ctype_mask_t *__ctype_b = __C_ctype_b_data + __UCLIBC_CTYPE_B_TBL_OFFSET; -libc_hidden_def(__ctype_b) +libc_hidden_data_def(__ctype_b) #endif @@ -975,19 +975,19 @@ const __ctype_touplow_t __C_ctype_tolower_data[] = { 248, 249, 250, 251, 252, 253, 254, 255 }; -libc_hidden_def(__C_ctype_tolower_data) +libc_hidden_data_def(__C_ctype_tolower_data) libc_hidden_proto(__C_ctype_tolower) const __ctype_touplow_t *__C_ctype_tolower = __C_ctype_tolower_data + __UCLIBC_CTYPE_TO_TBL_OFFSET; -libc_hidden_def(__C_ctype_tolower) +libc_hidden_data_def(__C_ctype_tolower) #ifndef __UCLIBC_HAS_XLOCALE__ libc_hidden_proto(__ctype_tolower) const __ctype_touplow_t *__ctype_tolower = __C_ctype_tolower_data + __UCLIBC_CTYPE_TO_TBL_OFFSET; -libc_hidden_def(__ctype_tolower) +libc_hidden_data_def(__ctype_tolower) #endif @@ -1097,19 +1097,19 @@ const __ctype_touplow_t __C_ctype_toupper_data[] = { 248, 249, 250, 251, 252, 253, 254, 255 }; -libc_hidden_def(__C_ctype_toupper_data) +libc_hidden_data_def(__C_ctype_toupper_data) libc_hidden_proto(__C_ctype_toupper) const __ctype_touplow_t *__C_ctype_toupper = __C_ctype_toupper_data + __UCLIBC_CTYPE_TO_TBL_OFFSET; -libc_hidden_def(__C_ctype_toupper) +libc_hidden_data_def(__C_ctype_toupper) #ifndef __UCLIBC_HAS_XLOCALE__ libc_hidden_proto(__ctype_toupper) const __ctype_touplow_t *__ctype_toupper = __C_ctype_toupper_data + __UCLIBC_CTYPE_TO_TBL_OFFSET; -libc_hidden_def(__ctype_toupper) +libc_hidden_data_def(__ctype_toupper) #endif diff --git a/libc/misc/error/error.c b/libc/misc/error/error.c index 3e44a01ee..bc6117d8f 100644 --- a/libc/misc/error/error.c +++ b/libc/misc/error/error.c @@ -39,7 +39,9 @@ libc_hidden_proto(stdout) libc_hidden_proto(stderr) /* This variable is incremented each time `error' is called. */ +libc_hidden_proto(error_message_count) unsigned int error_message_count = 0; +libc_hidden_data_def(error_message_count) /* Sometimes we want to have at most one error per line. This variable controls whether this mode is selected or not. */ int error_one_per_line; diff --git a/libc/misc/gnu/obstack.c b/libc/misc/gnu/obstack.c index c1ae75869..99311183f 100644 --- a/libc/misc/gnu/obstack.c +++ b/libc/misc/gnu/obstack.c @@ -97,7 +97,7 @@ void (*obstack_alloc_failed_handler) (void) = print_and_abort; static void print_and_abort (); void (*obstack_alloc_failed_handler) () = print_and_abort; # endif -libc_hidden_def(obstack_alloc_failed_handler) +libc_hidden_data_def(obstack_alloc_failed_handler) /* Exit value used when `print_and_abort' is used. */ @@ -118,7 +118,7 @@ libc_hidden_proto(fwprintf) libc_hidden_proto(obstack_exit_failure) int obstack_exit_failure = EXIT_FAILURE; -libc_hidden_def(obstack_exit_failure) +libc_hidden_data_def(obstack_exit_failure) /* The non-GNU-C macros copy the obstack into this global variable to avoid multiple evaluation. */ diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index 39dceac89..1318fc99e 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -97,7 +97,7 @@ strong_alias (__progname_full, program_invocation_name) */ libc_hidden_proto(__environ) char **__environ = 0; -libc_hidden_def(__environ) +libc_hidden_data_def(__environ) /* psm: arm segfaults with strong_alias, although defined */ weak_alias(__environ,environ) @@ -105,7 +105,7 @@ weak_alias(__environ,environ) extern size_t __pagesize; libc_hidden_proto(__pagesize) size_t __pagesize = 0; -libc_hidden_def(__pagesize) +libc_hidden_data_def(__pagesize) #ifndef O_NOFOLLOW # define O_NOFOLLOW 0 diff --git a/libc/misc/locale/locale.c b/libc/misc/locale/locale.c index 5ad829d2c..e53731e94 100644 --- a/libc/misc/locale/locale.c +++ b/libc/misc/locale/locale.c @@ -377,12 +377,12 @@ libc_hidden_proto(__ctype_toupper) __uclibc_locale_t __global_locale_data; __locale_t __global_locale = &__global_locale_data; -libc_hidden_def(__global_locale) +libc_hidden_data_def(__global_locale) #ifdef __UCLIBC_HAS_XLOCALE__ libc_hidden_proto(__curlocale_var) __locale_t __curlocale_var = &__global_locale_data; -libc_hidden_def(__curlocale_var) +libc_hidden_data_def(__curlocale_var) #endif /*----------------------------------------------------------------------*/ diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c index 84f201d44..fb79883c9 100644 --- a/libc/misc/time/time.c +++ b/libc/misc/time/time.c @@ -1705,13 +1705,13 @@ static const char vals[] = { /* Initialize to UTC. */ libc_hidden_proto(daylight) int daylight = 0; -libc_hidden_def(daylight) +libc_hidden_data_def(daylight) libc_hidden_proto(timezone) long timezone = 0; -libc_hidden_def(timezone) +libc_hidden_data_def(timezone) libc_hidden_proto(tzname) char *tzname[2] = { (char *) UTC, (char *) (UTC-1) }; -libc_hidden_def(tzname) +libc_hidden_data_def(tzname) #ifdef __UCLIBC_HAS_THREADS__ attribute_hidden pthread_mutex_t _time_tzlock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; diff --git a/libc/misc/wchar/wchar.c b/libc/misc/wchar/wchar.c index 099769c2f..a795986e8 100644 --- a/libc/misc/wchar/wchar.c +++ b/libc/misc/wchar/wchar.c @@ -1269,7 +1269,7 @@ const unsigned char __iconv_codesets[] = "\x08\x02""UTF-8\x00" "\x0b\x01""US-ASCII\x00" "\x07\x01""ASCII"; /* Must be last! (special case to save a nul) */ -libc_hidden_def(__iconv_codesets) +libc_hidden_data_def(__iconv_codesets) libc_hidden_proto(strcasecmp) diff --git a/libc/stdio/__fsetlocking.c b/libc/stdio/__fsetlocking.c index 2e8710076..746a098f9 100644 --- a/libc/stdio/__fsetlocking.c +++ b/libc/stdio/__fsetlocking.c @@ -9,6 +9,9 @@ #include libc_hidden_proto(__fsetlocking) +#ifdef __UCLIBC_HAS_THREADS__ +libc_hidden_proto(_stdio_user_locking) +#endif /* Not threadsafe. */ diff --git a/libc/stdio/_fopen.c b/libc/stdio/_fopen.c index 02051eff9..4ca028275 100644 --- a/libc/stdio/_fopen.c +++ b/libc/stdio/_fopen.c @@ -11,6 +11,10 @@ libc_hidden_proto(isatty) libc_hidden_proto(open) libc_hidden_proto(fcntl) +#ifdef __UCLIBC_HAS_THREADS__ +libc_hidden_proto(_stdio_user_locking) +#endif + /* * Cases: * fopen64 : filename != NULL, stream == NULL, filedes == -2 diff --git a/libc/stdio/_stdio.c b/libc/stdio/_stdio.c index 5c8b72086..dc8bd07ad 100644 --- a/libc/stdio/_stdio.c +++ b/libc/stdio/_stdio.c @@ -129,15 +129,15 @@ static FILE _stdio_streams[] = { FILE *stdin = _stdio_streams; libc_hidden_def(stdin) FILE *stdout = _stdio_streams + 1; -libc_hidden_def(stdout) +libc_hidden_data_def(stdout) libc_hidden_proto(stderr) FILE *stderr = _stdio_streams + 2; -libc_hidden_def(stderr) +libc_hidden_data_def(stderr) #ifdef __STDIO_GETC_MACRO libc_hidden_proto(__stdin) FILE *__stdin = _stdio_streams; /* For getchar() macro. */ -libc_hidden_def(__stdin) +libc_hidden_data_def(__stdin) #endif #ifdef __STDIO_PUTC_MACRO FILE *__stdout = _stdio_streams + 1; /* For putchar() macro. */ @@ -159,9 +159,11 @@ FILE *__stdout = _stdio_streams + 1; /* For putchar() macro. */ */ FILE *_stdio_openlist = _stdio_streams; +libc_hidden_data_def(_stdio_openlist) # ifdef __UCLIBC_HAS_THREADS__ pthread_mutex_t _stdio_openlist_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; +libc_hidden_data_def(_stdio_openlist_lock) int _stdio_openlist_delflag = 0; # endif @@ -170,7 +172,9 @@ int _stdio_openlist_delflag = 0; #ifdef __UCLIBC_HAS_THREADS__ /* 2 if threading not initialized and 0 otherwise; */ +libc_hidden_proto(_stdio_user_locking) int _stdio_user_locking = 2; +libc_hidden_data_def(_stdio_user_locking) void attribute_hidden __stdio_init_mutex(pthread_mutex_t *m) { diff --git a/libc/stdio/_stdio.h b/libc/stdio/_stdio.h index 1c31647cc..81942f060 100644 --- a/libc/stdio/_stdio.h +++ b/libc/stdio/_stdio.h @@ -23,8 +23,11 @@ libc_hidden_proto(stdin) libc_hidden_proto(stdout) +libc_hidden_proto(_stdio_openlist) + #ifdef __UCLIBC_HAS_THREADS__ #include +libc_hidden_proto(_stdio_openlist_lock) #define __STDIO_THREADLOCK_OPENLIST \ __pthread_mutex_lock(&_stdio_openlist_lock) diff --git a/libc/stdio/fflush.c b/libc/stdio/fflush.c index c0f58d8af..a2e1cf916 100644 --- a/libc/stdio/fflush.c +++ b/libc/stdio/fflush.c @@ -16,6 +16,7 @@ libc_hidden_proto(fflush_unlocked) #endif /* __UCLIBC_MJN3_ONLY__ */ #ifdef __UCLIBC_HAS_THREADS__ +libc_hidden_proto(_stdio_user_locking) /* Even if the stream is set to user-locking, we still need to lock * when all (lbf) writing streams are flushed. */ #define MY_STDIO_THREADLOCK(STREAM) \ diff --git a/libc/stdlib/atexit.c b/libc/stdlib/atexit.c index 75972b57d..959d08edb 100644 --- a/libc/stdlib/atexit.c +++ b/libc/stdlib/atexit.c @@ -49,6 +49,7 @@ libc_hidden_proto(_exit) #ifdef __UCLIBC_HAS_THREADS__ # include extern pthread_mutex_t mylock; +libc_hidden_proto(mylock) #endif #define LOCK __pthread_mutex_lock(&mylock) #define UNLOCK __pthread_mutex_unlock(&mylock) @@ -314,6 +315,7 @@ extern void weak_function _stdio_term(void) attribute_hidden; attribute_hidden void (*__exit_cleanup) (int) = 0; #ifdef __UCLIBC_HAS_THREADS__ pthread_mutex_t mylock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; +libc_hidden_data_def(mylock) #endif #ifdef __UCLIBC_CTOR_DTOR__ diff --git a/libc/unistd/getopt.c b/libc/unistd/getopt.c index 514187995..770345a08 100644 --- a/libc/unistd/getopt.c +++ b/libc/unistd/getopt.c @@ -84,7 +84,7 @@ extern int _getopt_internal (int argc, char *const *argv, const char *optstring, each non-option ARGV-element is returned here. */ char *optarg = NULL; -libc_hidden_def(optarg) +libc_hidden_data_def(optarg) /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller @@ -100,20 +100,20 @@ libc_hidden_def(optarg) /* 1003.2 says this must be 1 before any call. */ int optind = 1; -libc_hidden_def(optind) +libc_hidden_data_def(optind) /* Callers store zero here to inhibit the error message for unrecognized options. */ int opterr = 1; -libc_hidden_def(opterr) +libc_hidden_data_def(opterr) /* Set to an option character which was unrecognized. This must be initialized on some systems to avoid linking in the system's own getopt implementation. */ int optopt = '?'; -libc_hidden_def(optopt) +libc_hidden_data_def(optopt) /* The next char to be scanned in the option-element in which the last option character we returned was found. diff --git a/libm/s_lib_version.c b/libm/s_lib_version.c index 91cd5fcbb..4028dfd6f 100644 --- a/libm/s_lib_version.c +++ b/libm/s_lib_version.c @@ -38,4 +38,4 @@ _LIB_VERSION_TYPE _LIB_VERSION = _IEEE_; #endif #endif #endif -libm_hidden_def(_LIB_VERSION) +libm_hidden_data_def(_LIB_VERSION) -- cgit v1.2.3