public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* HELP WANTED: Fix -Wmissing-prototypes warnings
@ 2018-11-09 17:44 Borislav Petkov
  0 siblings, 0 replies; only message in thread
From: Borislav Petkov @ 2018-11-09 17:44 UTC (permalink / raw)
  To: kernel-janitors, driverdev-devel; +Cc: wang.yi59, Greg KH

Hi all,

gcc has a warning option

  -Wmissing-prototypes

which fires when a global function is missing a prototype declaration.
This warning is important as it catches cases when that global
function's prototype has been changed but its callers haven't been
updated. And they should be.

Currently, if enabled, this warning triggers ~1400 times for an
allmodconfig build and we would like to have 0 warnings and then add
that option to the main Makefile.

So helping out here would be lovely!

And it is very easy to do: you simply build the kernel with W=1:

	make -j<num_cpus+1> W=1 2>w.log

choose one -Wmissing-prototypes warning in the w.log build log and fix
it by including the header which has the function prototype. Or you
declare the function static. If that function prototype is missing, it
needs to be added, of course.

For every function, one should ask oneself, is it better to make the
function static and save ourselves the prototype and include file
dependency - that would be the preferred solution - or if not possible,
should one make the prototype visible by including the proper header so
that gcc sees the prototype.

This should be a good exercise for newbies who'd like to get involved
into kernel development.

Feel free to ask if there are any questions.

Thanks!

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-11-09 17:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-09 17:44 HELP WANTED: Fix -Wmissing-prototypes warnings Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox