From 3a7eed0833bfbdeba1c154f47217267997a9e4ba Mon Sep 17 00:00:00 2001 From: Sebastian Reimers Date: Mon, 11 Mar 2024 20:41:13 +0100 Subject: [PATCH 1/3] ci/clang-analyze: bump clang version and fix status-bugs --- .github/workflows/clang-analyze.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/clang-analyze.yml b/.github/workflows/clang-analyze.yml index 10de2c285..8b345b4d5 100644 --- a/.github/workflows/clang-analyze.yml +++ b/.github/workflows/clang-analyze.yml @@ -23,10 +23,10 @@ jobs: - name: Install clang-tools run: | wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - - sudo add-apt-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" - sudo apt-get update && sudo apt-get install -y clang-tools-15 + sudo add-apt-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" + sudo apt-get update && sudo apt-get install -y clang-tools-17 - name: analyze run: | - cmake -B build -DCMAKE_C_COMPILER=clang-15 - analyze-build-15 --cdb build/compile_commands.json + cmake -B build -DCMAKE_C_COMPILER=clang-17 + analyze-build-17 --cdb build/compile_commands.json --status-bugs From 193704831ad821e24202dc6183f36bf415a17e86 Mon Sep 17 00:00:00 2001 From: Sebastian Reimers Date: Mon, 11 Mar 2024 20:45:37 +0100 Subject: [PATCH 2/3] add verbose flag --- .github/workflows/clang-analyze.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/clang-analyze.yml b/.github/workflows/clang-analyze.yml index 8b345b4d5..567e95ae7 100644 --- a/.github/workflows/clang-analyze.yml +++ b/.github/workflows/clang-analyze.yml @@ -29,4 +29,4 @@ jobs: - name: analyze run: | cmake -B build -DCMAKE_C_COMPILER=clang-17 - analyze-build-17 --cdb build/compile_commands.json --status-bugs + analyze-build-17 --cdb build/compile_commands.json --status-bugs -v From bc6ef1b86b9b5cca828477fc3e56541db53af5bd Mon Sep 17 00:00:00 2001 From: Sebastian Reimers Date: Tue, 12 Mar 2024 10:04:31 +0100 Subject: [PATCH 3/3] misc: fix clang analyzer warnings test/httpauth.c:654:3: warning: Value stored to 'mb_printed' is never read test/sipsess.c:216:2: warning: 1st function call argument is an uninitialized Value test/sipsess.c:236:2: warning: 1st function call argument is an uninitialized Value test/sipsess.c:535:2: warning: 1st function call argument is an uninitialized value --- src/fmt/time.c | 2 +- test/httpauth.c | 8 ++++---- test/sipsess.c | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/fmt/time.c b/src/fmt/time.c index 76410c438..20e8c7d50 100644 --- a/src/fmt/time.c +++ b/src/fmt/time.c @@ -148,7 +148,7 @@ int fmt_timestamp_us(struct re_printf *pf, void *arg) int h, m, s; uint64_t us; struct timespec tspec; - struct tm tm; + struct tm tm = {0}; #if defined(WIN32) && !defined(__MINGW32__) timespec_get(&tspec, TIME_UTC); diff --git a/test/httpauth.c b/test/httpauth.c index 950b7c64e..322dc0b13 100644 --- a/test/httpauth.c +++ b/test/httpauth.c @@ -651,13 +651,13 @@ int test_httpauth_digest_response(void) goto out; } - mb_printed = mem_deref (mb_printed); - resp = mem_deref(resp); + mem_deref(mb_printed); + mem_deref(resp); continue; out: - mb_printed = mem_deref (mb_printed); - resp = mem_deref(resp); + mem_deref(mb_printed); + mem_deref(resp); break; } diff --git a/test/sipsess.c b/test/sipsess.c index 0fd63f035..f9cd05b85 100644 --- a/test/sipsess.c +++ b/test/sipsess.c @@ -203,7 +203,7 @@ static int make_sdp(struct mbuf **mbp, const char *sdp) static void send_update_a(void *arg) { struct test *test = arg; - struct mbuf *desc; + struct mbuf *desc = NULL; int err; err = make_sdp(&desc, sdp_a); @@ -223,7 +223,7 @@ static void send_update_a(void *arg) static void send_update_b(void *arg) { struct test *test = arg; - struct mbuf *desc; + struct mbuf *desc = NULL; int err; err = make_sdp(&desc, sdp_b); @@ -433,7 +433,7 @@ static void close_handler(int err, const struct sip_msg *msg, void *arg) static void conn_handler(const struct sip_msg *msg, void *arg) { struct test *test = arg; - struct mbuf *desc; + struct mbuf *desc = NULL; int err; char *hdrs = test->rel100_b == REL100_REQUIRED ? "Require: 100rel\r\n" : "";