]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: disable -Wnonnull-compare
authorFrantisek Sumsal <frantisek@sumsal.cz>
Tue, 16 Jan 2024 21:25:04 +0000 (22:25 +0100)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Wed, 17 Jan 2024 11:45:39 +0000 (12:45 +0100)
This gets enabled by default in gcc-14 and complains everywhere where we
use assert() on an expression that is always true (i.e. using
`int x[static 2]` in function declaration, etc.):

[153/2414] Compiling C object src/basic/libbasic.a.p/fs-util.c.o
In file included from ../src/basic/macro.h:13,
                 from ../src/basic/alloc-util.h:10,
                 from ../src/basic/fs-util.c:11:
../src/basic/fd-util.h: In function ‘format_proc_fd_path’:
../src/fundamental/macro-fundamental.h:74:41: warning: ‘nonnull’ argument ‘buf’ compared to NULL [-Wnonnull-compare]
   74 | #define _unlikely_(x) (__builtin_expect(!!(x), 0))
      |                                         ^~~~~
../src/basic/macro.h:150:21: note: in expansion of macro ‘_unlikely_’
  150 |                 if (_unlikely_(!(expr)))                                \
      |                     ^~~~~~~~~~
../src/basic/macro.h:167:22: note: in expansion of macro ‘assert_message_se’
  167 | #define assert(expr) assert_message_se(expr, #expr)
      |                      ^~~~~~~~~~~~~~~~~
../src/basic/fd-util.h:129:9: note: in expansion of macro ‘assert’
  129 |         assert(buf);
      |         ^~~~~~

Disabling this selectively only for asserts is a bit painful, since the
option is not available in all compilers, and it'd need to be handled in
the EFI stuff as well.

meson.build

index 53a3d966ff4b30eb98fe53b25d6424a6a5aa786a..02a0e9b8f82d7b9e0eda69323b239da97e0cdd6b 100644 (file)
@@ -341,6 +341,7 @@ endif
 basic_disabled_warnings = [
         '-Wno-missing-field-initializers',
         '-Wno-unused-parameter',
+        '-Wno-nonnull-compare',
 ]
 
 possible_common_cc_flags = [