Bug 1293334, bustage fix, the compiler flag to suppress errors about misleading whitespace, is only required with gcc 6 and newer, and only on the old branch that doesn't contain our whitespace cleanup. r=franziskus NSS_3_21_BRANCH
authorKai Engert <kaie@kuix.de>
Fri, 23 Sep 2016 20:31:37 +0200
branchNSS_3_21_BRANCH
changeset 12597 6ca6047461825fea7538d4de357cd42f3801e2f0
parent 12596 6883f1fc912908d3767a147e8df803a3b11bde28
child 12634 41ecad3cc627011287131aebd13d079a4dd0a26b
push id1581
push userkaie@kuix.de
push dateFri, 23 Sep 2016 18:32:17 +0000
reviewersfranziskus
bugs1293334
Bug 1293334, bustage fix, the compiler flag to suppress errors about misleading whitespace, is only required with gcc 6 and newer, and only on the old branch that doesn't contain our whitespace cleanup. r=franziskus
coreconf/Werror.mk
--- a/coreconf/Werror.mk
+++ b/coreconf/Werror.mk
@@ -55,16 +55,22 @@ ifndef WARNING_CFLAGS
           $(warning Unable to find gcc 4.8 or greater, disabling -Werror)
           NSS_ENABLE_WERROR = 0
         endif
       endif
     endif
   endif #ndef NSS_ENABLE_WERROR
 
   ifeq ($(NSS_ENABLE_WERROR),1)
-    WARNING_CFLAGS += -Werror -Wno-error=misleading-indentation
+    WARNING_CFLAGS += -Werror
+    # For gcc 6 and newer we need -Wno-error=misleading-indentation
+    # to prevent compiler errors caused by mixed whitespace.
+    CC_VERSION := $(subst ., ,$(shell $(CC) -dumpversion))
+    ifeq (,$(filter 0 1 2 3 4 5,$(word 1,$(CC_VERSION))))
+      WARNING_CFLAGS += -Wno-error=misleading-indentation
+    endif
   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.
     WARNING_CFLAGS += -DNSS_NO_GCC48
   endif
   export WARNING_CFLAGS
 endif # ndef WARNING_CFLAGS