[PATCH] Fixes sentinel warnings on GCC4
Neil Williams
linux at codehelp.co.uk
Mon Dec 5 16:28:19 EST 2005
On Sunday 04 December 2005 1:45 pm, Sjoerd Langkemper wrote:
> This patch fixes warnings like these:
> warning: missing sentinel in function call
What system are you using to build? Gcc4 has been in use by various developers
for some time without any of these warnings - they would have been noticed as
they would have halted the build. Is this 64-bit only?
> Look at this page to find at what this warning is about:
> http://www.linuxonly.nl/docs/sentinel/
I have, but the patch still doesn't make sense to me.
> This patch basically replaces NULL with (char *)NULL
I may be wrong, but that looks like a cast for no good reason and that has
caused problems before.
> src/backend/file/gnc-backend-file.c
- be->lockfile = g_strconcat(be->fullpath, ".LCK", NULL);
+ be->lockfile = g_strconcat(be->fullpath, ".LCK", (char *)NULL);
Sorry, to me, that looks plain wrong. The glib API for g_strconcat clearly
states NULL not (char*)NULL:
http://developer.gnome.org/doc/API/2.0/glib/glib-String-Utility-Functions.html#g-strconcat
"The variable argument list must end with NULL. If you forget the NULL,
g_strconcat() will start appending random memory junk to your string.
string1 : The first string to add, which must not be NULL.
... : a NULL-terminated list of strings to append to the string"
Absolutely no mention of (char*)NULL.
If glib required (char*)NULL, the API would mention it and provide a suitable
#define for the cast.
I fear this patch could break a lot more than it purports to fix.
--
Neil Williams
=============
http://www.data-freedom.org/
http://www.nosoftwarepatents.com/
http://www.linux.codehelp.co.uk/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20051205/c2990c32/attachment.bin
More information about the gnucash-devel
mailing list