Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@oarcorp.com>2015-03-18 23:44:41 +0300
committerJoel Sherrill <joel.sherrill@oarcorp.com>2015-03-23 17:16:37 +0300
commit5799260aedacf7da5e9e8f3dc960a9edc0e180ce (patch)
tree3e5a4febeca30263cecc3cd225e53e761732815f
parent548d795d62cbff2c0edfb53513226c1764ec04a7 (diff)
Change from configure time to compile time probe for intptr_t definition.
2015-03-23 Joel Sherrill <joel.sherrill@oarcorp.com * configure.in: Delete logic to determine _UINTPTR_EQ_ULONGLONG and _UINTPTR_EQ_ULONG at configuration time. *libc/include/sys/config.h: Add logic to determine _UINTPTR_EQ_ULONGLONG and _UINTPTR_EQ_ULONG at compilation time. * libc/include/inttypes.h: Add include of <sys/config.h>. * configure: Regenerated.
-rw-r--r--newlib/ChangeLog9
-rwxr-xr-xnewlib/configure69
-rw-r--r--newlib/configure.in41
-rw-r--r--newlib/libc/include/inttypes.h1
-rw-r--r--newlib/libc/include/sys/config.h26
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 <joel.sherrill@oarcorp.com
+
+ * configure.in: Delete logic to determine _UINTPTR_EQ_ULONGLONG
+ and _UINTPTR_EQ_ULONG at configuration time.
+ *libc/include/sys/config.h: Add logic to determine
+ _UINTPTR_EQ_ULONGLONG and _UINTPTR_EQ_ULONG at compilation time.
+ * libc/include/inttypes.h: Add include of <sys/config.h>.
+ * configure: Regenerated.
+
2015-03-19 Steve Ellcey <sellcey@imgtec.com>
* 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 <<EOF
-#include <inttypes.h>
-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 <<EOF
-#include <inttypes.h>
-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 <<EOF
-#include <inttypes.h>
-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 <<EOF
-#include <inttypes.h>
-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 <newlib.h>
+#include <sys/config.h>
#include <sys/_intsup.h>
#include <stdint.h>
#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__ */