Compiling kernel with -Wformat-signedness gcc flag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello everyone,


I just compiled the kernel by passing "-Wformat-signedness" flag

https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html

-Wformat-signedness:
If -Wformat is specified, also warn if the format string requires an
unsigned argument and the argument is signed and vice versa.

Now, the C standard says:

"If a conversion specification is invalid, the behavior is undefined.
If any argument is
not the correct type for the corresponding conversion specification, the
behavior is *undefined*."

For eg:

drivers/iio/trigger/stm32-timer-trigger.c:228:24: warning: format ‘%d’
expects argument of type ‘int’, but argument 3 has type ‘unsigned int’
[-Wformat=]
  return sprintf(buf, "%d\n", (unsigned int)freq);
                         ~^     ~~~~~~~~~~~~~~~~~~
			                        %d

What is the rationale for not including/using this flag in the
HOSTCFLAGS in the Makefile ?

-- 
Thanks
Himanshu Jha

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux