summaryrefslogtreecommitdiff
path: root/libc/stdlib
diff options
context:
space:
mode:
authorPeter S. Mazinger <ps.m@gmx.net>2011-03-16 23:41:00 +0100
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2012-06-15 14:00:26 +0200
commit6763a89427834d2e8b929006cabfc0e947bb68fa (patch)
treed7648083575e7de99942a751466abb7ccd651f9c /libc/stdlib
parent4c2cd53a40ef2f51f6f2dd06d5ea5c7ab905e295 (diff)
stdlib.c: get rid of the compiler workarounds by using strong_alias_untyped
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libc/stdlib')
-rw-r--r--libc/stdlib/stdlib.c112
1 files changed, 10 insertions, 102 deletions
diff --git a/libc/stdlib/stdlib.c b/libc/stdlib/stdlib.c
index ef33be308..dd31194a8 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
@@ -324,7 +261,6 @@ int rpmatch (__const char *__response)
/**********************************************************************/
#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)
{
@@ -337,17 +273,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)
@@ -393,13 +319,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
@@ -1071,13 +991,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
@@ -1118,13 +1032,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