Ticket #2038: newlib-rtems4.11-stdint.patch
File newlib-rtems4.11-stdint.patch, 3.2 KB (added by Ralf Corsepius, on 03/14/12 at 05:35:28) |
---|
-
newlib/ChangeLog.rtems
diff --git a/newlib/ChangeLog.rtems b/newlib/ChangeLog.rtems index 147e643..9907f79 100644
a b 1 2012-03-14 Ralf Corsépius <ralf.corsepius@rtems.org> 2 3 * libc/include/stdint.h: Honor __[U]INTPTR_TYPE__ for [u]intptr_t. 4 1 5 2011-12-16 Ralf Corsépius <ralf.corsepius@rtems.org> 2 6 3 7 * libc/include/sys/time.h: Add adjtime. -
newlib/libc/include/stdint.h
diff --git a/newlib/libc/include/stdint.h b/newlib/libc/include/stdint.h index bf322cf..005c1d6 100644
a b typedef uint64_t uint_least32_t; 235 235 typedef unsigned long uintmax_t; 236 236 #endif 237 237 238 /* 239 * GCC doesn't provide an appropriate macro for [u]intptr_t 240 * For now, use __PTRDIFF_TYPE__ 241 */ 238 /* intptr_t */ 239 #if !defined(__INTPTR_TYPE__) 240 #if defined(__SIZEOF_POINTER__) 241 #if __SIZEOF_POINTER__ == 8 242 typedef int64_t __INTPTR_TYPE__; 243 #elif __SIZEOF_POINTER__ == 4 244 typedef int32_t __INTPTR_TYPE__; 245 #elif __SIZEOF_POINTER__ == 2 246 typedef int16_t __INTPTR_TYPE__; 247 #else 248 #error cannot determine intptr_t 249 #endif 250 #else 251 #if defined(__PTRDIFF_TYPE__) 252 typedef signed __PTRDIFF_TYPE__ __INTPTR_TYPE__; 253 #else 254 /* Fallback to long */ 255 typedef signed long __INTPTR_TYPE__; 256 #endif 257 #endif 258 #endif 259 typedef __INTPTR_TYPE__ intptr_t; 260 261 /* uintptr_t */ 262 #if !defined(__UINTPTR_TYPE__) 263 #if defined(__SIZEOF_POINTER__) 264 #if __SIZEOF_POINTER__ == 8 265 typedef uint64_t __UINTPTR_TYPE__; 266 #elif __SIZEOF_POINTER__ == 4 267 typedef uint32_t __UINTPTR_TYPE__; 268 #elif __SIZEOF_POINTER__ == 2 269 typedef uint16_t __UINTPTR_TYPE__; 270 #else 271 #error cannot determine uintptr_t 272 #endif 273 #else 274 #if defined(__PTRDIFF_TYPE__) 275 typedef unsigned __PTRDIFF_TYPE__ __UINTPTR_TYPE__; 276 #else 277 /* Fallback to long */ 278 typedef unsigned long __UINTPTR_TYPE__; 279 #endif 280 #endif 281 #endif 282 typedef __UINTPTR_TYPE__ uintptr_t; 283 284 /* Limits of pointer types */ 242 285 #if defined(__SIZEOF_POINTER__) 243 286 #if __SIZEOF_POINTER__ == 8 244 typedef int64_t intptr_t;245 typedef uint64_t uintptr_t;246 287 #define INTPTR_MAX INT64_MAX 247 288 #define INTPTR_MIN INT64_MIN 248 289 #define UINTPTR_MAX UINT64_MAX 249 290 #elif __SIZEOF_POINTER__ == 4 250 typedef int32_t intptr_t;251 typedef uint32_t uintptr_t;252 291 #define INTPTR_MAX INT32_MAX 253 292 #define INTPTR_MIN INT32_MIN 254 293 #define UINTPTR_MAX UINT32_MAX 255 294 #elif __SIZEOF_POINTER__ == 2 256 typedef int16_t intptr_t;257 typedef uint16_t uintptr_t;258 295 #define INTPTR_MAX INT16_MAX 259 296 #define INTPTR_MIN INT16_MIN 260 297 #define UINTPTR_MAX UINT16_MAX … … typedef uint64_t uint_least32_t; 263 300 #endif 264 301 #else 265 302 #if defined(__PTRDIFF_TYPE__) 266 typedef signed __PTRDIFF_TYPE__ intptr_t;267 typedef unsigned __PTRDIFF_TYPE__ uintptr_t;268 303 #define INTPTR_MAX PTRDIFF_MAX 269 304 #define INTPTR_MIN PTRDIFF_MIN 270 305 #ifdef __UINTPTR_MAX__ … … typedef unsigned __PTRDIFF_TYPE__ uintptr_t; 273 308 #define UINTPTR_MAX (2UL * PTRDIFF_MAX + 1) 274 309 #endif 275 310 #else 276 /* 277 * Fallback to hardcoded values, 278 * should be valid on cpu's with 32bit int/32bit void* 279 */ 280 typedef signed long intptr_t; 281 typedef unsigned long uintptr_t; 311 /* Fallback to long */ 282 312 #define INTPTR_MAX __STDINT_EXP(LONG_MAX) 283 313 #define INTPTR_MIN (-__STDINT_EXP(LONG_MAX) - 1) 284 314 #define UINTPTR_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)