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 08:44:26PM -0400, Kaveh R. Ghazi wrote:
> Portable to where exactly?  I think it's worth asking, can you name
> one single platform where NULL is not suitably defined to pass in lieu
> of a pointer through a variadic function call?
Older legacy platforms. For instance, former OpenBSD releases. We got
hit by the issue when we started ported some software to 64 bits platforms.

In fact, this happened only two years ago.

Looking at FreeBSD, they changed NULL to 0L in december 2003... 
There, you probably have lots of FreeBSD installations in the wild where
NULL is not necessarily suitable for a variadic function.

Looking at Solaris 5.9, things are worrysome as well.

Here's their definition of NULL:

#if defined(_LP64) && !defined(__cplusplus)
#define NULL    0L
#else
#define NULL    0
#endif

It will not work on 64 bits platforms for variadic functions used from
C++...

So, a vast majority of systems I have access to either have issues/used
to have issues in the recent past.

> I think it's also relevant but not pivotal whether is GCC supported on
> that platform.

GCC is supported on the platforms I cited.  Pedantically, all those
platforms are correct. The C standard does not require that NULL be
a suitable size for argument passing.

The fact that gcc pampers over it and provides a correct definition is
not 100% relevant.  We're talking about a warning for non-portable code !

> Unless you can name one, I think #4 is busy-work with no realizable
> benefit.  (Note you'll have to change all users of libiberty like GDB
> and BFD, not just GCC.  I.e. anywhere we have a call site for concat
> et al.)

It's not a big problem. I have all the patches for gcc, and I can grab
gdb and bfd and do them as well.


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