From fda41e8d249e479a02f67c7b3e31c98f0bb8d553 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 14 Oct 2021 10:40:39 -0400 Subject: [PATCH 1/2] ci: Enable -fanalyzer Followup to https://github.com/ostreedev/ostree/pull/2463 One thing I noticed here is we lost usage of `build-check.sh` which also invokes `clang`, which doesn't speak `-fanalyzer` and would be broken by this if we try to enable `build-check.sh` again. But that can come later. --- ci/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/build.sh b/ci/build.sh index 2afcd018..ffdeba01 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -30,6 +30,6 @@ esac # always fail on warnings; https://github.com/ostreedev/ostree/pull/971 # NB: this disables the default set of flags from configure.ac -export CFLAGS="-Wall -Werror ${CFLAGS:-}" +export CFLAGS="-Wall -Werror -fanalyzer ${CFLAGS:-}" build --enable-gtk-doc ${CONFIGOPTS:-} From 58dc6a08b49384cbde3346f6b0675d684fe7c8db Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 18 Oct 2021 11:44:44 -0400 Subject: [PATCH 2/2] tests/rollsum: Use `g_malloc` not `malloc` To pacify gcc's `-fanalyzer`. --- tests/test-rollsum.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test-rollsum.c b/tests/test-rollsum.c index 08c78b66..08aea235 100644 --- a/tests/test-rollsum.c +++ b/tests/test-rollsum.c @@ -75,8 +75,8 @@ test_rollsum (void) #define MAX_BUFFER_SIZE 1000000 gsize i; int len; - g_autofree unsigned char *a = malloc (MAX_BUFFER_SIZE); - g_autofree unsigned char *b = malloc (MAX_BUFFER_SIZE); + g_autofree unsigned char *a = g_malloc (MAX_BUFFER_SIZE); + g_autofree unsigned char *b = g_malloc (MAX_BUFFER_SIZE); g_autoptr(GRand) rand = g_rand_new (); /* These two buffers produce the same crc32. */