The is_non_negative() and is_negative() function-like macros initially exist as a workaround to silence the -Wtype-limits warning. Now that this warning is disabled, those two macros have lost their raison d'ĂȘtre. Or so we thought.
In reality, smatch still produces a similar warning and so, it is unfortunately still too early to undo this workaround. Update the comment to point to smatch instead of GCC's -Wtype-limits. Add a link to the thread in which this was discovered. Suggested-by: Miguel Ojeda <[email protected]> Link: https://lore.kernel.org/all/CANiq72=jrt+6+2pbgshsk-tpxpirk70h-+3d6syan-fdfc8...@mail.gmail.com/ Signed-off-by: Vincent Mailhol <[email protected]> --- include/linux/overflow.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/overflow.h b/include/linux/overflow.h index 736f633b2d5f..d84194fc783b 100644 --- a/include/linux/overflow.h +++ b/include/linux/overflow.h @@ -37,8 +37,8 @@ #define type_min(t) __type_min(typeof(t)) /* - * Avoids triggering -Wtype-limits compilation warning, - * while using unsigned data types to check a < 0. + * Avoids triggering "unsigned 'a' is never less than zero" smatch warning, + * Link: https://lore.kernel.org/all/[email protected] */ #define is_non_negative(a) ((a) > 0 || (a) == 0) #define is_negative(a) (!(is_non_negative(a))) -- 2.52.0
