[git commit future 1/1] stdlib.c: get rid of the compiler workarounds by using strong_alias_untyped

Peter S. Mazinger ps.m at gmx.net
Wed Mar 16 19:20:32 UTC 2011


commit: http://git.uclibc.org/uClibc/commit/?id=01b42aa4e0080197ec21ae32abe052cd0ead2b62
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future

Signed-off-by: Peter S. Mazinger <ps.m at gmx.net>
---
 libc/stdlib/stdlib.c |  112 ++++---------------------------------------------
 1 files changed, 10 insertions(+), 102 deletions(-)

diff --git a/libc/stdlib/stdlib.c b/libc/stdlib/stdlib.c
index 5189d01..09909da 100644
--- a/libc/stdlib/stdlib.c
+++ b/libc/stdlib/stdlib.c
@@ -35,55 +35,6 @@
 #define _ISOC99_SOURCE			/* for ULLONG primarily... */
 #include <limits.h>
 #include <stdint.h>
-/* Work around gcc's refusal to create aliases.
- * TODO: Add in a define to disable the aliases? */
-
-#if UINT_MAX == ULONG_MAX
-#ifdef L_labs
-#define abs __ignore_abs
-#endif
-#ifdef L_atol
-#define atoi __ignore_atoi
-#endif
-#endif
-#if defined(ULLONG_MAX) && (ULLONG_MAX == ULONG_MAX)
-#ifdef L_labs
-#define llabs __ignore_llabs
-#endif
-#ifdef L_atol
-#define atoll __ignore_atoll
-#endif
-#ifdef L_strtol
-#define strtoll __ignore_strtoll
-#endif
-#ifdef L_strtoul
-#define strtoull __ignore_strtoull
-#endif
-#ifdef L_wcstol
-#define wcstoll __ignore_wcstoll
-#endif
-#ifdef L_wcstoul
-#define wcstoull __ignore_wcstoull
-#endif
-#ifdef L_strtol_l
-#define strtoll_l __ignore_strtoll_l
-#endif
-#ifdef L_strtoul_l
-#define strtoull_l __ignore_strtoull_l
-#endif
-#ifdef L_wcstol_l
-#define wcstoll_l __ignore_wcstoll_l
-#endif
-#ifdef L_wcstoul_l
-#define wcstoull_l __ignore_wcstoull_l
-#endif
-#endif
-#if defined(ULLONG_MAX) && (ULLONG_MAX == UINTMAX_MAX)
-#if defined L_labs || defined L_llabs
-#define imaxabs __ignore_imaxabs
-#endif
-#endif
-
 #include <stdint.h>
 #include <inttypes.h>
 #include <ctype.h>
@@ -222,21 +173,15 @@ long int labs(long int j)
 }
 
 #if UINT_MAX == ULONG_MAX
-#undef abs
-extern __typeof(labs) abs;
-strong_alias(labs,abs)
+strong_alias_untyped(labs,abs)
 #endif
 
 #if defined(ULLONG_MAX) && (ULLONG_MAX == ULONG_MAX)
-#undef llabs
-extern __typeof(labs) llabs;
-strong_alias(labs,llabs)
+strong_alias_untyped(labs,llabs)
 #endif
 
 #if ULONG_MAX == UINTMAX_MAX
-#undef imaxabs
-extern __typeof(labs) imaxabs;
-strong_alias(labs,imaxabs)
+strong_alias_untyped(labs,imaxabs)
 #endif
 
 #endif
@@ -251,9 +196,7 @@ long long int llabs(long long int j)
 }
 
 #if (ULLONG_MAX == UINTMAX_MAX)
-#undef imaxabs
-extern __typeof(llabs) imaxabs;
-strong_alias(llabs,imaxabs)
+strong_alias_untyped(llabs,imaxabs)
 #endif
 
 #endif /* defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) */
@@ -284,18 +227,12 @@ long atol(const char *nptr)
 }
 
 #if UINT_MAX == ULONG_MAX
-#undef atoi
-extern __typeof(atol) atoi;
-/* the one in stdlib.h is not enough due to prototype mismatch */
-libc_hidden_proto(atoi)
-strong_alias(atol,atoi)
+strong_alias_untyped(atol,atoi)
 libc_hidden_def(atoi)
 #endif
 
 #if defined(ULLONG_MAX) && (ULLONG_MAX == ULONG_MAX)
-#undef atoll
-extern __typeof(atol) atoll;
-strong_alias(atol,atoll)
+strong_alias_untyped(atol,atoll)
 #endif
 
 #endif
@@ -316,7 +253,6 @@ long long atoll(const char *nptr)
 /**********************************************************************/
 #if defined(L_strtol) || defined(L_strtol_l)
 
-libc_hidden_proto(__XL_NPP(strtol))
 long __XL_NPP(strtol)(const char * __restrict str, char ** __restrict endptr,
 				  int base __LOCALE_PARAM)
 {
@@ -329,17 +265,7 @@ strong_alias(strtol,strtoimax)
 #endif
 
 #if defined(ULLONG_MAX) && (ULLONG_MAX == ULONG_MAX)
-#ifdef L_strtol_l
-#undef strtoll_l
-#else
-#undef strtoll
-#endif
-extern __typeof(__XL_NPP(strtol)) __XL_NPP(strtoll);
-/* the one in stdlib.h is not enough due to prototype mismatch */
-#ifdef L_strtol
-libc_hidden_proto(__XL_NPP(strtoll))
-#endif
-strong_alias(__XL_NPP(strtol),__XL_NPP(strtoll))
+strong_alias_untyped(__XL_NPP(strtol),__XL_NPP(strtoll))
 #ifdef L_strtol
 libc_hidden_def(__XL_NPP(strtoll))
 strong_alias(strtol,strtoq)
@@ -385,13 +311,7 @@ strong_alias(strtoul,strtoumax)
 #endif
 
 #if defined(ULLONG_MAX) && (ULLONG_MAX == ULONG_MAX)
-#ifdef L_strtoul_l
-#undef strtoull_l
-#else
-#undef strtoull
-#endif
-extern __typeof(__XL_NPP(strtoul)) __XL_NPP(strtoull);
-strong_alias(__XL_NPP(strtoul),__XL_NPP(strtoull))
+strong_alias_untyped(__XL_NPP(strtoul),__XL_NPP(strtoull))
 #if !defined(L_strtoul_l)
 strong_alias(strtoul,strtouq)
 #endif
@@ -1050,13 +970,7 @@ strong_alias(wcstol,wcstoimax)
 #endif
 
 #if defined(ULLONG_MAX) && (ULLONG_MAX == ULONG_MAX)
-#ifdef L_wcstol_l
-#undef wcstoll_l
-#else
-#undef wcstoll
-#endif
-extern __typeof(__XL_NPP(wcstol)) __XL_NPP(wcstoll);
-strong_alias(__XL_NPP(wcstol),__XL_NPP(wcstoll))
+strong_alias_untyped(__XL_NPP(wcstol),__XL_NPP(wcstoll))
 #endif
 
 #endif
@@ -1097,13 +1011,7 @@ strong_alias(wcstoul,wcstoumax)
 #endif
 
 #if defined(ULLONG_MAX) && (ULLONG_MAX == ULONG_MAX)
-#ifdef L_wcstoul_l
-#undef wcstoull_l
-#else
-#undef wcstoull
-#endif
-extern __typeof(__XL_NPP(wcstoul)) __XL_NPP(wcstoull);
-strong_alias(__XL_NPP(wcstoul),__XL_NPP(wcstoull))
+strong_alias_untyped(__XL_NPP(wcstoul),__XL_NPP(wcstoull))
 #endif
 
 #endif
-- 
1.7.3.4



More information about the uClibc-cvs mailing list