Skip to content

Commit

Permalink
test: Re-disable gcc -fanalyzer
Browse files Browse the repository at this point in the history
In latest rawhide with gcc 14.0.1 this find too many false positives,
like infinite loops in glib/gmessages.h, or `possible-null-argument`
even when there's an assertion that the value is not NULL, etc.

It's not worth the effort -- this is mostly a Vala project.
  • Loading branch information
martinpitt committed Apr 26, 2024
1 parent 635c86e commit 9ebb6ec
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 27 deletions.
2 changes: 0 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ add_project_arguments(
'-Werror=uninitialized',
# experimental: first check this on all Debian architectures
'-Wcast-align',
# older gcc versions don't know about all the -Wanalyzer errors which we want to quiesce
'-Wno-error=pragmas',
language: 'c')

add_project_arguments('--abi-stability', language: 'vala')
Expand Down
12 changes: 0 additions & 12 deletions src/ioctl_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,16 +302,10 @@ ioctl_tree_next(const ioctl_tree * node)
if (node->next != NULL)
return node->next;

/* HACK: -fanalyzer does not understand this loop */
#pragma GCC diagnostic push
#if !defined(__clang__)
#pragma GCC diagnostic ignored "-Wanalyzer-deref-before-check"
#endif
/* walk up the parents until we find an alternative sibling */
for (; node != NULL; node = node->parent)
if (node->next != NULL)
return node->next;
#pragma GCC diagnostic pop

/* no alternative siblings left, iteration done */
return NULL;
Expand Down Expand Up @@ -348,14 +342,8 @@ ioctl_node_list_append(ioctl_node_list * list, ioctl_tree * element)
if (list->n == list->capacity) {
assert(list->capacity < SIZE_MAX / 2);
list->capacity *= 2;
/* HACK: -fanalyzer incorrectly treats this as memory leak */
#pragma GCC diagnostic push
#if !defined(__clang__)
#pragma GCC diagnostic ignored "-Wanalyzer-malloc-leak"
#endif
list->items = reallocarray(list->items, list->capacity, sizeof(ioctl_tree *));
assert(list->items != NULL);
#pragma GCC diagnostic pop
}

list->items[list->n++] = element;
Expand Down
3 changes: 0 additions & 3 deletions src/uevent_sender.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,6 @@ append_property(char *array, size_t size, size_t offset, const char *name, const
abort();
}

/* this is already true as snprintf always writes the NUL, but -fanalyzer complains about use-of-uninitialized-value */
array[offset + r] = '\0';

/* include the NUL terminator in the string length, as we need to keep it as a separator between keys */
return r + 1;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/run-dnf
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ cd /source
# thanks gcc for making your major version so easy to parse
GCC_VERSION=\\\$(gcc --version | grep -oE '[0-9]+\.[0-9]+' | head -n1 | cut -f1 -d.)
CFLAGS="\$(grep -q rawhide /etc/os-release && echo -fanalyzer)" meson setup /tmp/dbg --buildtype debug --prefix /usr -Dgtk_doc=\${gtk_doc} -Db_coverage=\$coverage --werror
meson setup /tmp/dbg --buildtype debug --prefix /usr -Dgtk_doc=\${gtk_doc} -Db_coverage=\$coverage --werror
cd /tmp/dbg
DESTDIR=/tmp/inst meson install
meson test -v --num-processes=1
Expand Down
9 changes: 0 additions & 9 deletions tests/test-umockdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,6 @@
#define UNUSED __attribute__ ((unused))
#define UNUSED_DATA UNUSED gconstpointer data

/* avoid leak reports inside assertions; leaking stuff on assertion failures does not matter in tests */
#if !defined(__clang__)
#pragma GCC diagnostic ignored "-Wanalyzer-malloc-leak"
#pragma GCC diagnostic ignored "-Wanalyzer-file-leak"
#pragma GCC diagnostic ignored "-Wanalyzer-fd-leak"
#pragma GCC diagnostic ignored "-Wanalyzer-use-of-uninitialized-value"
#pragma GCC diagnostic ignored "-Wanalyzer-fd-use-without-check"
#endif

static gboolean has_real_sysfs;

static int slow_testbed_factor = 1;
Expand Down

0 comments on commit 9ebb6ec

Please sign in to comment.