--- pr/include/prcountr.h.orig	2022-09-12 11:40:15 UTC
+++ pr/include/prcountr.h
@@ -394,7 +394,7 @@ PR_SubtractFromCounter(
 #define PR_GET_COUNTER(counter,handle)\
     (counter) = PR_GetCounter((handle))
 #else
-#define PR_GET_COUNTER(counter,handle) 0
+#define PR_GET_COUNTER(counter,handle)
 #endif
 
 NSPR_API(PRUint32)
@@ -468,7 +468,7 @@ PR_SetCounter(
 #define PR_FIND_NEXT_COUNTER_QNAME(next,handle)\
     (next) = PR_FindNextCounterQname((handle))
 #else
-#define PR_FIND_NEXT_COUNTER_QNAME(next,handle) NULL
+#define PR_FIND_NEXT_COUNTER_QNAME(next,handle)
 #endif
 
 NSPR_API(PRCounterHandle)
--- pr/src/misc/pralarm.c.orig	2022-09-12 11:40:15 UTC
+++ pr/src/misc/pralarm.c
@@ -101,7 +101,7 @@ static void PR_CALLBACK pr_alarmNotifier
 
     while (why != abort)
     {
-        PRIntervalTime pause;
+        PRIntervalTime pause = 0;
 
         PR_Lock(alarm->lock);
         while (why == scan)
--- pr/src/misc/prdtoa.c.orig	2022-09-12 11:40:15 UTC
+++ pr/src/misc/prdtoa.c
@@ -2885,9 +2885,9 @@ double dd; int mode, ndigits, *decpt, *s
        to hold the suppressed trailing zeros.
     */
 
-    int bbits, b2, b5, be, dig, i, ieps, ilim, ilim0, ilim1,
-        j, j1, k, k0, k_check, leftright, m2, m5, s2, s5,
-        spec_case, try_quick;
+    int bbits, b2, b5, be, dig, i, ieps, ilim = -1, ilim0, ilim1 = -1,
+                                         j, j1, k, k0, k_check, leftright, m2, m5, s2, s5,
+                                         spec_case, try_quick;
     Long L;
 #ifndef Sudden_Underflow
     int denorm;
--- pr/src/pthreads/ptio.c.orig	2022-09-12 11:40:15 UTC
+++ pr/src/pthreads/ptio.c
@@ -5309,6 +5309,7 @@ PR_IMPLEMENT(PRInt32) PR_Select(
 
     if (timeout == PR_INTERVAL_NO_TIMEOUT) {
         tvp = NULL;
+        start = 0; /* Not needed, but shuts down a warning */
     } else {
         tv.tv_sec = (PRInt32)PR_IntervalToSeconds(timeout);
         tv.tv_usec = (PRInt32)PR_IntervalToMicroseconds(
--- pr/src/pthreads/ptsynch.c.orig	2022-09-12 11:40:15 UTC
+++ pr/src/pthreads/ptsynch.c
@@ -25,7 +25,7 @@ static pthread_condattr_t _pt_cvar_attr;
 extern PTDebug pt_debug;  /* this is shared between several modules */
 #endif  /* defined(DEBUG) */
 
-#if defined(FREEBSD)
+#if (defined(FREEBSD) || defined(MIDNIGHTBSD)) && (defined(DEBUG) || defined(FORCE_PR_ASSERT))
 /*
  * On older versions of FreeBSD, pthread_mutex_trylock returns EDEADLK.
  * Newer versions return EBUSY.  We still need to support both.
@@ -51,7 +51,8 @@ void _PR_InitLocks(void)
     PR_ASSERT(0 == rv);
 
 #if (defined(LINUX) && (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) || \
-    (defined(FREEBSD) && __FreeBSD_version > 700055)
+    (defined(FREEBSD) && __FreeBSD_version > 700055) || \
+    (defined(MIDNIGHTBSD) && __MidnightBSD_version > 1000)
     rv = pthread_mutexattr_settype(&_pt_mattr, PTHREAD_MUTEX_ADAPTIVE_NP);
     PR_ASSERT(0 == rv);
 #endif
@@ -952,6 +953,7 @@ PR_IMPLEMENT(PRStatus) PR_DeleteSemaphor
  */
 #if (defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)) \
     || (defined(FREEBSD) && __FreeBSD_version < 1200059) \
+    || (defined(MIDNIGHTBSD) && __MidnightBSD_version < 300000) \
     || defined(OPENBSD) || defined(BSDI) \
     || defined(DARWIN)
 /* union semun is defined by including <sys/sem.h> */
