Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Bug 634793: update NSPR to NSPR_4_9_5_BETA1 and add the TestPRIntN.cpp

test to verify PRInt{N} matches int{N}_t.  r=ehsan,jlebar.
  • Loading branch information...
commit b6fde75b253c015c7e191b008894b449ba6b4f42 1 parent 144ea02
Wan-Teh Chang authored
View
2  nsprpub/TAG-INFO
@@ -1 +1 @@
-NSPR_4_9_4_RTM
+NSPR_4_9_5_BETA1
View
179 nsprpub/admin/repackage.sh
@@ -1,179 +0,0 @@
-#! /bin/sh
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-# ------------------------------------------------------------------
-# repackage.sh -- Repackage NSPR from /s/b/c to mozilla.org format
-#
-# syntax: repackage.sh
-#
-# Description:
-# repackage.sh creates NSPR binary distributions for mozilla.org from
-# the internal binary distributions in /share/builds/components/nspr20.
-# There are reasons why we can't just push the internal binary distributions
-# to mozilla.org. External developers prefer to use the common archive
-# file format for their platforms, rather than the jar files we use internally.
-#
-# On Unix, we create a tar.gz file. On Windows, we create a zip file.
-# For example: NSPR 4.1.1, these would be nspr-4.1.1.tar.gz and nspr-4.1.1.zip.
-#
-# When unpacked, nspr-4.1.1.tar.gz or nspr-4.1.1.zip should expand to a
-# nspr-4.1.1 directory that contains three subdirectories: include, lib,
-# and bin. The header files, with the correct line endings for the
-# platform, are in nspr-4.1.1/include. The libraries are in nspr-4.1.1/lib.
-# The executable programs are in nspr-4.1.1/bin.
-#
-# Note! Files written with Gnu tar are not readable by some non-Gnu
-# versions. Sun, in particular.
-#
-#
-#
-#
-# ------------------------------------------------------------------
-
-FROMTOP=/share/builds/components/nspr20/v4.9.4
-TOTOP=./v4.9.4
-NSPRDIR=nspr-4.9.4
-SOURCETAG=NSPR_4_9_4_RTM
-
-#
-# enumerate Unix object directories on /s/b/c
-UNIX_OBJDIRS="
-HP-UXB.11.11_64_DBG.OBJ
-HP-UXB.11.11_64_OPT.OBJ
-HP-UXB.11.11_DBG.OBJ
-HP-UXB.11.11_OPT.OBJ
-HP-UXB.11.23_ia64_32_DBG.OBJ
-HP-UXB.11.23_ia64_32_OPT.OBJ
-HP-UXB.11.23_ia64_64_DBG.OBJ
-HP-UXB.11.23_ia64_64_OPT.OBJ
-Linux2.4_x86_glibc_PTH_DBG.OBJ
-Linux2.4_x86_glibc_PTH_OPT.OBJ
-Linux2.6_x86_64_glibc_PTH_DBG.OBJ
-Linux2.6_x86_64_glibc_PTH_OPT.OBJ
-Linux2.6_x86_glibc_PTH_DBG.OBJ
-Linux2.6_x86_glibc_PTH_OPT.OBJ
-SunOS5.9_64_DBG.OBJ
-SunOS5.9_64_OPT.OBJ
-SunOS5.9_DBG.OBJ
-SunOS5.9_OPT.OBJ
-"
-#
-# enumerate Windows object directories on /s/b/c
-WIN_OBJDIRS="
-WIN954.0_DBG.OBJ
-WIN954.0_DBG.OBJD
-WIN954.0_OPT.OBJ
-WINNT5.0_DBG.OBJ
-WINNT5.0_DBG.OBJD
-WINNT5.0_OPT.OBJ
-"
-
-#
-# Create the destination directory.
-#
-echo "removing directory $TOTOP"
-rm -rf $TOTOP
-echo "creating directory $TOTOP"
-mkdir -p $TOTOP
-
-#
-# Generate the tar.gz files for Unix platforms.
-#
-for OBJDIR in $UNIX_OBJDIRS; do
- echo "removing directory $NSPRDIR"
- rm -rf $NSPRDIR
- echo "creating directory $NSPRDIR"
- mkdir $NSPRDIR
-
- echo "creating directory $NSPRDIR/include"
- mkdir $NSPRDIR/include
- echo "copying $FROMTOP/$OBJDIR/include"
- cp -r $FROMTOP/$OBJDIR/include $NSPRDIR
-
- echo "copying $FROMTOP/$OBJDIR/lib"
- cp -r $FROMTOP/$OBJDIR/lib $NSPRDIR
-
- echo "copying $FROMTOP/$OBJDIR/bin"
- cp -r $FROMTOP/$OBJDIR/bin $NSPRDIR
-
- echo "creating directory $TOTOP/$OBJDIR"
- mkdir $TOTOP/$OBJDIR
- echo "creating $TOTOP/$OBJDIR/$NSPRDIR.tar"
- tar cvf $TOTOP/$OBJDIR/$NSPRDIR.tar $NSPRDIR
- echo "gzipping $TOTOP/$OBJDIR/$NSPRDIR.tar"
- gzip $TOTOP/$OBJDIR/$NSPRDIR.tar
-done
-
-#
-# Generate the zip files for Windows platforms.
-#
-for OBJDIR in $WIN_OBJDIRS; do
- echo "removing directory $NSPRDIR"
- rm -rf $NSPRDIR
- echo "creating directory $NSPRDIR"
- mkdir $NSPRDIR
-
- echo "creating directory $NSPRDIR/include"
- mkdir $NSPRDIR/include
- echo "creating directory $NSPRDIR/include/private"
- mkdir $NSPRDIR/include/private
- echo "creating directory $NSPRDIR/include/obsolete"
- mkdir $NSPRDIR/include/obsolete
-
- # copy headers and adjust unix line-end to Windows line-end
- # Note: Watch out for the "sed" command line.
- # when editing the command, take care to preserve the "^M" as the literal
- # cntl-M character! in vi, use "cntl-v cntl-m" to enter it!
- #
- headers=`ls $FROMTOP/$OBJDIR/include/*.h`
- for header in $headers; do
- sed -e 's/$/
-/g' $header > $NSPRDIR/include/`basename $header`
- done
- headers=`ls $FROMTOP/$OBJDIR/include/obsolete/*.h`
- for header in $headers; do
- sed -e 's/$/
-/g' $header > $NSPRDIR/include/obsolete/`basename $header`
- done
- headers=`ls $FROMTOP/$OBJDIR/include/private/*.h`
- for header in $headers; do
- sed -e 's/$/
-/g' $header > $NSPRDIR/include/private/`basename $header`
- done
-
- echo "copying $FROMTOP/$OBJDIR/lib"
- cp -r $FROMTOP/$OBJDIR/lib $NSPRDIR
-
- echo "copying $FROMTOP/$OBJDIR/bin"
- cp -r $FROMTOP/$OBJDIR/bin $NSPRDIR
-
- echo "creating directory $TOTOP/$OBJDIR"
- mkdir -p $TOTOP/$OBJDIR
- echo "creating $TOTOP/$OBJDIR/$NSPRDIR.zip"
- zip -r $TOTOP/$OBJDIR/$NSPRDIR.zip $NSPRDIR
-done
-
-#
-# package the source from CVS
-#
-echo "Packaging source"
-echo "removing directory $NSPRDIR"
-rm -rf $NSPRDIR
-echo "creating directory $NSPRDIR"
-mkdir $NSPRDIR
-myWD=`pwd`
-cd $NSPRDIR
-echo "Pulling source from CVS with tag $SOURCETAG"
-cvs co -r $SOURCETAG mozilla/nsprpub
-cd $myWD
-mkdir $TOTOP/src
-echo "Creating source tar file: $TOTOP/src/$NSPRDIR.tar"
-tar cvf $TOTOP/src/$NSPRDIR.tar $NSPRDIR
-echo "gzip $TOTOP/src/$NSPRDIR.tar"
-gzip $TOTOP/src/$NSPRDIR.tar
-
-#
-# Remove the working directory.
-#
View
1  nsprpub/config/prdepend.h
@@ -10,3 +10,4 @@
*/
#error "Do not include this header file."
+
View
4 nsprpub/configure
@@ -736,7 +736,7 @@ test "$host_alias" != "$target_alias" &&
MOD_MAJOR_VERSION=4
MOD_MINOR_VERSION=9
-MOD_PATCH_VERSION=4
+MOD_PATCH_VERSION=5
NSPR_MODNAME=nspr20
_HAVE_PTHREADS=
USE_PTHREADS=
@@ -6582,7 +6582,7 @@ s%\[%\\&%g
s%\]%\\&%g
s%\$%$$%g
EOF
-DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' ' | tr '\015' ' '` # Manually modified for MKS support.
+DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
rm -f conftest.defs
View
2  nsprpub/configure.in
@@ -15,7 +15,7 @@ dnl = Defaults
dnl ========================================================
MOD_MAJOR_VERSION=4
MOD_MINOR_VERSION=9
-MOD_PATCH_VERSION=4
+MOD_PATCH_VERSION=5
NSPR_MODNAME=nspr20
_HAVE_PTHREADS=
USE_PTHREADS=
View
6 nsprpub/pr/include/prinit.h
@@ -31,11 +31,11 @@ PR_BEGIN_EXTERN_C
** The format of the version string is
** "<major version>.<minor version>[.<patch level>] [<Beta>]"
*/
-#define PR_VERSION "4.9.4"
+#define PR_VERSION "4.9.5 Beta"
#define PR_VMAJOR 4
#define PR_VMINOR 9
-#define PR_VPATCH 4
-#define PR_BETA PR_FALSE
+#define PR_VPATCH 5
+#define PR_BETA PR_TRUE
/*
** PRVersionCheck
View
2  nsprpub/pr/include/prlong.h
@@ -35,7 +35,7 @@ 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__)
+#if PR_BYTES_PER_LONG == 8 && !defined(PR_ALTERNATE_INT64_TYPEDEF)
#define LL_MAXINT 9223372036854775807L
#define LL_MININT (-LL_MAXINT - 1L)
#define LL_ZERO 0L
View
37 nsprpub/pr/include/prtypes.h
@@ -205,6 +205,36 @@
PR_BEGIN_EXTERN_C
+/*
+** Starting in NSPR 4.9.5, NSPR's exact-width integer types should match
+** the exact-width integer types defined in <stdint.h>. This allows sloppy
+** code to use PRInt{N} and int{N}_t interchangeably.
+**
+** The 8-bit and 16-bit integer types can only be defined using char and
+** short. All platforms define the 32-bit integer types using int. So only
+** the 64-bit integer types could be defined differently.
+**
+** NSPR's original strategy was to use the "shortest" 64-bit integer type:
+** if long is 64-bit, then prefer it over long long. This strategy is also
+** used by Linux/glibc, FreeBSD, and NetBSD.
+**
+** Other platforms use a different strategy: simply define the 64-bit
+** integer types using long long. We define the PR_ALTERNATE_INT64_TYPEDEF
+** macro on these platforms. Note that PR_ALTERNATE_INT64_TYPEDEF is for
+** internal use by NSPR headers only. Do not define or test this macro in
+** your code.
+**
+** NOTE: NSPR can't use <stdint.h> because C99 requires C++ code to define
+** __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS to make all the macros
+** defined in <stdint.h> available. This strange requirement is gone in
+** C11. When most platforms ignore this C99 requirement, NSPR will be able
+** to use <stdint.h>. A patch to do that is in NSPR bug 634793.
+*/
+
+#if defined(__APPLE__) || defined(__ANDROID__) || defined(__OpenBSD__)
+#define PR_ALTERNATE_INT64_TYPEDEF
+#endif
+
/************************************************************************
** TYPES: PRUint8
** PRInt8
@@ -331,12 +361,7 @@ typedef long PRInt32;
************************************************************************/
#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__)
+#if PR_BYTES_PER_LONG == 8 && !defined(PR_ALTERNATE_INT64_TYPEDEF)
typedef long PRInt64;
typedef unsigned long PRUint64;
#define PR_INT64(x) x ## L
View
10 nsprpub/pr/tests/vercheck.c
@@ -20,10 +20,10 @@
#include <stdlib.h>
/*
- * This release (4.9.4) is backward compatible with the
+ * This release (4.9.5) is backward compatible with the
* 4.0.x, 4.1.x, 4.2.x, 4.3.x, 4.4.x, 4.5.x, 4.6.x, 4.7.x,
- * 4.8.x, 4.9, 4.9.1, 4.9.2, and 4.9.3 releases. It, of course,
- * is compatible with itself.
+ * 4.8.x, 4.9, 4.9.1, 4.9.2, 4.9.3, and 4.9.4 releases.
+ * It, of course, is compatible with itself.
*/
static char *compatible_version[] = {
"4.0", "4.0.1", "4.1", "4.1.1", "4.1.2", "4.1.3",
@@ -35,7 +35,7 @@ static char *compatible_version[] = {
"4.7.6",
"4.8", "4.8.1", "4.8.2", "4.8.3", "4.8.4", "4.8.5",
"4.8.6", "4.8.7", "4.8.8", "4.8.9",
- "4.9", "4.9.1", "4.9.2", "4.9.3", PR_VERSION
+ "4.9", "4.9.1", "4.9.2", "4.9.3", "4.9.4", PR_VERSION
};
/*
@@ -50,7 +50,7 @@ static char *incompatible_version[] = {
"3.0", "3.0.1",
"3.1", "3.1.1", "3.1.2", "3.1.3",
"3.5", "3.5.1",
- "4.9.5",
+ "4.9.6",
"4.10", "4.10.1",
"10.0", "11.1", "12.14.20"
};
View
1  xpcom/tests/Makefile.in
@@ -35,6 +35,7 @@ CPPSRCS = \
nsIFileEnumerator.cpp \
TestCallTemplates.cpp \
TestINIParser.cpp \
+ TestPRIntN.cpp \
TestRacingServiceManager.cpp \
TestRegistrationOrder.cpp \
TestThreadPoolListener.cpp \
View
34 xpcom/tests/TestPRIntN.cpp
@@ -0,0 +1,34 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "mozilla/StandardInteger.h"
+
+#include "prtypes.h"
+
+// This test is NOT intended to be run. It's a test to make sure
+// PRInt{N} matches int{N}_t. If they don't match, we should get a
+// compiler warning or error in main().
+
+static void
+ClearNSPRIntTypes(PRInt8 *a, PRInt16 *b, PRInt32 *c, PRInt64 *d)
+{
+ *a = 0; *b = 0; *c = 0; *d = 0;
+}
+
+static void
+ClearStdIntTypes(int8_t *w, int16_t *x, int32_t *y, int64_t *z)
+{
+ *w = 0; *x = 0; *y = 0; *z = 0;
+}
+
+int
+main()
+{
+ PRInt8 a; PRInt16 b; PRInt32 c; PRInt64 d;
+ int8_t w; int16_t x; int32_t y; int64_t z;
+
+ ClearNSPRIntTypes(&w, &x, &y, &z);
+ ClearStdIntTypes(&a, &b, &c, &d);
+ return 0;
+}
Please sign in to comment.
Something went wrong with that request. Please try again.