From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robert Love Date: Tue, 21 Oct 2003 21:05:37 +0000 Subject: Re: [patch] udev: another canidate for static Message-Id: List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org 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