[newlib-cygwin/cygwin-2.0] Change from configure time to compile time probe for intptr_t definition.

Corinna Vinschen corinna@sourceware.org
Thu Apr 23 20:48:00 GMT 2015


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=380c00f1756b457db87e703cf05240e4e67c1438

commit 380c00f1756b457db87e703cf05240e4e67c1438
Author: Joel Sherrill <joel.sherrill@oarcorp.com>
Date:   Wed Mar 18 15:44:41 2015 -0500

    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.

Diff:
---
 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 1b03bbc..0f2528d 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 8000b87..19cf1d9 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 fbe5b7b..9465787 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 39bf135..52b2d84 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 5297bef..04f1e3a 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__ */



More information about the Newlib-cvs mailing list