[RFC PATCH 0/1] compiler_types.h: introduce ASSUME_NONNULL macro for static analysis
Siddh Raman Pant
sanganaka at siddh.me
Fri Jul 25 09:28:53 EDT 2025
---- Fri, 25 Jul 2025 18:12:14 +0530 को rakagunarto at gmail.com ने लिखा ----
> - Clarity to readers that the pointer is guaranteed to be non-null,
Assumption isn't a guarantee.
> and that a check is redundant (because performance critical context,
> etc.)
Compiler optimises it away usually.
> - Future patches that decide to use this macro can be a signal to
> reviewers to actually check correctness that a pointer is indeed
> invariably non-null
That can pretty easily change in future.
> - Make static analysis more useful by documenting when a certain false
> positive is actually false
Is your case really a false positive?
There is an explicit check for NULL in some other using the
get_node function, most visibly in the macro below.
If we know NULL won't be there, we should add an
assert in code instead of a silent assumption.
Thanks,
Siddh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20250725/b1113e16/attachment-0001.html>
More information about the Kernelnewbies
mailing list