[PATCH] Fixes sentinel warnings on GCC4

Chris Shoemaker c.shoemaker at cox.net
Tue Dec 6 00:55:58 EST 2005


On Mon, Dec 05, 2005 at 10:37:49PM -0500, David Hampton wrote:
> On Mon, 2005-12-05 at 22:19 -0500, Chris Shoemaker wrote:
> 
> > Fair enough.  I'll grab the original patch, remove redundant portions
> > and apply it.  I'm convinced it's correct.  I figure it's easier to
> > follow the standard than to figure out what weird systems people
> > compile GnuCash on.  ( I don't even want to hazard a guess. ) 
> 
> I'm not concerned about whether the patch is correct (based on his last
> patch it probably is) but whether its necessary.  

In the gcc ML thread where the -Wstrict-null-sentinel warning was
added, it was claimed that at least some versions of HPUX and Solaris
2.8 on 64-bit machines #define NULL 0.

> Also, there's no
> automated way to maintain the insistence that sentinels are explicitly
> written as "(void *)NULL" [which is probably a safer cast than "(char
> *)NULL"].   

Well, that's exactly why this warning was recently added to gcc, and
why the glib and gtk+ sources were tagged with attribute((sentinel)).
(Although that also has the benefit of catching no sentinel at all
which is more important than sentinal-of-wrong-size.) As to why it's
currently enabled only for g++, I have no idea.  I've asked on the gcc
ML.

> Sjoerd seems to have the only system that reports an uncast
> NULL as an error.

Maybe he compiled with g++?  Is that even possible?  I wonder...

-chris

> 
> David
> 
> 


More information about the gnucash-devel mailing list