make: improve clang support
authorFerry Huberts <ferry.huberts@pelagic.nl>
Sat, 5 Mar 2016 14:30:32 +0000 (15:30 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Sat, 5 Mar 2016 14:30:32 +0000 (15:30 +0100)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Makefile.inc
gcc-warnings

index 9d79ecf..e27dcc5 100644 (file)
@@ -111,8 +111,6 @@ WARNINGS += -Wcast-align
 WARNINGS += -Wcast-qual
 WARNINGS += -Wdeclaration-after-statement
 WARNINGS += -Wdisabled-optimization
-WARNINGS += -Wdouble-promotion
-WARNINGS += -Wduplicated-cond
 WARNINGS += -Wendif-labels
 WARNINGS += -Werror=format-security
 WARNINGS += -Wextra
@@ -121,9 +119,6 @@ WARNINGS += -Wformat-security
 WARNINGS += -Wformat-y2k
 WARNINGS += -Winit-self
 WARNINGS += -Winline
-WARNINGS += -Wjump-misses-init
-WARNINGS += -Wlogical-op
-WARNINGS += -Wmisleading-indentation
 WARNINGS += -Wmissing-declarations
 WARNINGS += -Wmissing-format-attribute
 WARNINGS += -Wmissing-noreturn
@@ -140,13 +135,21 @@ WARNINGS += -Wshift-overflow
 WARNINGS += -Wsign-compare
 WARNINGS += -Wstrict-prototypes
 WARNINGS += -Wswitch-default
-WARNINGS += -Wsync-nand
 WARNINGS += -Wtautological-compare
-WARNINGS += -Wtrampolines
 WARNINGS += -Wundef
 WARNINGS += -Wunused-parameter
 WARNINGS += -Wwrite-strings
 
+ifneq ($(CC),clang)
+# clang doesn't report these as errors or warnings in the gcc-warnings script
+WARNINGS += -Wdouble-promotion
+WARNINGS += -Wduplicated-cond
+WARNINGS += -Wjump-misses-init
+WARNINGS += -Wlogical-op
+WARNINGS += -Wmisleading-indentation
+WARNINGS += -Wsync-nand
+WARNINGS += -Wtrampolines
+endif
 
 # we have small inline functions in src/lq_route.h which should always be inlined
 WARNINGS += -finline-limit=350
index 3ed7617..edf90e3 100755 (executable)
@@ -27,7 +27,7 @@ EOF
 }
 
 parsetest() {
-    while read error; do 
+    while read error; do
         case "$error" in
         *:\ unrecognized\ *option\ \"*)
             opt="${error#*\"}"
@@ -45,7 +45,23 @@ parsetest() {
             opt="${error#*\`}"
             opt="${opt%\'*}"
             ;;
-        *) continue
+
+        # clang
+        *:\ unknown\ argument:\ \'*)
+            opt="${error#*\'}"
+            opt="${opt%\'*}"
+            ;;
+        *:\ unknown\ warning\ option\ \'*)
+            opt="${error#*\'}"
+            opt="${opt%\'*}"
+            ;;
+        *:\ optimization\ flag\ *\ is\ not\ supported)
+            opt="${error#*\'}"
+            opt="${opt%\'*}"
+            ;;
+
+        *)
+            continue
             ;;
        esac
        # if we come here, we have in $opt the option to remove. and