From 380c00f1756b457db87e703cf05240e4e67c1438 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 18 Mar 2015 15:44:41 -0500 Subject: Change from configure time to compile time probe for intptr_t definition. 2015-03-23 Joel Sherrill . * configure: Regenerated. --- newlib/ChangeLog | 9 ++++++ newlib/configure | 69 ---------------------------------------- newlib/configure.in | 41 ------------------------ newlib/libc/include/inttypes.h | 1 + newlib/libc/include/sys/config.h | 26 +++++++++++++++ 5 files changed, 36 insertions(+), 110 deletions(-) diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 1b03bbc28..0f2528d47 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,12 @@ +2015-03-23 Joel Sherrill . + * configure: Regenerated. + 2015-03-19 Steve Ellcey * libc/include/sys/time.h: Replace uint32_t and uint64_t diff --git a/newlib/configure b/newlib/configure index 8000b87e1..19cf1d9a0 100755 --- a/newlib/configure +++ b/newlib/configure @@ -12646,75 +12646,6 @@ _ACEOF fi -#### Determine if uintptr_t is unsigned long long -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether uintptr_t equals unsigned long long" >&5 -$as_echo_n "checking whether uintptr_t equals unsigned long long... " >&6; } -if ${newlib_cv_uintptr_eq_ulonglong+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat > conftest.c < -extern int foo(uintptr_t); -extern int foo(unsigned long long); -EOF -if { ac_try='${CC} $CFLAGS $CPPFLAGS -c -o conftest.o conftest.c - 1>&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; } -then - newlib_cv_uintptr_eq_ulonglong=yes; -else - newlib_cv_uintptr_eq_ulonglong=no; -fi -rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $newlib_cv_uintptr_eq_ulonglong" >&5 -$as_echo "$newlib_cv_uintptr_eq_ulonglong" >&6; } -if test $newlib_cv_uintptr_eq_ulonglong = yes; then - cat >>confdefs.h <<_ACEOF -#define _UINTPTR_EQ_ULONGLONG 1 -_ACEOF - -else -#### Determine if uintptr_t is unsigned long -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether uintptr_t equals unsigned long" >&5 -$as_echo_n "checking whether uintptr_t equals unsigned long... " >&6; } -if ${newlib_cv_uintptr_eq_ulong+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat > conftest.c < -extern int foo(uintptr_t); -extern int foo(unsigned long); -EOF -if { ac_try='${CC} $CFLAGS $CPPFLAGS -c -o conftest.o conftest.c - 1>&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; } -then - newlib_cv_uintptr_eq_ulong=yes; -else - newlib_cv_uintptr_eq_ulong=no; -fi -rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $newlib_cv_uintptr_eq_ulong" >&5 -$as_echo "$newlib_cv_uintptr_eq_ulong" >&6; } -if test $newlib_cv_uintptr_eq_ulong = yes; then - cat >>confdefs.h <<_ACEOF -#define _UINTPTR_EQ_ULONG 1 -_ACEOF - -fi -fi - - ac_config_files="$ac_config_files Makefile" diff --git a/newlib/configure.in b/newlib/configure.in index fbe5b7b63..9465787ed 100644 --- a/newlib/configure.in +++ b/newlib/configure.in @@ -617,47 +617,6 @@ if test $newlib_cv_ldbl_eq_dbl = yes; then AC_DEFINE_UNQUOTED(_LDBL_EQ_DBL) fi -#### Determine if uintptr_t is unsigned long long -AC_CACHE_CHECK(whether uintptr_t equals unsigned long long, - newlib_cv_uintptr_eq_ulonglong, [dnl -cat > conftest.c < -extern int foo(uintptr_t); -extern int foo(unsigned long long); -EOF -if AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS -c -o conftest.o conftest.c - 1>&AS_MESSAGE_LOG_FD]) -then - newlib_cv_uintptr_eq_ulonglong=yes; -else - newlib_cv_uintptr_eq_ulonglong=no; -fi -rm -f conftest*]) -if test $newlib_cv_uintptr_eq_ulonglong = yes; then - AC_DEFINE_UNQUOTED(_UINTPTR_EQ_ULONGLONG) -else -#### Determine if uintptr_t is unsigned long -AC_CACHE_CHECK(whether uintptr_t equals unsigned long, - newlib_cv_uintptr_eq_ulong, [dnl -cat > conftest.c < -extern int foo(uintptr_t); -extern int foo(unsigned long); -EOF -if AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS -c -o conftest.o conftest.c - 1>&AS_MESSAGE_LOG_FD]) -then - newlib_cv_uintptr_eq_ulong=yes; -else - newlib_cv_uintptr_eq_ulong=no; -fi -rm -f conftest*]) -if test $newlib_cv_uintptr_eq_ulong = yes; then - AC_DEFINE_UNQUOTED(_UINTPTR_EQ_ULONG) -fi -fi - - AC_SUBST(CFLAGS) AC_CONFIG_FILES([Makefile], diff --git a/newlib/libc/include/inttypes.h b/newlib/libc/include/inttypes.h index 39bf13511..52b2d845c 100644 --- a/newlib/libc/include/inttypes.h +++ b/newlib/libc/include/inttypes.h @@ -14,6 +14,7 @@ #define _INTTYPES_H #include +#include #include #include #define __need_wchar_t diff --git a/newlib/libc/include/sys/config.h b/newlib/libc/include/sys/config.h index 5297befe5..04f1e3abf 100644 --- a/newlib/libc/include/sys/config.h +++ b/newlib/libc/include/sys/config.h @@ -287,4 +287,30 @@ #define _MB_EXTENDED_CHARSETS_WINDOWS 1 #endif +/* Determine how uintptr_t is defined by gcc for this target. This + is used to determine the correct printf() constant in inttypes.h */ +#pragma push_macro("signed") +#pragma push_macro("int") +#pragma push_macro("long") +#undef signed +#undef int +#undef long +#define signed +0 +#define int +0 +#define long +1 +#if __INTPTR_TYPE__ == 2 +#define _UINTPTR_EQ_ULONGLONG +#elif __INTPTR_TYPE__ == 1 +#define _UINTPTR_EQ_ULONG +#elif __INTPTR_TYPE__ == 0 +/* Nothing to define because intptr_t is safe to print as an int. */ +#else +#error "Unable to determine type definition of uintptr_t" +#endif +#undef long +#undef int +#undef signed +#pragma pop_macro("signed") +#pragma pop_macro("int") +#pragma pop_macro("long") #endif /* __SYS_CONFIG_H__ */ -- cgit v1.2.3