Skip to content

Commit

Permalink
ci/clang-analyze: bump clang version and fix status-bugs (#1079)
Browse files Browse the repository at this point in the history
* ci/clang-analyze: bump clang version and fix status-bugs

* add verbose flag

* 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
  • Loading branch information
sreimers authored Mar 12, 2024
1 parent 4030c79 commit c2a2377
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/clang-analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 -v
2 changes: 1 addition & 1 deletion src/fmt/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions test/httpauth.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
6 changes: 3 additions & 3 deletions test/sipsess.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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" : "";
Expand Down

0 comments on commit c2a2377

Please sign in to comment.