From 18bae8dec9bbbee31d0dbb87fffa3adf0538a120 Mon Sep 17 00:00:00 2001 From: Dmitry Baryshkov Date: Mon, 2 Oct 2023 17:41:18 +0300 Subject: [PATCH 1/3] cdba: remove unnecessary initialisation Silence Clang warning by removing unused '0' from struct initialisation. Signed-off-by: Dmitry Baryshkov --- cdba-server.c | 2 +- cdba.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cdba-server.c b/cdba-server.c index df6db01..f1a7157 100644 --- a/cdba-server.c +++ b/cdba-server.c @@ -158,7 +158,7 @@ void cdba_send_buf(int type, size_t len, const void *buf) static int handle_stdin(int fd, void *buf) { - static struct circ_buf recv_buf = { 0 }; + static struct circ_buf recv_buf = { }; struct msg *msg; struct msg hdr; size_t n; diff --git a/cdba.c b/cdba.c index a759aed..00c02b1 100644 --- a/cdba.c +++ b/cdba.c @@ -581,7 +581,7 @@ int main(int argc, char **argv) int timeout_total = 600; struct work *next; struct work *work; - struct circ_buf recv_buf = { 0 }; + struct circ_buf recv_buf = { }; const char *board = NULL; const char *host = NULL; struct timeval now; From ba8fa6e30071c0e30c16d9e9dbe117ce34d08692 Mon Sep 17 00:00:00 2001 From: Caleb Connolly Date: Thu, 19 Oct 2023 23:47:50 +0100 Subject: [PATCH 2/3] only enable -Werror in CI Enabling -Werror by default sucks for everyone who isn't maintaining CDBA. By all means we should enable it in CI, but not for users and not for folks packaging it in distros. Remove it from the flags in meson.build, and use mesons built in option to enable it only in CI. See: https://embeddedartistry.com/blog/2017/05/22/werror-is-not-your-friend/ Signed-off-by: Caleb Connolly --- .github/workflows/ci.yml | 6 +++--- meson.build | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4742f0c..3779bfa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -208,7 +208,7 @@ jobs: if: ${{ matrix.variant == 'i386' }} run: | mkdir build - CFLAGS="-m32" LDFLAGS="-m32" meson setup . build + CFLAGS="-m32" LDFLAGS="-m32" meson setup --errorlogs --werror . build - name: Meson init with cross compile if: ${{ matrix.variant == 'cross-compile' }} @@ -228,13 +228,13 @@ jobs: echo "pkg_config_libdir = '${PKG_CONFIG_PATH}'" >> cross.txt cat cross.txt mkdir build - meson setup --cross-file cross.txt . build + meson setup --errorlogs --werror --cross-file cross.txt . build - name: Meson init if: ${{ matrix.variant == '' }} run: | mkdir build - meson setup . build + meson setup --errorlogs --werror . build - name: Compile run: ninja -C build diff --git a/meson.build b/meson.build index 1b1e01b..63cb838 100644 --- a/meson.build +++ b/meson.build @@ -26,8 +26,7 @@ compiler_cflags = ['-Wno-unused-parameter', # TODO add clang specific options if compiler.get_id() == 'gcc' - compiler_cflags += ['-Werror', # Only set it on GCC - '-Wformat-signedness', + compiler_cflags += ['-Wformat-signedness', '-Wduplicated-cond', '-Wduplicated-branches', '-Wvla-larger-than=1', From 67f2d38308b792261f8a8217f95ebdb92d46db48 Mon Sep 17 00:00:00 2001 From: Caleb Connolly Date: Thu, 19 Oct 2023 23:57:27 +0100 Subject: [PATCH 3/3] ci: add alpine tests I plan to package CDBA in alpine, as it uses musl libc it is a lot easier for things to break there. Add alpine latest edge and stable build tests to catch these. Signed-off-by: Caleb Connolly --- .github/workflows/ci.yml | 2 ++ ci/alpine.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100755 ci/alpine.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3779bfa..15ea69b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,6 +32,8 @@ jobs: family: [x86-64] compiler: [gcc, clang] container: + - alpine:edge + - alpine:latest - archlinux:latest - debian:testing - debian:stable diff --git a/ci/alpine.sh b/ci/alpine.sh new file mode 100755 index 0000000..c4b5083 --- /dev/null +++ b/ci/alpine.sh @@ -0,0 +1,29 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (c) 2021 Canonical Ltd. +# Copyright (c) 2023 Linaro Ltd +# Author: Krzysztof Kozlowski +# +# + +set -ex + +PKGS_CC="gcc" +case $CC in + clang*) + PKGS_CC="clang" + ;; +esac + +apk add \ + linux-headers \ + libftdi1-dev \ + yaml-dev \ + eudev-dev \ + meson \ + musl-dev \ + libc-dev \ + $PKGS_CC + +echo "Install finished: $0"