From: SourceForge.net <no...@so...> - 2005-06-10 21:53:42
|
Feature Requests item #1215725, was opened at 2005-06-06 08:46 Message generated for change (Settings changed) made by sdeasey You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1215725&group_id=130646 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: C-API Group: None Status: Open >Resolution: Accepted Priority: 5 Submitted By: Stephen Deasey (sdeasey) Assigned to: Stephen Deasey (sdeasey) Summary: Stronger compile time error checking Initial Comment: GCC supports attributes with which you can do things like: int Ns_Foo(char *server) __attribute__((__nonnull__(1))); This says that arg 1 (the only arg) of Ns_Foo can never be a NULL pointer. This is checked at compile time, and a warning is issued if a NULL is found. The attached patch contains a new header file nscheck.h which would allow you to specify the above as: int Ns_Foo(char *server) NS_GNUC_NONNULL(1); This is only defined if the correct version of GCC is being used. There are wrappers for many of the useful attributes. The patch also contains the macro NS_RCSID() which is a simple wrapper around the boiler plate: static const char *RCSID = "..." found at the top of each file. It prevents the string from being optimised out of the binary and suppresses the annoying warning message that the variable is unused. I'll touch every *.c file to update to this new macro. ---------------------------------------------------------------------- Comment By: Zoran Vasiljevic (vasiljevic) Date: 2005-06-08 08:33 Message: Logged In: YES user_id=95086 Seems fine. Go ahead ;-) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=719009&aid=1215725&group_id=130646 |