info: completely switch of caching for timeouts <= 0
[olsrd.git] / gcc-warnings
old mode 100644 (file)
new mode 100755 (executable)
index 110044c..edf90e3
@@ -1,13 +1,15 @@
 #!/bin/sh
 #
-# We expect warning options for gcc as argumenst and return the ones which are accepted
-# by the given gcc.
+# We expect warning options for gcc as arguments and return the ones which are
+# accepted by the given gcc.
 #
-# $Id: gcc-warnings,v 1.5 2007/11/04 18:45:30 bernd67 Exp $
 
 set -ue
 #set -vx
 
+# make sure we do not use some locale ....
+export LANG=C LC_ALL=C LC_COLLATE=C LC_CTYPE=C LC_MESSAGES=C LC_NUMERIC=C
+
 OPTS=""
 for param; do
     case "$param" in
@@ -17,7 +19,7 @@ for param; do
 done
 
 testcompile() {
-    $CC $OPTS -E - 2>&1 <<- EOF
+    $CC $OPTS -x c -o /dev/null - 2>&1 <<- EOF
        int main(void) {
            return 0;
        }
@@ -25,16 +27,53 @@ EOF
 }
 
 parsetest() {
-    while read error; do 
-       case "$error" in
-       *error:\ unrecognized\ *option*)
-                                       opt="${error#*\`}"
-                                       opt="${opt%\'*}"
-                                       opt="${error#*\"}"
-                                       opt="${opt%\"*}"
-                                       OPTS=`echo $OPTS | sed -e s/$opt//g`
-                                       ;;
+    while read error; do
+        case "$error" in
+        *:\ unrecognized\ *option\ \"*)
+            opt="${error#*\"}"
+            opt="${opt%\"*}"
+            ;;
+        *:\ unrecognized\ *option\ \‘*)
+            opt="${error#*\‘}"
+            opt="${opt%\‘*}"
+            ;;
+        *:\ unrecognized\ *option\ \'*)
+            opt="${error#*\'}"
+            opt="${opt%\'*}"
+            ;;
+        *:\ unrecognized\ *option\ \`*)
+            opt="${error#*\`}"
+            opt="${opt%\'*}"
+            ;;
+
+        # 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
+       # we remove all instances. And we save against leading "-"
+       NEW_OPTS=""
+       for o in $OPTS; do
+           case "$o" in
+               $opt) : echo "Removed $o" >&2;;
+               *)    NEW_OPTS="$NEW_OPTS $o";;
+           esac
+       done
+       OPTS="$NEW_OPTS"
     done
     echo $OPTS
 }