Bug 1350291, uplift NSPR_4_15_BETA, r=franziskus
authorKai Engert <kaie@kuix.de>
Fri, 24 Mar 2017 14:58:00 +0100
changeset 349558 ddc2134eb60392a934dd04677c3aa0d6782df981
parent 349557 88fc3630ece43f5542bd4d4b18bbc7603d2725b8
child 349559 adb38e68486ec6f5b8114d776c2f806dac7c536b
push id31553
push userkwierso@gmail.com
push dateSat, 25 Mar 2017 00:17:38 +0000
treeherdermozilla-central@65b0ac174753 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfranziskus
bugs1350291
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1350291, uplift NSPR_4_15_BETA, r=franziskus
nsprpub/TAG-INFO
nsprpub/config/prdepend.h
nsprpub/configure
nsprpub/configure.in
nsprpub/lib/ds/plvrsion.c
nsprpub/lib/libc/src/plvrsion.c
nsprpub/lib/prstreams/plvrsion.c
nsprpub/pr/include/prinit.h
nsprpub/pr/src/io/prlayer.c
nsprpub/pr/src/misc/praton.c
nsprpub/pr/src/misc/prnetdb.c
nsprpub/pr/src/misc/prtime.c
nsprpub/pr/src/prvrsion.c
nsprpub/pr/src/pthreads/ptio.c
nsprpub/pr/tests/vercheck.c
--- a/nsprpub/TAG-INFO
+++ b/nsprpub/TAG-INFO
@@ -1,1 +1,1 @@
-NSPR_4_14_RTM
+NSPR_4_15_BETA1
--- a/nsprpub/config/prdepend.h
+++ b/nsprpub/config/prdepend.h
@@ -5,9 +5,8 @@
 
 /*
  * 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/nsprpub/configure
+++ b/nsprpub/configure
@@ -2483,17 +2483,17 @@ case $target_os in *\ *) target_os=`echo
 # The aliases save the names the user supplied, while $host etc.
 # will get canonicalized.
 test -n "$target_alias" &&
   test "$program_prefix$program_suffix$program_transform_name" = \
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
 
 MOD_MAJOR_VERSION=4
-MOD_MINOR_VERSION=14
+MOD_MINOR_VERSION=15
 MOD_PATCH_VERSION=0
 NSPR_MODNAME=nspr20
 _HAVE_PTHREADS=
 USE_PTHREADS=
 USE_USER_PTHREADS=
 USE_NSPR_THREADS=
 USE_N32=
 USE_X32=
@@ -5419,16 +5419,50 @@ rm -f core conftest.err conftest.$ac_obj
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_res" >&5
 $as_echo "$_res" >&6; }
 else
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma diagnostic" >&5
+$as_echo_n "checking for pragma diagnostic... " >&6; }
+if test "$GNU_CC" = "1"; then
+    cat >dummy-hello.c <<EOF
+#ifdef _PR_HAS_PRAGMA_DIAGNOSTIC
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
+#endif
+int main() {
+    char *dummy = "";
+    return 0;
+}
+EOF
+    ${CC} -Werror=unused-but-set-variable -S dummy-hello.c -o dummy-hello.s 2>&5
+    if test $? != 0; then
+        ${CC} -Werror=unused-but-set-variable -D_PR_HAS_PRAGMA_DIAGNOSTIC -S dummy-hello.c -o dummy-hello.s 2>&5
+        if test $? = 0; then
+            CFLAGS="$CFLAGS -D_PR_HAS_PRAGMA_DIAGNOSTIC=1"
+            _res=yes
+        else
+            _res=no
+        fi
+    else
+        _res=no
+    fi
+    rm -f dummy-hello.c dummy-hello.s
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_res" >&5
+$as_echo "$_res" >&6; }
+else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
 _SAVE_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler supports -fprofile-generate" >&5
 $as_echo_n "checking whether C compiler supports -fprofile-generate... " >&6; }
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -6519,16 +6553,18 @@ fi
     $as_echo "#define XP_UNIX 1" >>confdefs.h
 
     $as_echo "#define DARWIN 1" >>confdefs.h
 
     $as_echo "#define HAVE_BSD_FLOCK 1" >>confdefs.h
 
     $as_echo "#define HAVE_SOCKLEN_T 1" >>confdefs.h
 
+    $as_echo "#define HAVE_POINTER_LOCALTIME_R 1" >>confdefs.h
+
     AS='$(CC) -x assembler-with-cpp'
     CFLAGS="$CFLAGS -Wall -fno-common"
     case "${target_cpu}" in
         arm*)
             CPU_ARCH=arm
             ;;
         i*86*|x86_64)
             if test -n "$USE_64"; then
@@ -6970,16 +7006,18 @@ tools are selected during the Xcode/Deve
         IMPL_STRATEGY=_PTH
     fi
     $as_echo "#define XP_UNIX 1" >>confdefs.h
 
     $as_echo "#define _GNU_SOURCE 1" >>confdefs.h
 
     $as_echo "#define HAVE_FCNTL_FILE_LOCKING 1" >>confdefs.h
 
+    $as_echo "#define HAVE_POINTER_LOCALTIME_R 1" >>confdefs.h
+
     case "${target}" in
     *-android*|*-linuxandroid*)
         OS_TARGET=Android
         $as_echo "#define LINUX 1" >>confdefs.h
 
         ;;
     *-linux*)
         $as_echo "#define LINUX 1" >>confdefs.h
--- a/nsprpub/configure.in
+++ b/nsprpub/configure.in
@@ -10,17 +10,17 @@ AC_CONFIG_SRCDIR([pr/include/nspr.h])
 
 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
 AC_CANONICAL_TARGET
 
 dnl ========================================================
 dnl = Defaults
 dnl ========================================================
 MOD_MAJOR_VERSION=4
-MOD_MINOR_VERSION=14
+MOD_MINOR_VERSION=15
 MOD_PATCH_VERSION=0
 NSPR_MODNAME=nspr20
 _HAVE_PTHREADS=
 USE_PTHREADS=
 USE_USER_PTHREADS=
 USE_NSPR_THREADS=
 USE_N32=
 USE_X32=
@@ -711,16 +711,50 @@ if test -n "$GNU_CC" && test -n "$GNU_CX
     fi
     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
     AC_MSG_RESULT([$_res])
 else
     AC_MSG_RESULT([no])
 fi
 
 dnl ========================================================
+dnl Check for pragma diagnostic
+dnl ========================================================
+
+AC_MSG_CHECKING([for pragma diagnostic])
+if test "$GNU_CC" = "1"; then
+    cat >dummy-hello.c <<EOF
+#ifdef _PR_HAS_PRAGMA_DIAGNOSTIC
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
+#endif
+int main() {
+    char *dummy = "";
+    return 0;
+}
+EOF
+    ${CC} -Werror=unused-but-set-variable -S dummy-hello.c -o dummy-hello.s 2>&5
+    if test $? != 0; then
+        ${CC} -Werror=unused-but-set-variable -D_PR_HAS_PRAGMA_DIAGNOSTIC -S dummy-hello.c -o dummy-hello.s 2>&5
+        if test $? = 0; then
+            CFLAGS="$CFLAGS -D_PR_HAS_PRAGMA_DIAGNOSTIC=1"
+            _res=yes
+        else
+            _res=no
+        fi
+    else
+        _res=no
+    fi
+    rm -f dummy-hello.c dummy-hello.s
+    AC_MSG_RESULT([$_res])
+else
+    AC_MSG_RESULT([no])
+fi
+
+dnl ========================================================
 dnl Profile guided optimization
 dnl ========================================================
 dnl Test for profiling options
 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
 
 _SAVE_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
 
@@ -1344,16 +1378,17 @@ case "$target" in
 
     ;;
 
 *-darwin*)
     AC_DEFINE(XP_UNIX)
     AC_DEFINE(DARWIN)
     AC_DEFINE(HAVE_BSD_FLOCK)
     AC_DEFINE(HAVE_SOCKLEN_T)
+    AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
     AS='$(CC) -x assembler-with-cpp'
     CFLAGS="$CFLAGS -Wall -fno-common"
     case "${target_cpu}" in
         arm*)
             CPU_ARCH=arm
             ;;
         i*86*|x86_64)
             if test -n "$USE_64"; then
@@ -1784,16 +1819,17 @@ tools are selected during the Xcode/Deve
 *-linux*|*-gnu*|*-k*bsd*-gnu|*-android*|*-linuxandroid*)
     if test -z "$USE_NSPR_THREADS"; then
         USE_PTHREADS=1
         IMPL_STRATEGY=_PTH
     fi
     AC_DEFINE(XP_UNIX)
     AC_DEFINE(_GNU_SOURCE)
     AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
+    AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
     case "${target}" in
     *-android*|*-linuxandroid*)
         OS_TARGET=Android
         AC_DEFINE(LINUX)
         ;;
     *-linux*)
         AC_DEFINE(LINUX)
         ;;
--- a/nsprpub/lib/ds/plvrsion.c
+++ b/nsprpub/lib/ds/plvrsion.c
@@ -69,25 +69,32 @@ PRVersionDescription VERSION_DESC_NAME =
  */
 static char rcsid[] = "$Header: NSPR " PR_VERSION _DEBUG_STRING
         "  " _BUILD_STRING " $";
 static char sccsid[] = "@(#)NSPR " PR_VERSION _DEBUG_STRING
         "  " _BUILD_STRING;
 
 #endif /* XP_UNIX */
 
+#ifdef _PR_HAS_PRAGMA_DIAGNOSTIC
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
+#endif
 PR_IMPLEMENT(const PRVersionDescription*) libVersionPoint()
 {
 #ifdef XP_UNIX
     /*
      * Add dummy references to rcsid and sccsid to prevent them
      * from being optimized away as unused variables.
      */
     const char *dummy;
     
     dummy = rcsid;
     dummy = sccsid;
 #endif
     return &VERSION_DESC_NAME;
 }  /* versionEntryPointType */
+#ifdef _PR_HAS_PRAGMA_DIAGNOSTIC
+#pragma GCC diagnostic pop
+#endif
 
 /* plvrsion.c */
 
--- a/nsprpub/lib/libc/src/plvrsion.c
+++ b/nsprpub/lib/libc/src/plvrsion.c
@@ -69,25 +69,32 @@ PRVersionDescription VERSION_DESC_NAME =
  */
 static char rcsid[] = "$Header: NSPR " PR_VERSION _DEBUG_STRING
         "  " _BUILD_STRING " $";
 static char sccsid[] = "@(#)NSPR " PR_VERSION _DEBUG_STRING
         "  " _BUILD_STRING;
 
 #endif /* XP_UNIX */
 
+#ifdef _PR_HAS_PRAGMA_DIAGNOSTIC
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
+#endif
 PR_IMPLEMENT(const PRVersionDescription*) libVersionPoint()
 {
 #ifdef XP_UNIX
     /*
      * Add dummy references to rcsid and sccsid to prevent them
      * from being optimized away as unused variables.
      */
     const char *dummy;
     
     dummy = rcsid;
     dummy = sccsid;
 #endif
     return &VERSION_DESC_NAME;
 }  /* versionEntryPointType */
+#ifdef _PR_HAS_PRAGMA_DIAGNOSTIC
+#pragma GCC diagnostic pop
+#endif
 
 /* plvrsion.c */
 
--- a/nsprpub/lib/prstreams/plvrsion.c
+++ b/nsprpub/lib/prstreams/plvrsion.c
@@ -69,25 +69,32 @@ PRVersionDescription VERSION_DESC_NAME =
  */
 static char rcsid[] = "$Header: NSPR " PR_VERSION _DEBUG_STRING
         "  " _BUILD_STRING " $";
 static char sccsid[] = "@(#)NSPR " PR_VERSION _DEBUG_STRING
         "  " _BUILD_STRING;
 
 #endif /* XP_UNIX */
 
+#ifdef _PR_HAS_PRAGMA_DIAGNOSTIC
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
+#endif
 PR_IMPLEMENT(const PRVersionDescription*) libVersionPoint()
 {
 #ifdef XP_UNIX
     /*
      * Add dummy references to rcsid and sccsid to prevent them
      * from being optimized away as unused variables.
      */
     const char *dummy;
     
     dummy = rcsid;
     dummy = sccsid;
 #endif
     return &VERSION_DESC_NAME;
 }  /* versionEntryPointType */
+#ifdef _PR_HAS_PRAGMA_DIAGNOSTIC
+#pragma GCC diagnostic pop
+#endif
 
 /* plvrsion.c */
 
--- a/nsprpub/pr/include/prinit.h
+++ b/nsprpub/pr/include/prinit.h
@@ -26,21 +26,21 @@ PR_BEGIN_EXTERN_C
 /*
 ** NSPR's version is used to determine the likelihood that the version you
 ** used to build your component is anywhere close to being compatible with
 ** what is in the underlying library.
 **
 ** The format of the version string is
 **     "<major version>.<minor version>[.<patch level>] [<Beta>]"
 */
-#define PR_VERSION  "4.14"
+#define PR_VERSION  "4.15 Beta"
 #define PR_VMAJOR   4
-#define PR_VMINOR   14
+#define PR_VMINOR   15
 #define PR_VPATCH   0
-#define PR_BETA     PR_FALSE
+#define PR_BETA     PR_TRUE
 
 /*
 ** PRVersionCheck
 **
 ** The basic signature of the function that is called to provide version
 ** checking. The result will be a boolean that indicates the likelihood
 ** that the underling library will perform as the caller expects.
 **
--- a/nsprpub/pr/src/io/prlayer.c
+++ b/nsprpub/pr/src/io/prlayer.c
@@ -647,19 +647,21 @@ retry:
               identity_cache.ident < identity_cache.length);
     identity = identity_cache.ident + 1;
     if (identity >= identity_cache.length)  /* there's no room */
     {
         /* we have to do something - hopefully it's already done */
         if ((NULL != names) && (identity < length))
         {
             /* what we did is still okay */
-            memcpy(
-                names, identity_cache.name,
-                identity_cache.length * sizeof(char*));
+            if (identity_cache.length != 0) {
+                memcpy(
+                    names, identity_cache.name,
+                    identity_cache.length * sizeof(char*));
+            }
             old = identity_cache.name;
             identity_cache.name = names;
             identity_cache.length = length;
             names = NULL;
         }
         else
         {
             PR_Unlock(identity_cache.ml);
--- a/nsprpub/pr/src/misc/praton.c
+++ b/nsprpub/pr/src/misc/praton.c
@@ -172,27 +172,29 @@ pr_inet_aton(const char *cp, PRUint32 *a
     n = pp - parts + 1;
     switch (n) {
     case 1:                /*%< a -- 32 bits */
         break;
 
     case 2:                /*%< a.b -- 8.24 bits */
         if (val > 0xffffffU)
             return (0);
-        val |= parts[0] << 24;
+        val |= (unsigned int)parts[0] << 24;
         break;
 
     case 3:                /*%< a.b.c -- 8.8.16 bits */
         if (val > 0xffffU)
             return (0);
-        val |= (parts[0] << 24) | (parts[1] << 16);
+        val |= ((unsigned int)parts[0] << 24) | ((unsigned int)parts[1] << 16);
         break;
 
     case 4:                /*%< a.b.c.d -- 8.8.8.8 bits */
         if (val > 0xffU)
             return (0);
-        val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
+        val |= ((unsigned int)parts[0] << 24) |
+               ((unsigned int)parts[1] << 16) |
+               ((unsigned int)parts[2] << 8);
         break;
     }
     *addr = PR_htonl(val);
     return (1);
 }
 
--- a/nsprpub/pr/src/misc/prnetdb.c
+++ b/nsprpub/pr/src/misc/prnetdb.c
@@ -1400,17 +1400,17 @@ PR_IMPLEMENT(PRIntn) PR_EnumerateHostEnt
 }  /* PR_EnumerateHostEnt */
 
 PR_IMPLEMENT(PRStatus) PR_InitializeNetAddr(
     PRNetAddrValue val, PRUint16 port, PRNetAddr *addr)
 {
     PRStatus rv = PR_SUCCESS;
     if (!_pr_initialized) _PR_ImplicitInitialization();
 
-	if (val != PR_IpAddrNull) memset(addr, 0, sizeof(addr->inet));
+	if (val != PR_IpAddrNull) memset(addr, 0, sizeof(*addr));
 	addr->inet.family = AF_INET;
 	addr->inet.port = htons(port);
 	switch (val)
 	{
 	case PR_IpAddrNull:
 		break;  /* don't overwrite the address */
 	case PR_IpAddrAny:
 		addr->inet.ip = htonl(INADDR_ANY);
@@ -1772,48 +1772,36 @@ PR_IMPLEMENT(PRUint16) PR_ntohs(PRUint16
 PR_IMPLEMENT(PRUint32) PR_ntohl(PRUint32 n) { return ntohl(n); }
 PR_IMPLEMENT(PRUint16) PR_htons(PRUint16 n) { return htons(n); }
 PR_IMPLEMENT(PRUint32) PR_htonl(PRUint32 n) { return htonl(n); }
 PR_IMPLEMENT(PRUint64) PR_ntohll(PRUint64 n)
 {
 #ifdef IS_BIG_ENDIAN
     return n;
 #else
-    PRUint64 tmp;
     PRUint32 hi, lo;
-    LL_L2UI(lo, n);
-    LL_SHR(tmp, n, 32);
-    LL_L2UI(hi, tmp);
+    lo = (PRUint32)n;
+    hi = (PRUint32)(n >> 32);
     hi = PR_ntohl(hi);
     lo = PR_ntohl(lo);
-    LL_UI2L(n, lo);
-    LL_SHL(n, n, 32);
-    LL_UI2L(tmp, hi);
-    LL_ADD(n, n, tmp);
-    return n;
+    return ((PRUint64)lo << 32) + (PRUint64)hi;
 #endif
 }  /* ntohll */
 
 PR_IMPLEMENT(PRUint64) PR_htonll(PRUint64 n)
 {
 #ifdef IS_BIG_ENDIAN
     return n;
 #else
-    PRUint64 tmp;
     PRUint32 hi, lo;
-    LL_L2UI(lo, n);
-    LL_SHR(tmp, n, 32);
-    LL_L2UI(hi, tmp);
+    lo = (PRUint32)n;
+    hi = (PRUint32)(n >> 32);
     hi = htonl(hi);
     lo = htonl(lo);
-    LL_UI2L(n, lo);
-    LL_SHL(n, n, 32);
-    LL_UI2L(tmp, hi);
-    LL_ADD(n, n, tmp);
-    return n;
+    return ((PRUint64)lo << 32) + (PRUint64)hi;
 #endif
 }  /* htonll */
 
 
 /*
  * Implementation of PR_GetAddrInfoByName and friends
  *
  * Compile-time options:
--- a/nsprpub/pr/src/misc/prtime.c
+++ b/nsprpub/pr/src/misc/prtime.c
@@ -490,16 +490,30 @@ PR_NormalizeTime(PRExplodedTime *time, P
 
 #define MT_safe_localtime(timer, result) \
         (localtime_r(timer, result) == -1 ? NULL: result)
 
 #elif defined(HAVE_POINTER_LOCALTIME_R)
 
 #define MT_safe_localtime localtime_r
 
+#elif defined(_MSC_VER)
+
+/* Visual C++ has had localtime_s() since Visual C++ 2005. */
+
+static struct tm *MT_safe_localtime(const time_t *clock, struct tm *result)
+{
+    errno_t err = localtime_s(result, clock);
+    if (err != 0) {
+        errno = err;
+        return NULL;
+    }
+    return result;
+}
+
 #else
 
 #define HAVE_LOCALTIME_MONITOR 1  /* We use 'monitor' to serialize our calls
                                    * to localtime(). */
 static PRLock *monitor = NULL;
 
 static struct tm *MT_safe_localtime(const time_t *clock, struct tm *result)
 {
@@ -575,16 +589,17 @@ void _PR_CleanupTime(void)
 #if defined(XP_UNIX) || defined(XP_PC) || defined(XP_BEOS)
 
 PR_IMPLEMENT(PRTimeParameters)
 PR_LocalTimeParameters(const PRExplodedTime *gmt)
 {
 
     PRTimeParameters retVal;
     struct tm localTime;
+    struct tm *localTimeResult;
     time_t secs;
     PRTime secs64;
     PRInt64 usecPerSec;
     PRInt64 usecPerSec_1;
     PRInt64 maxInt32;
     PRInt64 minInt32;
     PRInt32 dayOffset;
     PRInt32 offset2Jan1970;
@@ -601,17 +616,22 @@ PR_LocalTimeParameters(const PRExplodedT
      * Caveat: the validity of this calculation depends on two
      * assumptions:
      * 1. Daylight saving time was not in effect on Jan. 2, 1970.
      * 2. The time zone of the geographic location has not changed
      *    since Jan. 2, 1970.
      */
 
     secs = 86400L;
-    (void) MT_safe_localtime(&secs, &localTime);
+    localTimeResult = MT_safe_localtime(&secs, &localTime);
+    PR_ASSERT(localTimeResult != NULL);
+    if (localTimeResult == NULL) {
+        /* Shouldn't happen. Use safe fallback for optimized builds. */
+        return PR_GMTParameters(gmt);
+    }
 
     /* GMT is 00:00:00, 2nd of Jan. */
 
     offset2Jan1970 = (PRInt32)localTime.tm_sec 
             + 60L * (PRInt32)localTime.tm_min
             + 3600L * (PRInt32)localTime.tm_hour
             + 86400L * (PRInt32)((PRInt32)localTime.tm_mday - 2L);
 
@@ -952,16 +972,17 @@ PR_ParseTimeStringToExplodedTime(
   TIME_TOKEN zone = TT_UNKNOWN;
   int zone_offset = -1;
   int dst_offset = 0;
   int date = -1;
   PRInt32 year = -1;
   int hour = -1;
   int min = -1;
   int sec = -1;
+  struct tm *localTimeResult;
 
   const char *rest = string;
 
   int iterations = 0;
 
   PR_ASSERT(string && result);
   if (!string || !result) return PR_FAILURE;
 
@@ -1613,17 +1634,21 @@ PR_ParseTimeStringToExplodedTime(
                       return PR_SUCCESS;
                     }
                 }
                 
                 /* So mktime() can't handle this case.  We assume the
                    zone_offset for the date we are parsing is the same as
                    the zone offset on 00:00:00 2 Jan 1970 GMT. */
                 secs = 86400;
-                (void) MT_safe_localtime(&secs, &localTime);
+                localTimeResult = MT_safe_localtime(&secs, &localTime);
+                PR_ASSERT(localTimeResult != NULL);
+                if (localTimeResult == NULL) {
+                    return PR_FAILURE;
+                }
                 zone_offset = localTime.tm_min
                               + 60 * localTime.tm_hour
                               + 1440 * (localTime.tm_mday - 2);
         }
 
   result->tm_params.tp_gmt_offset = zone_offset * 60;
   result->tm_params.tp_dst_offset = dst_offset * 60;
 
--- a/nsprpub/pr/src/prvrsion.c
+++ b/nsprpub/pr/src/prvrsion.c
@@ -69,25 +69,32 @@ PRVersionDescription VERSION_DESC_NAME =
  */
 static char rcsid[] = "$Header: NSPR " PR_VERSION _DEBUG_STRING
         "  " _BUILD_STRING " $";
 static char sccsid[] = "@(#)NSPR " PR_VERSION _DEBUG_STRING
         "  " _BUILD_STRING;
 
 #endif /* XP_UNIX */
 
+#ifdef _PR_HAS_PRAGMA_DIAGNOSTIC
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
+#endif
 PR_IMPLEMENT(const PRVersionDescription*) libVersionPoint(void)
 {
 #ifdef XP_UNIX
     /*
      * Add dummy references to rcsid and sccsid to prevent them
      * from being optimized away as unused variables.
      */ 
     const char *dummy;
 
     dummy = rcsid;
     dummy = sccsid;
 #endif
     return &VERSION_DESC_NAME;
 }  /* versionEntryPointType */
+#ifdef _PR_HAS_PRAGMA_DIAGNOSTIC
+#pragma GCC diagnostic pop
+#endif
 
 /* prvrsion.c */
 
--- a/nsprpub/pr/src/pthreads/ptio.c
+++ b/nsprpub/pr/src/pthreads/ptio.c
@@ -1537,33 +1537,36 @@ static PRStatus pt_Fsync(PRFileDesc *fd)
 
 static PRStatus pt_Connect(
     PRFileDesc *fd, const PRNetAddr *addr, PRIntervalTime timeout)
 {
     PRIntn rv = -1, syserrno;
     pt_SockLen addr_len;
 	const PRNetAddr *addrp = addr;
 #if defined(_PR_HAVE_SOCKADDR_LEN) || defined(_PR_INET6)
-	PRUint16 md_af = addr->raw.family;
     PRNetAddr addrCopy;
 #endif
+#ifdef _PR_HAVE_SOCKADDR_LEN
+    PRUint16 md_af = addr->raw.family;
+#endif
 
     if (pt_TestAbort()) return PR_FAILURE;
 
     PR_ASSERT(IsValidNetAddr(addr) == PR_TRUE);
     addr_len = PR_NETADDR_SIZE(addr);
-#if defined(_PR_INET6)
-	if (addr->raw.family == PR_AF_INET6) {
-		md_af = AF_INET6;
-#ifndef _PR_HAVE_SOCKADDR_LEN
-		addrCopy = *addr;
-		addrCopy.raw.family = AF_INET6;
-		addrp = &addrCopy;
+#ifdef _PR_INET6
+    if (addr->raw.family == PR_AF_INET6) {
+#ifdef _PR_HAVE_SOCKADDR_LEN
+        md_af = AF_INET6;
+#else
+        addrCopy = *addr;
+        addrCopy.raw.family = AF_INET6;
+        addrp = &addrCopy;
 #endif
-	}
+    }
 #endif
 
 #ifdef _PR_HAVE_SOCKADDR_LEN
     addrCopy = *addr;
     ((struct sockaddr*)&addrCopy)->sa_len = addr_len;
     ((struct sockaddr*)&addrCopy)->sa_family = md_af;
     addrp = &addrCopy;
 #endif
@@ -1727,42 +1730,45 @@ failed:
 }  /* pt_Accept */
 
 static PRStatus pt_Bind(PRFileDesc *fd, const PRNetAddr *addr)
 {
     PRIntn rv;
     pt_SockLen addr_len;
 	const PRNetAddr *addrp = addr;
 #if defined(_PR_HAVE_SOCKADDR_LEN) || defined(_PR_INET6)
-	PRUint16 md_af = addr->raw.family;
     PRNetAddr addrCopy;
 #endif
+#ifdef _PR_HAVE_SOCKADDR_LEN
+    PRUint16 md_af = addr->raw.family;
+#endif
 
     if (pt_TestAbort()) return PR_FAILURE;
 
     PR_ASSERT(IsValidNetAddr(addr) == PR_TRUE);
     if (addr->raw.family == AF_UNIX)
     {
         /* Disallow relative pathnames */
         if (addr->local.path[0] != '/')
         {
             PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
             return PR_FAILURE;
         }
     }
 
-#if defined(_PR_INET6)
-	if (addr->raw.family == PR_AF_INET6) {
-		md_af = AF_INET6;
-#ifndef _PR_HAVE_SOCKADDR_LEN
-		addrCopy = *addr;
-		addrCopy.raw.family = AF_INET6;
-		addrp = &addrCopy;
+#ifdef _PR_INET6
+    if (addr->raw.family == PR_AF_INET6) {
+#ifdef _PR_HAVE_SOCKADDR_LEN
+        md_af = AF_INET6;
+#else
+        addrCopy = *addr;
+        addrCopy.raw.family = AF_INET6;
+        addrp = &addrCopy;
 #endif
-	}
+    }
 #endif
 
     addr_len = PR_NETADDR_SIZE(addr);
 #ifdef _PR_HAVE_SOCKADDR_LEN
     addrCopy = *addr;
     ((struct sockaddr*)&addrCopy)->sa_len = addr_len;
     ((struct sockaddr*)&addrCopy)->sa_family = md_af;
     addrp = &addrCopy;
@@ -1984,32 +1990,35 @@ static PRInt32 pt_SendTo(
     PRInt32 amount, PRIntn flags, const PRNetAddr *addr,
     PRIntervalTime timeout)
 {
     PRInt32 syserrno, bytes = -1;
     PRBool fNeedContinue = PR_FALSE;
     pt_SockLen addr_len;
 	const PRNetAddr *addrp = addr;
 #if defined(_PR_HAVE_SOCKADDR_LEN) || defined(_PR_INET6)
-	PRUint16 md_af = addr->raw.family;
     PRNetAddr addrCopy;
 #endif
+#ifdef _PR_HAVE_SOCKADDR_LEN
+    PRUint16 md_af = addr->raw.family;
+#endif
 
     if (pt_TestAbort()) return bytes;
 
     PR_ASSERT(IsValidNetAddr(addr) == PR_TRUE);
-#if defined(_PR_INET6)
-	if (addr->raw.family == PR_AF_INET6) {
-		md_af = AF_INET6;
-#ifndef _PR_HAVE_SOCKADDR_LEN
-		addrCopy = *addr;
-		addrCopy.raw.family = AF_INET6;
-		addrp = &addrCopy;
+#ifdef _PR_INET6
+    if (addr->raw.family == PR_AF_INET6) {
+#ifdef _PR_HAVE_SOCKADDR_LEN
+        md_af = AF_INET6;
+#else
+        addrCopy = *addr;
+        addrCopy.raw.family = AF_INET6;
+        addrp = &addrCopy;
 #endif
-	}
+    }
 #endif
 
     addr_len = PR_NETADDR_SIZE(addr);
 #ifdef _PR_HAVE_SOCKADDR_LEN
     addrCopy = *addr;
     ((struct sockaddr*)&addrCopy)->sa_len = addr_len;
     ((struct sockaddr*)&addrCopy)->sa_family = md_af;
     addrp = &addrCopy;
--- a/nsprpub/pr/tests/vercheck.c
+++ b/nsprpub/pr/tests/vercheck.c
@@ -34,34 +34,34 @@ static char *compatible_version[] = {
     "4.7", "4.7.1", "4.7.2", "4.7.3", "4.7.4", "4.7.5",
     "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", "4.9.4", "4.9.5",
     "4.9.6",
     "4.10", "4.10.1", "4.10.2", "4.10.3", "4.10.4",
     "4.10.5", "4.10.6", "4.10.7", "4.10.8", "4.10.9",
-    "4.10.10", "4.11", "4.12", "4.13",
+    "4.10.10", "4.11", "4.12", "4.13", "4.14"
     PR_VERSION
 };
 
 /*
  * This release is not backward compatible with the old
  * NSPR 2.1 and 3.x releases.
  *
  * Any release is incompatible with future releases and
  * patches.
  */
 static char *incompatible_version[] = {
     "2.1 19980529",
     "3.0", "3.0.1",
     "3.1", "3.1.1", "3.1.2", "3.1.3",
     "3.5", "3.5.1",
-    "4.14.1",
-    "4.15", "4.15.1",
+    "4.15.1",
+    "4.16", "4.16.1",
     "10.0", "11.1", "12.14.20"
 };
 
 int main(int argc, char **argv)
 {
     int idx;
     int num_compatible = sizeof(compatible_version) / sizeof(char *);
     int num_incompatible = sizeof(incompatible_version) / sizeof(char *);