summaryrefslogtreecommitdiffstats
path: root/nsprpub/pr/include/prtypes.h
diff options
context:
space:
mode:
Diffstat (limited to 'nsprpub/pr/include/prtypes.h')
-rw-r--r--nsprpub/pr/include/prtypes.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/nsprpub/pr/include/prtypes.h b/nsprpub/pr/include/prtypes.h
index 52b3ab0b1..94bca3cfc 100644
--- a/nsprpub/pr/include/prtypes.h
+++ b/nsprpub/pr/include/prtypes.h
@@ -231,7 +231,7 @@ PR_BEGIN_EXTERN_C
** to use <stdint.h>. A patch to do that is in NSPR bug 634793.
*/
-#if defined(__APPLE__) || defined(__ANDROID__) || defined(__OpenBSD__)
+#if defined(__APPLE__) || defined(__OpenBSD__)
#define PR_ALTERNATE_INT64_TYPEDEF
#endif
@@ -245,16 +245,24 @@ PR_BEGIN_EXTERN_C
#if PR_BYTES_PER_BYTE == 1
typedef unsigned char PRUint8;
/*
+** There are two scenarios that require us to define PRInt8 as type 'char'.
+** (1)
** 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.
+** (2)
+** Mozilla C++ code expects the PRInt{N} and int{N}_t types to match (see bug
+** 634793). If a platform defines int8_t as 'char', but NSPR defines it as
+** 'signed char', it results in a type mismatch.
+** On such platforms we define PRInt8 as 'char' to avoid the mismatch.
*/
-#if (defined(HPUX) && defined(__cplusplus) \
+#if (defined(HPUX) && defined(__cplusplus) /* reason 1*/ \
&& !defined(__GNUC__) && __cplusplus < 199707L) \
- || (defined(SCO) && defined(__cplusplus) \
- && !defined(__GNUC__) && __cplusplus == 1L)
+ || (defined(SCO) && defined(__cplusplus) /* reason 1 */ \
+ && !defined(__GNUC__) && __cplusplus == 1L) \
+ || (defined(__sun) && defined(__cplusplus)) /* reason 2 */
typedef char PRInt8;
#else
typedef signed char PRInt8;