Bug 1182667 - Removing strict aliasing checks in sslsnce.c for gcc < 4.8
authorMartin Thomson <martin.thomson@gmail.com>
Thu, 20 Aug 2015 10:32:54 -0700
changeset 11533 6cd266575bbd6766d767b9dbaff753989a86e07f
parent 11532 2df598ffa0a9947c5dfe0dd9eca4f2a7b10a232a
child 11534 eb02897d4c823683ce5e28b480448bcda089f1c5
push id700
push usermartin.thomson@gmail.com
push dateThu, 20 Aug 2015 17:33:34 +0000
bugs1182667
Bug 1182667 - Removing strict aliasing checks in sslsnce.c for gcc < 4.8
coreconf/Darwin.mk
coreconf/Linux.mk
lib/ssl/sslsnce.c
--- a/coreconf/Darwin.mk
+++ b/coreconf/Darwin.mk
@@ -92,17 +92,17 @@ NSS_HAS_GCC48 := $(shell \
     `$(CC) -dumpversion | cut -f 2 -d . -` -ge 8 -o \
     `$(CC) -dumpversion | cut -f 1 -d . -` -ge 5 ] && \
   echo true || echo false)
 export NSS_HAS_GCC48
 endif
 ifneq (true,$(NSS_HAS_GCC48))
 # Old versions of gcc (< 4.8) don't support #pragma diagnostic in functions.
 # Here, we disable use of that #pragma and the warnings it suppresses.
-OS_CFLAGS += -DNSS_NO_GCC48 -Wno-unused-variable
+OS_CFLAGS += -DNSS_NO_GCC48 -Wno-unused-variable -Wno-strict-aliasing
 $(warning Unable to find gcc >= 4.8)
 endif
 
 ifdef BUILD_OPT
 ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE))
 	OPTIMIZER       = -Oz
 else
 	OPTIMIZER	= -O2
--- a/coreconf/Linux.mk
+++ b/coreconf/Linux.mk
@@ -158,17 +158,17 @@ NSS_HAS_GCC48 := $(shell \
     `$(CC) -dumpversion | cut -f 2 -d . -` -ge 8 -o \
     `$(CC) -dumpversion | cut -f 1 -d . -` -ge 5 ] && \
   echo true || echo false)
 export NSS_HAS_GCC48
 endif
 ifneq (true,$(NSS_HAS_GCC48))
 # Old versions of gcc (< 4.8) don't support #pragma diagnostic in functions.
 # Here, we disable use of that #pragma and the warnings it suppresses.
-OS_CFLAGS += -DNSS_NO_GCC48 -Wno-unused-variable
+OS_CFLAGS += -DNSS_NO_GCC48 -Wno-unused-variable -Wno-strict-aliasing
 $(warning Unable to find gcc >= 4.8)
 endif
 
 ifdef USE_PTHREADS
 	DEFINES		+= -D_REENTRANT
 endif
 
 ARCH			= linux
--- a/lib/ssl/sslsnce.c
+++ b/lib/ssl/sslsnce.c
@@ -1022,17 +1022,17 @@ CloseCache(cacheDesc *cache)
     }
     if (cache->cacheMemMap) {
 	PR_CloseFileMap(cache->cacheMemMap);
 	cache->cacheMemMap = NULL;
     }
     memset(cache, 0, sizeof *cache);
 }
 
-#ifdef __GNUC__
+#if defined(__GNUC__) && !defined(NSS_NO_GCC48)
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wstrict-aliasing"
 #endif
 static SECStatus
 InitCache(cacheDesc *cache, int maxCacheEntries, int maxCertCacheEntries,
           int maxSrvNameCacheEntries, PRUint32 ssl2_timeout, 
           PRUint32 ssl3_timeout, const char *directory, PRBool shared)
 {
@@ -1265,17 +1265,17 @@ InitCache(cacheDesc *cache, int maxCache
     cache->numSIDCacheLocksInitialized = locks_initialized;
 
     return SECSuccess;
 
 loser:
     CloseCache(cache);
     return SECFailure;
 }
-#ifdef __GNUC__
+#if defined(__GNUC__) && !defined(NSS_NO_GCC48)
 #pragma GCC diagnostic pop
 #endif
 
 PRUint32
 SSL_GetMaxServerCacheLocks(void)
 {
     return ssl_max_sid_cache_locks + 2;
     /* The extra two are the cert cache lock and the key cache lock. */