From b7e6c14a353bc03b0911dacc95f5e59f81e95f99 Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Sun, 29 Nov 2020 20:41:57 +0100 Subject: use strict CFLAGS to catch common mistakes in ci pipeline A number of common coding errors are missed by the compiler. They turn up only after release once packages are build with full CFLAGS. Adjust the gitlab CI to catch such errors: -Wall enables a number of diagnostics -Wno-deprecated-declarations will hide a bogus warning. As long as an API exists it can be used. Noone beside a curious developer will actually take the time to do research and look for the replacment. In the wild this warning is just noise in the build log. -Werror=implicit-function-declaration will point out missing includes. In case such errors are not fixed, the resulting code will assume int for function arguments and function return values. -Werror=return-type will point out incorrect return values. The caller will most likely receive just garbage. Signed-off-by: Olaf Hering --- ci/build_libs.sh | 9 ++++++++- ci/build_project.yml | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'ci') diff --git a/ci/build_libs.sh b/ci/build_libs.sh index 2853951..e85c765 100644 --- a/ci/build_libs.sh +++ b/ci/build_libs.sh @@ -16,6 +16,13 @@ AUTOGEN_OPTIONS=" --enable-gtk-doc " +CFLAGS=" + -Wall + -Wno-deprecated-declarations + -Werror=implicit-function-declaration + -Werror=return-type +" + # list of git repos in build order REPOS="${XFCE_BASE}/xfce/xfce4-dev-tools.git ${XFCE_BASE}/xfce/libxfce4util.git @@ -34,7 +41,7 @@ for URL in ${REPOS}; do TAG=$(git describe --abbrev=0 --match "$NAME*" 2>/dev/null) echo "--- Building $NAME ($TAG) ---" git checkout -b build-$TAG $TAG - ./autogen.sh $AUTOGEN_OPTIONS + env "CFLAGS=${CFLAGS}" ./autogen.sh $AUTOGEN_OPTIONS make -j${NPROC:-$(nproc)} make install echo "$(pwd): $(git describe)" >> /tmp/xfce_build_version_info.txt diff --git a/ci/build_project.yml b/ci/build_project.yml index bfccb06..42a890d 100644 --- a/ci/build_project.yml +++ b/ci/build_project.yml @@ -33,7 +33,7 @@ distcheck: .make: before_script: - - ./autogen.sh + - env "CFLAGS=-Wall -Wno-deprecated-declarations -Werror=implicit-function-declaration -Werror=return-type" ./autogen.sh rules: # If there are changes to .po, never run. We also check # BEFORE_SHA to see if it is zeros, in which case we are -- cgit v1.2.1