Bug 1211725 - Enable more warnings, disable errors on sign-compare, r?kaie
☠☠ backed out by 2f6ef09e9495 ☠ ☠
authorMartin Thomson <martin.thomson@gmail.com>
Wed, 07 Oct 2015 06:46:35 +0200
changeset 11639 72caf53cc7cfa16ee6c8359bf0fd8fe4d085738f
parent 11638 65cd77878e18a7280293f8680cbf56a6a843dc38
child 11640 1f20a59a4275f45e052727dc8f6d91d1bef024f4
push id795
push userkaie@kuix.de
push dateThu, 08 Oct 2015 20:00:30 +0000
reviewerskaie
bugs1211725
Bug 1211725 - Enable more warnings, disable errors on sign-compare, r?kaie
coreconf/Darwin.mk
coreconf/Linux.mk
--- a/coreconf/Darwin.mk
+++ b/coreconf/Darwin.mk
@@ -77,30 +77,31 @@ endif
 #     int x = 0;
 # or it may be a declaration of a symbol defined in another file:
 #     extern int x;
 # Use the -fno-common option to force all commons to become true
 # definitions so that the linker can catch multiply-defined symbols.
 # Also, common symbols are not allowed with Darwin dynamic libraries.
 
 OS_CFLAGS	= $(DSO_CFLAGS) $(OS_REL_CFLAGS) -Wall -fno-common -pipe -DDARWIN -DHAVE_STRERROR -DHAVE_BSD_FLOCK $(DARWIN_SDK_CFLAGS)
+OS_CFLAGS += -Wall -Wempty-body -Wpointer-to-int-cast -Wsign-compare -Wtype-limits
 
 ifeq (clang,$(shell $(CC) -? 2>&1 >/dev/null | sed -e 's/:.*//;1q'))
 NSS_HAS_GCC48 = true
 endif
 ifndef NSS_HAS_GCC48
 NSS_HAS_GCC48 := $(shell \
   [ `$(CC) -dumpversion | cut -f 1 -d . -` -eq 4 -a \
     `$(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
 ifeq (true,$(NSS_HAS_GCC48))
-OS_CFLAGS += -Werror
+OS_CFLAGS += -Werror -Wno-error=sign-compare
 else
 # Old versions of gcc (< 4.8) don't support #pragma diagnostic in functions.
 # Use this to disable use of that #pragma and the warnings it suppresses.
 OS_CFLAGS += -DNSS_NO_GCC48 -Wno-unused-variable -Wno-strict-aliasing
 $(warning Unable to find gcc >= 4.8 disabling -Werror)
 endif
 
 ifdef BUILD_OPT
--- a/coreconf/Linux.mk
+++ b/coreconf/Linux.mk
@@ -129,44 +129,45 @@ ifndef COMPILER_TAG
 COMPILER_TAG = _$(shell $(CC) -? 2>&1 >/dev/null | sed -e 's/:.*//;1q')
 CCC_COMPILER_TAG = _$(shell $(CCC) -? 2>&1 >/dev/null | sed -e 's/:.*//;1q')
 endif
 
 ifeq ($(USE_PTHREADS),1)
 OS_PTHREAD = -lpthread 
 endif
 
-OS_CFLAGS		= $(DSO_CFLAGS) $(OS_REL_CFLAGS) $(ARCHFLAG) -Wall -pipe -ffunction-sections -fdata-sections -DLINUX -Dlinux -DHAVE_STRERROR
+OS_CFLAGS		= $(DSO_CFLAGS) $(OS_REL_CFLAGS) $(ARCHFLAG) -pipe -ffunction-sections -fdata-sections -DLINUX -Dlinux -DHAVE_STRERROR
+OS_CFLAGS += -Wall -Wempty-body -Wpointer-to-int-cast -Wsign-compare -Wtype-limits
 OS_LIBS			= $(OS_PTHREAD) -ldl -lc
 
 ifeq ($(COMPILER_TAG),_clang)
 # -Qunused-arguments : clang objects to arguments that it doesn't understand
 #    and fixing this would require rearchitecture
 # -Wno-parentheses-equality : because clang warns about macro expansions
 OS_CFLAGS += -Qunused-arguments -Wno-parentheses-equality
 ifdef BUILD_OPT
 # clang is unable to handle glib's expansion of strcmp and similar for optimized
 # builds, so ignore the resulting errors.
 # See https://llvm.org/bugs/show_bug.cgi?id=20144
-OS_CFLAGS += -Wno-array-bounds -Wno-unevaluated-expression
+OS_CFLAGS += -Wno-error=array-bounds -Wno-error=unevaluated-expression
 endif
 # Clang reports its version as an older gcc, but it's OK
 NSS_HAS_GCC48 = true
 endif
 
 ifndef NSS_HAS_GCC48
 NSS_HAS_GCC48 := $(shell \
   [ `$(CC) -dumpversion | cut -f 1 -d . -` -eq 4 -a \
     `$(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
 ifeq (true,$(NSS_HAS_GCC48))
-OS_CFLAGS += -Werror
+OS_CFLAGS += -Werror -Wno-error=sign-compare
 else
 # Old versions of gcc (< 4.8) don't support #pragma diagnostic in functions.
 # Use this to disable use of that #pragma and the warnings it suppresses.
 OS_CFLAGS += -DNSS_NO_GCC48
 $(warning Unable to find gcc >= 4.8 disabling -Werror)
 endif
 
 ifdef USE_PTHREADS