dyn_gw/dyn_gw_plain require /proc, remove from default build on non-Linux
[olsrd.git] / gcc-warnings
old mode 100644 (file)
new mode 100755 (executable)
index db3eea5..9bf8079
@@ -1,9 +1,8 @@
 #!/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.6 2007/11/12 00:12:15 bernd67 Exp $
 
 set -ue
 #set -vx
@@ -20,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;
        }
@@ -29,18 +28,28 @@ EOF
 
 parsetest() {
     while read error; do 
-       case "$error" in
-       *error:\ unrecognized\ *option\ \"*)
-                                       opt="${error#*\"}"
-                                       opt="${opt%\"*}"
-                                       OPTS="${OPTS//$opt}"
-                                       ;;
-       *error:\ unrecognized\ *option\ \`*)
-                                       opt="${error#*\`}"
-                                       opt="${opt%\'*}"
-                                       OPTS="${OPTS//$opt}"
-                                       ;;
+        case "$error" in
+        *:\ unrecognized\ *option\ \"*)
+            opt="${error#*\"}"
+            opt="${opt%\"*}"
+            ;;
+        *:\ unrecognized\ *option\ \`*)
+            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 agoinst 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
 }