From: Robert Love <rml@tech9.net>
To: linux-hotplug@vger.kernel.org
Subject: Re: [patch] udev: another canidate for static
Date: Tue, 21 Oct 2003 21:05:37 +0000 [thread overview]
Message-ID: <marc-linux-hotplug-106678688904437@msgid-missing> (raw)
In-Reply-To: <marc-linux-hotplug-106680720217836@msgid-missing>
On Tue, 2003-10-21 at 16:49, Greg KH wrote:
> Thanks, I've applied this.
Thanks.
> What is the argument to gcc to catch stuff like this?
I use:
-Wmissing-prototypes -Wmissing-declarations -Wredundant-decls
along with -Wall and -W.
"-Wmissing-prototypes" will warn if a non-static (e.g. global) function
does not have a prototype declared in a header file before its use. If
the function does not have a prototype declared elsewhere, then
apparently nothing is using it and it should not be exported OR you are
forgetting to include the headers with your declarations in the file
with your definition.
"-Wmissing-declarations"
Not too sure how this differs from the above, but I use both.
"-Wredundant-decls" warns if something is declared more than once.
Really just being anal about externs or header files duplicating
themselves...
And "-W" will warn if a static object is not referenced.
So between all of the above, we get:
- Warn about globals without declarations
- Warn about locals that are unused
For the former, we either add the declaration to a header (if we intend
it to be global) or we can make it static.
For the latter, we can delete the thing.
I find them really useful in big messy projects, like procps ;)
Robert Love
-------------------------------------------------------
This SF.net email is sponsored by OSDN developer relations
Here's your chance to show off your extensive product knowledge
We want to know what you know. Tell us and you have a chance to win $100
http://www.zoomerang.com/survey.zgi?HRPT1X3RYQNC5V4MLNSV3E54
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
next prev parent reply other threads:[~2003-10-21 21:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-21 20:49 [patch] udev: another canidate for static Greg KH
2003-10-21 21:05 ` Robert Love [this message]
2003-10-21 23:17 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=marc-linux-hotplug-106678688904437@msgid-missing \
--to=rml@tech9.net \
--cc=linux-hotplug@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).