From owner-svn-src-all@FreeBSD.ORG Sat Jan 8 12:43:05 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8BBC010656A7; Sat, 8 Jan 2011 12:43:05 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 784DD8FC0A; Sat, 8 Jan 2011 12:43:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p08Ch5Ts092309; Sat, 8 Jan 2011 12:43:05 GMT (envelope-from tijl@svn.freebsd.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p08Ch5vR092295; Sat, 8 Jan 2011 12:43:05 GMT (envelope-from tijl@svn.freebsd.org) Message-Id: <201101081243.p08Ch5vR092295@svn.freebsd.org> From: Tijl Coosemans Date: Sat, 8 Jan 2011 12:43:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r217147 - in head/sys: amd64/include arm/include i386/include ia64/include mips/include powerpc/include sparc64/include sun4v/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jan 2011 12:43:05 -0000 Author: tijl Date: Sat Jan 8 12:43:05 2011 New Revision: 217147 URL: http://svn.freebsd.org/changeset/base/217147 Log: On mixed 32/64 bit architectures (mips, powerpc) use __LP64__ rather than architecture macros (__mips_n64, __powerpc64__) when 64 bit types (and corresponding macros) are different from 32 bit. [1] Correct the type of INT64_MIN, INT64_MAX and UINT64_MAX. Define (U)INTMAX_C as an alias for (U)INT64_C matching the type definition for (u)intmax_t. Do this on all architectures for consistency. Suggested by: bde [1] Approved by: kib (mentor) Modified: head/sys/amd64/include/_stdint.h head/sys/arm/include/_stdint.h head/sys/i386/include/_stdint.h head/sys/ia64/include/_stdint.h head/sys/mips/include/_inttypes.h head/sys/mips/include/_stdint.h head/sys/mips/include/_types.h head/sys/powerpc/include/_inttypes.h head/sys/powerpc/include/_limits.h head/sys/powerpc/include/_stdint.h head/sys/powerpc/include/_types.h head/sys/sparc64/include/_stdint.h head/sys/sun4v/include/_stdint.h Modified: head/sys/amd64/include/_stdint.h ============================================================================== --- head/sys/amd64/include/_stdint.h Sat Jan 8 11:47:55 2011 (r217146) +++ head/sys/amd64/include/_stdint.h Sat Jan 8 12:43:05 2011 (r217147) @@ -52,8 +52,8 @@ #define UINT32_C(c) (c ## U) #define UINT64_C(c) (c ## UL) -#define INTMAX_C(c) (c ## L) -#define UINTMAX_C(c) (c ## UL) +#define INTMAX_C(c) INT64_C(c) +#define UINTMAX_C(c) UINT64_C(c) #endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */ Modified: head/sys/arm/include/_stdint.h ============================================================================== --- head/sys/arm/include/_stdint.h Sat Jan 8 11:47:55 2011 (r217146) +++ head/sys/arm/include/_stdint.h Sat Jan 8 12:43:05 2011 (r217147) @@ -45,8 +45,8 @@ #define UINT32_C(c) (c ## U) #define UINT64_C(c) (c ## ULL) -#define INTMAX_C(c) (c ## LL) -#define UINTMAX_C(c) (c ## ULL) +#define INTMAX_C(c) INT64_C(c) +#define UINTMAX_C(c) UINT64_C(c) #endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */ Modified: head/sys/i386/include/_stdint.h ============================================================================== --- head/sys/i386/include/_stdint.h Sat Jan 8 11:47:55 2011 (r217146) +++ head/sys/i386/include/_stdint.h Sat Jan 8 12:43:05 2011 (r217147) @@ -52,8 +52,8 @@ #define UINT32_C(c) (c ## U) #define UINT64_C(c) (c ## ULL) -#define INTMAX_C(c) (c ## LL) -#define UINTMAX_C(c) (c ## ULL) +#define INTMAX_C(c) INT64_C(c) +#define UINTMAX_C(c) UINT64_C(c) #endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */ Modified: head/sys/ia64/include/_stdint.h ============================================================================== --- head/sys/ia64/include/_stdint.h Sat Jan 8 11:47:55 2011 (r217146) +++ head/sys/ia64/include/_stdint.h Sat Jan 8 12:43:05 2011 (r217147) @@ -45,8 +45,8 @@ #define UINT32_C(c) (c ## U) #define UINT64_C(c) (c ## UL) -#define INTMAX_C(c) (c ## L) -#define UINTMAX_C(c) (c ## UL) +#define INTMAX_C(c) INT64_C(c) +#define UINTMAX_C(c) UINT64_C(c) #endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */ Modified: head/sys/mips/include/_inttypes.h ============================================================================== --- head/sys/mips/include/_inttypes.h Sat Jan 8 11:47:55 2011 (r217146) +++ head/sys/mips/include/_inttypes.h Sat Jan 8 12:43:05 2011 (r217147) @@ -38,7 +38,7 @@ * Macros for format specifiers. */ -#if defined(__mips_n64) +#ifdef __LP64__ #define PRI64 "l" #else #define PRI64 "ll" Modified: head/sys/mips/include/_stdint.h ============================================================================== --- head/sys/mips/include/_stdint.h Sat Jan 8 11:47:55 2011 (r217146) +++ head/sys/mips/include/_stdint.h Sat Jan 8 12:43:05 2011 (r217147) @@ -46,28 +46,21 @@ #define INT8_C(c) (c) #define INT16_C(c) (c) #define INT32_C(c) (c) -#ifdef __mips_n64 -#define INT64_C(c) (c ## L) -#else -#define INT64_C(c) (c ## LL) -#endif #define UINT8_C(c) (c) #define UINT16_C(c) (c) #define UINT32_C(c) (c ## U) -#ifdef __mips_n64 + +#ifdef __LP64__ +#define INT64_C(c) (c ## L) #define UINT64_C(c) (c ## UL) #else +#define INT64_C(c) (c ## LL) #define UINT64_C(c) (c ## ULL) #endif -#ifdef __mips_n64 -#define INTMAX_C(c) (c ## L) -#define UINTMAX_C(c) (c ## UL) -#else -#define INTMAX_C(c) (c ## LL) -#define UINTMAX_C(c) (c ## ULL) -#endif +#define INTMAX_C(c) INT64_C(c) +#define UINTMAX_C(c) UINT64_C(c) #endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */ @@ -81,19 +74,19 @@ #define INT8_MIN (-0x7f-1) #define INT16_MIN (-0x7fff-1) #define INT32_MIN (-0x7fffffff-1) -#define INT64_MIN (-INTMAX_C(0x7fffffffffffffff)-1) +#define INT64_MIN (-INT64_C(0x7fffffffffffffff)-1) /* Maximum values of exact-width signed integer types. */ #define INT8_MAX 0x7f #define INT16_MAX 0x7fff #define INT32_MAX 0x7fffffff -#define INT64_MAX INTMAX_C(0x7fffffffffffffff) +#define INT64_MAX INT64_C(0x7fffffffffffffff) /* Maximum values of exact-width unsigned integer types. */ #define UINT8_MAX 0xff #define UINT16_MAX 0xffff -#define UINT32_MAX 0xffffffffU -#define UINT64_MAX UINTMAX_C(0xffffffffffffffff) +#define UINT32_MAX 0xffffffff +#define UINT64_MAX UINT64_C(0xffffffffffffffff) /* * ISO/IEC 9899:1999 @@ -143,7 +136,7 @@ * ISO/IEC 9899:1999 * 7.18.2.4 Limits of integer types capable of holding object pointers */ -#ifdef __mips_n64 +#ifdef __LP64__ #define INTPTR_MIN INT64_MIN #define INTPTR_MAX INT64_MAX #define UINTPTR_MAX UINT64_MAX @@ -165,26 +158,26 @@ * ISO/IEC 9899:1999 * 7.18.3 Limits of other integer types */ +#ifdef __LP64__ /* Limits of ptrdiff_t. */ -#ifdef __mips_n64 #define PTRDIFF_MIN INT64_MIN #define PTRDIFF_MAX INT64_MAX + +/* Limit of size_t. */ +#define SIZE_MAX UINT64_MAX #else +/* Limits of ptrdiff_t. */ #define PTRDIFF_MIN INT32_MIN #define PTRDIFF_MAX INT32_MAX + +/* Limit of size_t. */ +#define SIZE_MAX UINT32_MAX #endif /* Limits of sig_atomic_t. */ #define SIG_ATOMIC_MIN INT32_MIN #define SIG_ATOMIC_MAX INT32_MAX -/* Limit of size_t. */ -#ifdef __mips_n64 -#define SIZE_MAX UINT64_MAX -#else -#define SIZE_MAX UINT32_MAX -#endif - #ifndef WCHAR_MIN /* Also possibly defined in */ /* Limits of wchar_t. */ #define WCHAR_MIN INT32_MIN Modified: head/sys/mips/include/_types.h ============================================================================== --- head/sys/mips/include/_types.h Sat Jan 8 11:47:55 2011 (r217146) +++ head/sys/mips/include/_types.h Sat Jan 8 12:43:05 2011 (r217147) @@ -53,7 +53,7 @@ typedef short __int16_t; typedef unsigned short __uint16_t; typedef int __int32_t; typedef unsigned int __uint32_t; -#ifdef __mips_n64 +#ifdef __LP64__ typedef long __int64_t; typedef unsigned long __uint64_t; #else @@ -74,17 +74,14 @@ typedef unsigned long long __uint64_t; */ typedef __int32_t __clock_t; /* clock()... */ typedef unsigned int __cpumask_t; -#ifdef __mips_n64 -typedef __int64_t __critical_t; -#else -typedef __int32_t __critical_t; -#endif typedef double __double_t; typedef double __float_t; -#ifdef __mips_n64 +#ifdef __LP64__ +typedef __int64_t __critical_t; typedef __int64_t __intfptr_t; typedef __int64_t __intptr_t; #else +typedef __int32_t __critical_t; typedef __int32_t __intfptr_t; typedef __int32_t __intptr_t; #endif @@ -97,14 +94,14 @@ typedef __int8_t __int_least8_t; typedef __int16_t __int_least16_t; typedef __int32_t __int_least32_t; typedef __int64_t __int_least64_t; -#if defined(__mips_n64) || defined(__mips_n32) +#if defined(__LP64__) || defined(__mips_n32) typedef __int64_t __register_t; typedef __int64_t f_register_t; #else typedef __int32_t __register_t; typedef __int32_t f_register_t; #endif -#ifdef __mips_n64 +#ifdef __LP64__ typedef __int64_t __ptrdiff_t; typedef __int64_t __segsz_t; typedef __uint64_t __size_t; @@ -129,12 +126,12 @@ typedef __uint8_t __uint_least8_t; typedef __uint16_t __uint_least16_t; typedef __uint32_t __uint_least32_t; typedef __uint64_t __uint_least64_t; -#if defined(__mips_n64) || defined(__mips_n32) +#if defined(__LP64__) || defined(__mips_n32) typedef __uint64_t __u_register_t; #else typedef __uint32_t __u_register_t; #endif -#if defined(__mips_n64) +#ifdef __LP64__ typedef __uint64_t __vm_offset_t; typedef __uint64_t __vm_paddr_t; typedef __uint64_t __vm_size_t; Modified: head/sys/powerpc/include/_inttypes.h ============================================================================== --- head/sys/powerpc/include/_inttypes.h Sat Jan 8 11:47:55 2011 (r217146) +++ head/sys/powerpc/include/_inttypes.h Sat Jan 8 12:43:05 2011 (r217147) @@ -37,7 +37,7 @@ * Macros for format specifiers. */ -#ifdef __powerpc64__ +#ifdef __LP64__ #define PRI64 "l" #define PRIreg "l" #else Modified: head/sys/powerpc/include/_limits.h ============================================================================== --- head/sys/powerpc/include/_limits.h Sat Jan 8 11:47:55 2011 (r217146) +++ head/sys/powerpc/include/_limits.h Sat Jan 8 12:43:05 2011 (r217147) @@ -73,7 +73,7 @@ #define __LLONG_MAX 0x7fffffffffffffffLL /* max value for a long long */ #define __LLONG_MIN (-0x7fffffffffffffffLL - 1) /* min for a long long */ -#ifdef __powerpc64__ +#ifdef __LP64__ #define __SSIZE_MAX __LONG_MAX /* max value for a ssize_t */ #define __SIZE_T_MAX __ULONG_MAX /* max value for a size_t */ #else Modified: head/sys/powerpc/include/_stdint.h ============================================================================== --- head/sys/powerpc/include/_stdint.h Sat Jan 8 11:47:55 2011 (r217146) +++ head/sys/powerpc/include/_stdint.h Sat Jan 8 12:43:05 2011 (r217147) @@ -50,18 +50,17 @@ #define UINT16_C(c) (c) #define UINT32_C(c) (c ## U) -#ifdef __powerpc64__ +#ifdef __LP64__ #define INT64_C(c) (c ## L) #define UINT64_C(c) (c ## UL) -#define INTMAX_C(c) (c ## L) -#define UINTMAX_C(c) (c ## UL) #else #define INT64_C(c) (c ## LL) #define UINT64_C(c) (c ## ULL) -#define INTMAX_C(c) (c ## LL) -#define UINTMAX_C(c) (c ## ULL) #endif +#define INTMAX_C(c) INT64_C(c) +#define UINTMAX_C(c) UINT64_C(c) + #endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */ #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) @@ -74,27 +73,19 @@ #define INT8_MIN (-0x7f-1) #define INT16_MIN (-0x7fff-1) #define INT32_MIN (-0x7fffffff-1) -#define INT64_MIN (-0x7fffffffffffffffLL-1) +#define INT64_MIN (-INT64_C(0x7fffffffffffffff)-1) /* Maximum values of exact-width signed integer types. */ #define INT8_MAX 0x7f #define INT16_MAX 0x7fff #define INT32_MAX 0x7fffffff -#ifdef __powerpc64__ -#define INT64_MAX 0x7fffffffffffffffL -#else -#define INT64_MAX 0x7fffffffffffffffLL -#endif +#define INT64_MAX INT64_C(0x7fffffffffffffff) /* Maximum values of exact-width unsigned integer types. */ #define UINT8_MAX 0xff #define UINT16_MAX 0xffff -#define UINT32_MAX 0xffffffffU -#ifdef __powerpc64__ -#define UINT64_MAX 0xffffffffffffffffUL -#else -#define UINT64_MAX 0xffffffffffffffffULL -#endif +#define UINT32_MAX 0xffffffff +#define UINT64_MAX UINT64_C(0xffffffffffffffff) /* * ISO/IEC 9899:1999 @@ -144,7 +135,7 @@ * ISO/IEC 9899:1999 * 7.18.2.4 Limits of integer types capable of holding object pointers */ -#ifdef __powerpc64__ +#ifdef __LP64__ #define INTPTR_MIN INT64_MIN #define INTPTR_MAX INT64_MAX #define UINTPTR_MAX UINT64_MAX @@ -166,7 +157,7 @@ * ISO/IEC 9899:1999 * 7.18.3 Limits of other integer types */ -#ifdef __powerpc64__ +#ifdef __LP64__ /* Limits of ptrdiff_t. */ #define PTRDIFF_MIN INT64_MIN #define PTRDIFF_MAX INT64_MAX Modified: head/sys/powerpc/include/_types.h ============================================================================== --- head/sys/powerpc/include/_types.h Sat Jan 8 11:47:55 2011 (r217146) +++ head/sys/powerpc/include/_types.h Sat Jan 8 12:43:05 2011 (r217147) @@ -52,7 +52,7 @@ typedef short __int16_t; typedef unsigned short __uint16_t; typedef int __int32_t; typedef unsigned int __uint32_t; -#ifdef __powerpc64__ +#ifdef __LP64__ typedef long __int64_t; typedef unsigned long __uint64_t; #else @@ -75,7 +75,7 @@ typedef __uint32_t __clock_t; /* clock( typedef unsigned int __cpumask_t; typedef double __double_t; typedef double __float_t; -#ifdef __powerpc64__ +#ifdef __LP64__ typedef __int64_t __critical_t; typedef __int64_t __intfptr_t; typedef __int64_t __intptr_t; @@ -93,7 +93,7 @@ typedef __int8_t __int_least8_t; typedef __int16_t __int_least16_t; typedef __int32_t __int_least32_t; typedef __int64_t __int_least64_t; -#ifdef __powerpc64__ +#ifdef __LP64__ typedef __int64_t __ptrdiff_t; /* ptr1 - ptr2 */ typedef __int64_t __register_t; typedef __int64_t __segsz_t; /* segment size (in pages) */ @@ -121,7 +121,7 @@ typedef __uint8_t __uint_least8_t; typedef __uint16_t __uint_least16_t; typedef __uint32_t __uint_least32_t; typedef __uint64_t __uint_least64_t; -#ifdef __powerpc64__ +#ifdef __LP64__ typedef __uint64_t __u_register_t; typedef __uint64_t __vm_offset_t; typedef __uint64_t __vm_paddr_t; Modified: head/sys/sparc64/include/_stdint.h ============================================================================== --- head/sys/sparc64/include/_stdint.h Sat Jan 8 11:47:55 2011 (r217146) +++ head/sys/sparc64/include/_stdint.h Sat Jan 8 12:43:05 2011 (r217147) @@ -52,8 +52,8 @@ #define UINT32_C(c) (c ## U) #define UINT64_C(c) (c ## UL) -#define INTMAX_C(c) (c ## L) -#define UINTMAX_C(c) (c ## UL) +#define INTMAX_C(c) INT64_C(c) +#define UINTMAX_C(c) UINT64_C(c) #endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */ Modified: head/sys/sun4v/include/_stdint.h ============================================================================== --- head/sys/sun4v/include/_stdint.h Sat Jan 8 11:47:55 2011 (r217146) +++ head/sys/sun4v/include/_stdint.h Sat Jan 8 12:43:05 2011 (r217147) @@ -52,8 +52,8 @@ #define UINT32_C(c) (c ## U) #define UINT64_C(c) (c ## UL) -#define INTMAX_C(c) (c ## L) -#define UINTMAX_C(c) (c ## UL) +#define INTMAX_C(c) INT64_C(c) +#define UINTMAX_C(c) UINT64_C(c) #endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */