Warnings when compiling kernel

Erich Dollansky freebsd.ed.lists at sumeritec.com
Fri Feb 5 00:44:02 UTC 2021


Hi,

On Wed, 3 Feb 2021 22:34:28 +0000
Frank Leonhardt <frank2 at fjl.co.uk> wrote:

> On 31/01/2021 21:22, Roderick wrote:
> >
> > Are they normal?
> >
> > """""""""""""""""""""""""""""""""""""
> > cc  -c -O2 -pipe -fno-strict-aliasing  -std=c99  -Wall 
> > -Wredundant-decls -Wnested-externs -Wstrict-prototypes 
> > -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wundef 
> > -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs 
> > -fdiagnostics-show-option -Wno-error-tautological-compare 
> > -Wno-error-empty-body -Wno-error-parentheses-equality 
> > -Wno-error-unused-function   -nostdinc -I. -I/usr/src/sys 
> > -I/usr/src/sys/contrib/altq -I/usr/src/sys/contrib/libfdt -D_KERNEL 
> > -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -mno-aes
> > -mno-avx -mno-mmx -mno-sse -msoft-float -ffreestanding
> > -fstack-protector -Werror  /usr/src/sys/kern/kern_cpuset.c
> > /usr/src/sys/kern/kern_cpuset.c:637:16: warning: comparison of
> > unsigned expression < 0 is always false [-Wtautological-compare]
> >         for (i = 0; i < (_NCPUWORDS - 1); i++) {
> >                     ~ ^ ~~~~~~~~~~~~~~~~
> > 1 warning generated.
> >  
> Compiler warnings are normal, but I'd rather they weren't there
> myself. I wish I knew which file generated the error (it's not from
> any of the kernels I have loaded), and which CPU was the target, as I
> can't be sure what happens next. However, _NCPUWORDS can quite easily
> be 1, which means the for() loop will never be executed on some CPUs.
> One would hope the optimiser would remove it completely if this was
> the case, and this may have been the intention.
> 
words like 'may have' are the reason for countless software errors.

Erich
> Regards, Frank.
> 
> 
> 
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to
> "freebsd-questions-unsubscribe at freebsd.org"



More information about the freebsd-questions mailing list