travis-CI: fails compilation on warning
authorLudovic Rousseau <ludovic.rousseau@free.fr>
Sat, 27 Feb 2016 16:17:24 +0000 (17:17 +0100)
committerLudovic Rousseau <ludovic.rousseau@free.fr>
Wed, 2 Mar 2016 15:07:22 +0000 (16:07 +0100)
The travis-autogen.sh script enable some extra warnings not used by
default. The idea is to detect problem as early as possible.

.travis.yml
travis-autogen.sh [new file with mode: 0755]

index 2745538..585cd6f 100644 (file)
@@ -23,5 +23,5 @@ addons:
 
 script:
     - ./autogen.sh && make -j4
-    - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./autogen.sh --disable-udev && make -j4; fi
+    - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./travis-autogen.sh --disable-udev && make -j4; fi
     - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then cd Xcode && xcodebuild -project libusb.xcodeproj ; fi
diff --git a/travis-autogen.sh b/travis-autogen.sh
new file mode 100755 (executable)
index 0000000..d83e07d
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+# Warnings enabled
+CFLAGS="-Wall -Wextra"
+
+CFLAGS+=" -Wbad-function-cast"
+#CFLAGS+=" -Wcast-align"
+CFLAGS+=" -Wchar-subscripts"
+CFLAGS+=" -Wempty-body"
+CFLAGS+=" -Wformat"
+CFLAGS+=" -Wformat-security"
+CFLAGS+=" -Winit-self"
+CFLAGS+=" -Winline"
+CFLAGS+=" -Wmissing-declarations"
+CFLAGS+=" -Wmissing-include-dirs"
+CFLAGS+=" -Wmissing-prototypes"
+CFLAGS+=" -Wnested-externs"
+CFLAGS+=" -Wold-style-definition"
+CFLAGS+=" -Wpointer-arith"
+CFLAGS+=" -Wredundant-decls"
+CFLAGS+=" -Wshadow"
+CFLAGS+=" -Wstrict-prototypes"
+CFLAGS+=" -Wswitch-enum"
+CFLAGS+=" -Wundef"
+CFLAGS+=" -Wuninitialized"
+CFLAGS+=" -Wunused"
+CFLAGS+=" -Wwrite-strings"
+CFLAGS+=" -fdiagnostics-color=auto"
+
+# warnings disabled on purpose
+CFLAGS+=" -Wno-unused-parameter"
+CFLAGS+=" -Wno-unused-function"
+CFLAGS+=" -Wno-deprecated-declarations"
+
+# should be removed and the code fixed
+CFLAGS+=" -Wno-incompatible-pointer-types-discards-qualifiers"
+
+# fails on warning
+CFLAGS+=" -Werror"
+
+./autogen.sh