Commit 3319169
selftests/bpf: Fix "expression result unused" warnings with icecc
icecc is a compiler wrapper that distributes compile jobs over a build
farm [1]. It works by sending toolchain binaries and preprocessed
source code to remote machines.
Unfortunately using it with BPF selftests causes build failures due to
a clang bug [2]. The problem is that clang suppresses the
-Wunused-value warning if the unused expression comes from a macro
expansion. Since icecc compiles preprocessed source code, this
information is not available. This leads to -Wunused-value false
positives.
arena_spin_lock_slowpath() uses two macros that produce values and
ignores the results. Add (void) cast to explicitly indicate that this
is intentional and suppress the warning.
An alternative solution is to change the macros to not produce values.
This would work today, but in the future there may appear users who
need them. Another potential solution is to replace these macros with
functions. Unfortunately this would not work, because these macros
work with unknown types and control flow.
[1] https://github.com/icecc/icecream
[2] llvm/llvm-project#142614
Signed-off-by: Ilya Leoshkevich <[email protected]>1 parent 14aadb9 commit 3319169
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
302 | 302 | | |
303 | 303 | | |
304 | 304 | | |
305 | | - | |
| 305 | + | |
306 | 306 | | |
307 | 307 | | |
308 | 308 | | |
| |||
380 | 380 | | |
381 | 381 | | |
382 | 382 | | |
383 | | - | |
| 383 | + | |
384 | 384 | | |
385 | 385 | | |
386 | 386 | | |
| |||
0 commit comments