Wednesday, July 11, 2012

Printing SPARSE errors during Linux Kernel Compilation

"Sparse, the semantic parser, provides a compiler frontend capable of parsing most of ANSI C as well as many GCC extensions, and a collection of sample compiler backends, including a static analyzer also called "sparse". Sparse provides a set of annotations designed to convey semantic information about types, such as what address space pointers point to, or what locks a function acquires or releases."

There is more about SPARSE here.

To check files that will be compiled with SPARSE:

$ make C=1

To check all files with SPARSE, even the ones that will not be compiled:

$ make C=2

Compiler warning messages for Linux Kernel

To enable compiler warning messages to be printed during compilation, add W=1 on the make command line like:


$ make W=1 drivers/media/dvb/frontends/stv090x.o


See this for description of warning level options.