Bug 634793: a checkin to do a "try" build of a proposed patch (to define
authorwtc%google.com
Sat, 01 Dec 2012 22:50:12 +0000
changeset 4427 83e6d82eac90b0eb8057ce7586006bbb2fd4ec9b
parent 4426 5b9bbbd485a7dc38bb9bb13663ec69b59863a98d
child 4428 ff1098348fdec44206812af0ddc45b1c21284ac7
push idunknown
push userunknown
push dateunknown
bugs634793
Bug 634793: a checkin to do a "try" build of a proposed patch (to define the NSPR integer types as <stdint.h> types) on the NSS tinderboxes. Modified Files: config/prdepend.h pr/include/prlong.h pr/include/prtypes.h
config/prdepend.h
pr/include/prlong.h
pr/include/prtypes.h
--- a/config/prdepend.h
+++ b/config/prdepend.h
@@ -5,8 +5,9 @@
 
 /*
  * A dummy header file that is a dependency for all the object files.
  * Used to force a full recompilation of NSPR in Mozilla's Tinderbox
  * depend builds.  See comments in rules.mk.
  */
 
 #error "Do not include this header file."
+
--- a/pr/include/prlong.h
+++ b/pr/include/prlong.h
@@ -30,17 +30,23 @@ PR_BEGIN_EXTERN_C
 NSPR_API(PRInt64) LL_MaxInt(void);
 NSPR_API(PRInt64) LL_MinInt(void);
 NSPR_API(PRInt64) LL_Zero(void);
 NSPR_API(PRUint64) LL_MaxUint(void);
 
 #if defined(HAVE_LONG_LONG)
 
 /* Keep this in sync with prtypes.h. */
-#if PR_BYTES_PER_LONG == 8 && !defined(__APPLE__)
+#ifdef _PR_HAVE_STDINT_H
+#define LL_MAXINT   INT64_MAX
+#define LL_MININT   INT64_MIN
+#define LL_ZERO     INT64_C(0)
+#define LL_MAXUINT  UINT64_MAX
+#define LL_INIT(hi, lo)  ((INT64_C(hi) << 32) + INT64_C(lo))
+#elif PR_BYTES_PER_LONG == 8
 #define LL_MAXINT   9223372036854775807L
 #define LL_MININT   (-LL_MAXINT - 1L)
 #define LL_ZERO     0L
 #define LL_MAXUINT  18446744073709551615UL
 #define LL_INIT(hi, lo)  ((hi ## L << 32) + lo ## L)
 #elif defined(WIN32) && !defined(__GNUC__)
 #define LL_MAXINT   9223372036854775807i64
 #define LL_MININT   (-LL_MAXINT - 1i64)
--- a/pr/include/prtypes.h
+++ b/pr/include/prtypes.h
@@ -200,24 +200,43 @@
 ** MACROS:      PR_ARRAY_SIZE
 ** DESCRIPTION:
 **  The number of elements in an array.
 ***********************************************************************/
 #define PR_ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
 
 PR_BEGIN_EXTERN_C
 
+/*
+ * <stdint.h> first appeared in Visual C++ 2010.
+ * _MSC_VER values:
+ * Visual Studio 2008: 1500
+ * Visual Studio 2010: 1600
+ * Visual Studio 2012: 1700
+ */
+#if defined(_MSC_VER) && _MSC_VER < 1600
+/* Visual C++ 2008 and older don't have <stdint.h>. */
+#elif defined(RC_INVOKED)
+/* Not applicable to the Windows resource compiler. */
+#else
+#include <stdint.h>
+#define _PR_HAVE_STDINT_H
+#endif
+
 /************************************************************************
 ** TYPES:       PRUint8
 **              PRInt8
 ** DESCRIPTION:
 **  The int8 types are known to be 8 bits each. There is no type that
 **      is equivalent to a plain "char".
 ************************************************************************/
-#if PR_BYTES_PER_BYTE == 1
+#ifdef _PR_HAVE_STDINT_H
+typedef uint8_t PRUint8;
+typedef int8_t PRInt8;
+#elif PR_BYTES_PER_BYTE == 1
 typedef unsigned char PRUint8;
 /*
 ** Some cfront-based C++ compilers do not like 'signed char' and
 ** issue the warning message:
 **     warning: "signed" not implemented (ignored)
 ** For these compilers, we have to define PRInt8 as plain 'char'.
 ** Make sure that plain 'char' is indeed signed under these compilers.
 */
@@ -246,17 +265,20 @@ typedef signed char PRInt8;
 #define PR_UINT8_MAX 255U
 
 /************************************************************************
 ** TYPES:       PRUint16
 **              PRInt16
 ** DESCRIPTION:
 **  The int16 types are known to be 16 bits each.
 ************************************************************************/
-#if PR_BYTES_PER_SHORT == 2
+#ifdef _PR_HAVE_STDINT_H
+typedef uint16_t PRUint16;
+typedef int16_t PRInt16;
+#elif PR_BYTES_PER_SHORT == 2
 typedef unsigned short PRUint16;
 typedef short PRInt16;
 #else
 #error No suitable type for PRInt16/PRUint16
 #endif
 
 /************************************************************************
  * MACROS:      PR_INT16_MAX
@@ -271,17 +293,22 @@ typedef short PRInt16;
 #define PR_UINT16_MAX 65535U
 
 /************************************************************************
 ** TYPES:       PRUint32
 **              PRInt32
 ** DESCRIPTION:
 **  The int32 types are known to be 32 bits each.
 ************************************************************************/
-#if PR_BYTES_PER_INT == 4
+#ifdef _PR_HAVE_STDINT_H
+typedef uint32_t PRUint32;
+typedef int32_t PRInt32;
+#define PR_INT32(x)  INT32_C(x)
+#define PR_UINT32(x) UINT32_C(x)
+#elif PR_BYTES_PER_INT == 4
 typedef unsigned int PRUint32;
 typedef int PRInt32;
 #define PR_INT32(x)  x
 #define PR_UINT32(x) x ## U
 #elif PR_BYTES_PER_LONG == 4
 typedef unsigned long PRUint32;
 typedef long PRInt32;
 #define PR_INT32(x)  x ## L
@@ -326,37 +353,37 @@ typedef long PRInt32;
 ** MACROS:      PR_INT64_MAX
 **              PR_INT64_MIN
 **              PR_UINT64_MAX
 ** DESCRIPTION:
 **  The maximum and minimum values of a PRInt64 or PRUint64.
 ************************************************************************/
 #ifdef HAVE_LONG_LONG
 /* Keep this in sync with prlong.h. */
-/*
- * On 64-bit Mac OS X, uint64 needs to be defined as unsigned long long to
- * match uint64_t, otherwise our uint64 typedef conflicts with the uint64
- * typedef in cssmconfig.h, which CoreServices.h includes indirectly.
- */
-#if PR_BYTES_PER_LONG == 8 && !defined(__APPLE__)
+#ifdef _PR_HAVE_STDINT_H
+typedef int64_t PRInt64;
+typedef uint64_t PRUint64;
+#define PR_INT64(x)  INT64_C(x)
+#define PR_UINT64(x) UINT64_C(x)
+#elif PR_BYTES_PER_LONG == 8
 typedef long PRInt64;
 typedef unsigned long PRUint64;
 #define PR_INT64(x)  x ## L
 #define PR_UINT64(x) x ## UL
 #elif defined(WIN32) && !defined(__GNUC__)
 typedef __int64  PRInt64;
 typedef unsigned __int64 PRUint64;
 #define PR_INT64(x)  x ## i64
 #define PR_UINT64(x) x ## ui64
 #else
 typedef long long PRInt64;
 typedef unsigned long long PRUint64;
 #define PR_INT64(x)  x ## LL
 #define PR_UINT64(x) x ## ULL
-#endif /* PR_BYTES_PER_LONG == 8 */
+#endif /* _PR_HAVE_STDINT_H */
 
 #define PR_INT64_MAX PR_INT64(0x7fffffffffffffff)
 #define PR_INT64_MIN (-PR_INT64_MAX - 1)
 #define PR_UINT64_MAX PR_UINT64(-1)
 #else  /* !HAVE_LONG_LONG */
 typedef struct {
 #ifdef IS_LITTLE_ENDIAN
     PRUint32 lo, hi;