On 2012-09-05 19:59, Eir Nym wrote:
I've got following warnings [no errors had been generated while
-Werror is in command line] and want to know if they are ok.

Most of these warnings are harmless, and just point out that the
compiler will optimize unused code away, such as tests that always
succeed or fail.  In some cases it would be nice to fix them, but there
is usually no urgent need.


/usr/head/src/sys/kern/kern_cpuset.c:654:16: warning: comparison of
unsigned expression < 0 is always false [-Wtautological-compare]
         for (i = 0; i < (_NCPUWORDS - 1); i++) {
                     ~ ^ ~~~~~~~~~~~~~~~~

For example, this warning is harmless.  It turns out _NCPUWORDS is 1, at
least by default, on i386 and amd64.  So the warning is correct, in the
sense that the body of the for loop will never be executed.  It will
almost certainly be optimized away.

Maybe the loop could be enclosed in a #if _NCPUWORDS > 1 clause, to
prevent this warning.

Also note, this warning only appeared after r239923, when the for loop
was reversed.


/usr/head/src/sys/kern/kern_poll.c:173:10: warning: comparison of
unsigned expression < 0 is always false [-Wtautological-compare]
         if (val < 0 || val > 99)
             ~~~ ^ ~

This one might be fixed, since 'val' is declared as uint32_t.


/usr/head/src/sys/kern/kern_umtx.c:3312:19: warning: comparison of
unsigned expression < 0 is always false [-Wtautological-compare]
                 if (ts32.tv_sec < 0 ||
                     ~~~~~~~~~~~ ^ ~

It looks like this part of kern_umtx.c (used for COMPAT_FREEBSD32)
declares its own version of struct timespec32, where the tv_sec member
is uint32_t.  Therefore, this particular test is superfluous.
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Reply via email to