This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Preliminary mainline patch for __attribute__ ((sentinel))


On Tue, Sep 14, 2004 at 09:01:18AM -0400, Kaveh R. Ghazi wrote:
> 
> That's strange, the stub patch against 3.3 you posted here:
> http://gcc.gnu.org/ml/gcc/2004-08/msg01105.html
> seems to only allow pointer zero...
So it does.

I forgot about USER_H.
Thanks to Joseph for reminding me...

> 4. Leave the warning as is, and fix all calls to concat in gcc
>    (other source code using sentinels will still have the problem.)

This is my preferred approach, and I will explain why.

ISO C doesn't guarantee that NULL be a pointer. It can be any kind of
integral zero instead (we know that C++ is different).

Allowing people to keep their NULL being 0 (or 0L, actually, for OpenBSD)
allows us to be very picky about portable code: our sentinel does
insist that you explicitly write a null pointer for code termination, and
it isn't satisfied by our definition of NULL. Mind you, our NULL is
specifically 0L to make sure the code still works: 0L is exactly the size
of a pointer on all architectures that OpenBSD does support.

So, we get working code, until we fix the warning, and then we get portable
code.

Sorry for being very slow in catching up on this. I'm just coming back from
the OpenBSD release, and I am remembering stuff I discussed internally to
OpenBSD six months ago or more.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]