udev: another canidate for static
Quoted 7 lines · Robert Love
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...
Quoted 1 line
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 1 line · Greg KH
Thanks, I've applied this.
Thanks.
Quoted 1 line
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 10 lines · Robert Love
Quoted 1 line · Greg KH
Thanks, I've applied this.
Thanks.
Quoted 1 line
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel