/* Warn if two unsigned values are being compared in a size larger
than their original size, and one (and only one) is the result of
a `~' operator. This comparison will always fail.
Also warn if one operand is a constant, and the constant does not
have all bits set that are set in the ~ operand when it is
extended. */
note that integer promotion is done on the operand(!) of ~. So u1 == (u8_t)(~u2)
is equal to
(int)u1 == (int)(u8_t)(~(int)u2)
that we do not warn for the first case is because it is optimized to
u1 == ~u2 before.
/* Warn if two unsigned values are being compared in a size larger
than their original size, and one (and only one) is the result of
a `~' operator. This comparison will always fail.
Also warn if one operand is a constant, and the constant does not
have all bits set that are set in the ~ operand when it is
extended. */
note that integer promotion is done on the operand(!) of ~. So u1 == (u8_t)(~u2)
is equal to
(int)u1 == (int)(u8_ t)(~(int) u2)
that we do not warn for the first case is because it is optimized to
u1 == ~u2 before.
Why do you think the warning is incorrect?