Skip to content

Conversation

@kernel-patches-daemon-bpf-rc
Copy link

Pull request for series with
subject: selftests/bpf: Fix "expression result unused" warnings with icecc
version: 2
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=996057

iii-i added 2 commits August 27, 2025 06:09
The verifier requires that pointers returned by bpf_obj_new_impl() are
either dropped or stored in a map. Therefore programs that do not use
its return values will fail to load. Make the compiler point out these
issues. Adjust selftests that check that the verifier does indeed spot
these bugs.

Link: https://lore.kernel.org/bpf/CAADnVQL6Q+QRv3_JwEd26biwGpFYcwD_=BjBJWLAtpgOP9CKRw@mail.gmail.com/
Suggested-by: Alexei Starovoitov <[email protected]>
Signed-off-by: Ilya Leoshkevich <[email protected]>
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]>
@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 2465bb8
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=996057
version: 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants