From 13730bce906137a4574eb4ed87041722277ab041 Mon Sep 17 00:00:00 2001 From: Jens Breitbart Date: Sun, 10 Sep 2017 19:22:07 +0200 Subject: [PATCH] Use clang-tidy for every file compiled with the host compiler. (#80) * Use clang-tidy for every file compiled with the host compiler. * Reorder includes. * Fixed a memory leak in the proxy. --- .travis.yml | 3 ++- cmake/HermitCore-Utils.cmake | 1 + tools/proxy.c | 22 +++++++++++----------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index d4b0127bb..04a76bfda 100644 --- a/.travis.yml +++ b/.travis.yml @@ -93,9 +93,10 @@ script: - cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=true .. - CC=$COMPILERC CXX=$COMPILERCXX make -j1 package - cd $TRAVIS_BUILD_DIR + - if [ -n "$RUNCLANGTIDY" ]; then git ls-files "*.c" |grep tools/ | xargs -P 1 -I{} clang-tidy -p build/tools-prefix/src/tools-build/compile_commands.json -header-filter="^((?\!build).)*$" {}; fi + - if [ -n "$RUNCLANGTIDY" ]; then git ls-files "*.c" |grep arch/x86/loader/ | xargs -P 1 -I{} clang-tidy -p build/arch_x86_loader-prefix/src/arch_x86_loader-build/compile_commands.json -header-filter="^((?\!build).)*$" {}; fi - ./tests.sh - notifications: slack: hermitcore:UtcfeEXkbpx3WyIDK2Wm2beS diff --git a/cmake/HermitCore-Utils.cmake b/cmake/HermitCore-Utils.cmake index 31c2adfb1..f614f5c0f 100644 --- a/cmake/HermitCore-Utils.cmake +++ b/cmake/HermitCore-Utils.cmake @@ -98,6 +98,7 @@ function(build_external NAME PATH DEPENDS) -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DLOCAL_PREFIX_BASE_DIR=${LOCAL_PREFIX_BASE_DIR} -DCMAKE_INSTALL_MESSAGE=NEVER + -DCMAKE_EXPORT_COMPILE_COMMANDS=true --no-warn-unused-cli ${DO_PROFILING} ${CMD_VARS} diff --git a/tools/proxy.c b/tools/proxy.c index 8c5adf472..951917d6d 100644 --- a/tools/proxy.c +++ b/tools/proxy.c @@ -27,25 +27,24 @@ #define _GNU_SOURCE -#include -#include -#include -#include -#include #include #include #include #include +#include #include #include #include +#include +#include +#include +#include #include +#include #include #include -#include #include -#include -#include +#include #include "proxy.h" @@ -242,7 +241,7 @@ static int is_hermit_available(void) } if (!file) - return 0; + goto err; //PROXY_DEBUG("Open log file\n"); @@ -255,9 +254,10 @@ static int is_hermit_available(void) } fclose(file); - free(line); - return ret; + err: + free(line); + return ret; } // wait until HermitCore is sucessfully booted