linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [patch] udev: another canidate for static
@ 2003-10-21 20:49 Greg KH
  2003-10-21 21:05 ` Robert Love
  2003-10-21 23:17 ` Greg KH
  0 siblings, 2 replies; 3+ messages in thread
From: Greg KH @ 2003-10-21 20:49 UTC (permalink / raw)
  To: linux-hotplug

On Tue, Oct 21, 2003 at 03:10:31PM -0400, Robert Love wrote:
> Another one of those "trivial patches so everything must be good"
> 
> sleep_for_dev() isn't exported or defined in a header, so it can be
> marked 'static'

> 
> Yes, I use gcc to detect these things :)

Heh, nice.  Too bad you missed the bug in that function :)

I forgot to actually increase the loop variable so that we time out
eventually.  Right now we just sit and spin forever.  Not nice at all...

> Patch is against udev-004.

Thanks, I've applied this.

What is the argument to gcc to catch stuff like this?

thanks,

greg k-h


-------------------------------------------------------
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] udev: another canidate for static
  2003-10-21 20:49 [patch] udev: another canidate for static Greg KH
@ 2003-10-21 21:05 ` Robert Love
  2003-10-21 23:17 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Robert Love @ 2003-10-21 21:05 UTC (permalink / raw)
  To: linux-hotplug

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] udev: another canidate for static
  2003-10-21 20:49 [patch] udev: another canidate for static Greg KH
  2003-10-21 21:05 ` Robert Love
@ 2003-10-21 23:17 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2003-10-21 23:17 UTC (permalink / raw)
  To: linux-hotplug

On Tue, Oct 21, 2003 at 05:05:37PM -0400, Robert Love wrote:
> 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

Ah, thanks for the tips.

Hm, libsysfs chokes on -Wredundant-decls, so I think I'll leave that one
off for now.  But the others look good.

thanks,

greg k-h


-------------------------------------------------------
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-10-21 23:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-21 20:49 [patch] udev: another canidate for static Greg KH
2003-10-21 21:05 ` Robert Love
2003-10-21 23:17 ` Greg KH

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).