This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] stdint.h/inttypes.h


Hi,

Below are further updates to stdint.h/inttypes.h.

The patch actually consists of 2 parts:

* Use "#if xxx" instead of "#ifdef xxx" in inttypes.h.
A similar patch had been applied to stdint.h some time ago, but I seem
to have missed to reflect this change to inttypes.h when having
submitted the stdint.h patch, then ;)

* Prefer long over int int32 for targets having 32-bit longs.
This works around some subtile issues in PR*32 macros (inttypes.h) on
32-bit targets.

Ralf

2005-12-16  Ralf Corsepius <ralf.corsepius@rtems.org>

	* libc/include/stdint.h: Prefer long over int for int32_t.
	Use __have_long32 to set up int32_t.
	* libc/include/inttypes.h: Use "#if xxx" instead of "#ifdef xxx"
	(Sync with stdint.h).

Index: libc/include/inttypes.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/inttypes.h,v
retrieving revision 1.2
diff -u -r1.2 inttypes.h
--- libc/include/inttypes.h	20 Sep 2005 21:21:51 -0000	1.2
+++ libc/include/inttypes.h	16 Dec 2005 03:06:16 -0000
@@ -112,7 +112,7 @@
 #define SCNxFAST16	__SCN16(x)
 
 /* 32-bit types */
-#if defined(__have_long32)
+#if __have_long32
 #define __PRI32(x) __STRINGIFY(l##x)
 #define __SCN32(x) __STRINGIFY(l##x)
 #else
@@ -163,10 +163,10 @@
 
 
 /* 64-bit types */
-#if defined(__have_longlong64)
+#if __have_longlong64
 #define __PRI64(x) __STRINGIFY(ll##x)
 #define __SCN64(x) __STRINGIFY(ll##x)
-#elif defined(__have_long64)
+#elif __have_long64
 #define __PRI64(x) __STRINGIFY(l##x)
 #define __SCN64(x) __STRINGIFY(l##x)
 #else
@@ -217,10 +217,10 @@
 #endif
 
 /* max-bit types */
-#if defined(__have_longlong64)
+#if __have_longlong64
 #define __PRIMAX(x) __STRINGIFY(ll##x)
 #define __SCNMAX(x) __STRINGIFY(ll##x)
-#elif defined(__have_long64)
+#elif __have_long64
 #define __PRIMAX(x) __STRINGIFY(l##x)
 #define __SCNMAX(x) __STRINGIFY(l##x)
 #else
@@ -242,10 +242,10 @@
 #define SCNxMAX		__SCNMAX(x)
 
 /* ptr types */
-#if defined(__have_longlong64)
+#if __have_longlong64
 #define __PRIPTR(x) __STRINGIFY(ll##x)
 #define __SCNPTR(x) __STRINGIFY(ll##x)
-#elif defined(__have_long64)
+#elif __have_long64
 #define __PRIPTR(x) __STRINGIFY(l##x)
 #define __SCNPTR(x) __STRINGIFY(l##x)
 #else
Index: libc/include/stdint.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/stdint.h,v
retrieving revision 1.8
diff -u -r1.8 stdint.h
--- libc/include/stdint.h	1 Nov 2005 22:26:21 -0000	1.8
+++ libc/include/stdint.h	16 Dec 2005 03:06:17 -0000
@@ -79,14 +79,14 @@
 #endif
 #endif
 
-#if __STDINT_EXP(INT_MAX) == 0x7fffffffL
-typedef signed int int32_t;
-typedef unsigned int uint32_t;
-#define __int32_t_defined 1
-#elif __STDINT_EXP(LONG_MAX) == 0x7fffffffL
+#if __have_long32
 typedef signed long int32_t;
 typedef unsigned long uint32_t;
 #define __int32_t_defined 1
+#elif __STDINT_EXP(INT_MAX) == 0x7fffffffL
+typedef signed int int32_t;
+typedef unsigned int uint32_t;
+#define __int32_t_defined 1
 #elif __STDINT_EXP(SHRT_MAX) == 0x7fffffffL
 typedef signed short int32_t;
 typedef unsigned short uint32_t;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]