X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=.travis.yml;h=f90e0ebda99bc75ae0207df25082753d53b49ab7;hb=fdfe4081593268257cd65932bd5353eade45e190;hp=279753e9df92f1e1afb8dd04b87496e05d1ddfe8;hpb=ba89fe0a933cdd2d11f93470d3c6afa81f65982f;p=i3%2Fi3 diff --git a/.travis.yml b/.travis.yml index 279753e9..f90e0ebd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,7 +32,7 @@ before_install: - sudo cp /tmp/pin /etc/apt/preferences.d/trustypin - sudo apt-get update - sudo apt-get install -t trusty libc6 libc6-dev - - sudo apt-get install --no-install-recommends devscripts equivs + - sudo apt-get install --no-install-recommends devscripts equivs xdotool - sudo apt-get install -t utopic clang-format-3.5 - clang-format-3.5 --version install: @@ -42,6 +42,25 @@ install: - sudo /bin/sh -c 'cpanm -n -v X11::XCB || true' - sudo /bin/sh -c 'cpanm -n -v AnyEvent::I3 || true' script: - - CFLAGS="-Wformat -Wformat-security -Wextra -Wno-unused-parameter -Werror" CPPFLAGS="-D_FORTIFY_SOURCE=0" make -j + - CFLAGS="-Wformat -Wformat-security -Wextra -Wno-unused-parameter -Werror" make -j - (cd testcases && xvfb-run ./complete-run.pl --parallel=1 || (cat latest/complete-run.log; false)) - clang-format-3.5 -i $(find . -name "*.[ch]" | tr '\n' ' ') && git diff --exit-code || (echo 'Code was not formatted using clang-format!'; false) + - | + funcs='malloc|calloc|realloc|strdup|strndup|asprintf|write' + cstring='"([^"\\]|\\.)*"' + cchar="'[^\\\\]'|'\\\\.[^']*'" + regex="^([^'\"]|${cstring}|${cchar})*\<(${funcs})\>" + detected=0 + while IFS= read -r file; do + if { cpp -w -fpreprocessed "$file" || exit "$?"; } | grep -E -- "$regex"; then + echo "^ $file calls a function that has a safe counterpart." + detected=1 + fi + done << EOF + $(find -name '*.c' -not -name safewrappers.c -not -name strndup.c) + EOF + if [ "$detected" -ne 0 ]; then + echo + echo "Calls of functions that have safe counterparts were detected." + exit 1 + fi