This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: `sentinel' gcc-3.x/OpenBSD compat. [Re: [patch 1/3] Make obconcat use stdarg]


On Sat, 01 May 2010 08:06:47 +0200, Eli Zaretskii wrote:
> > Date: Sat, 1 May 2010 00:18:39 +0200
> > From: Jan Kratochvil <jan.kratochvil@redhat.com>
> > Cc: gdb-patches@sourceware.org
> > 
> > > I'm afraid you'll need an explicit cast for the NULLs used as the
> > > sentinel value, otherwise platforms that
> > > 
> > >   #define NULL 0L
> > > 
> > > will generate warnings like:
> > > 
> > >   sentinel.c: In function 'foo':
> > >   sentinel.c:8: warning: missing sentinel in function call
> > > 
> > > and with -Werror, that's not a good :(.
> > 
> > Which platforms?
> 
> DJGPP (a.k.a. GO32) is one.

#include <stddef.h>
void f (int i, ...) __attribute__ ((__sentinel__));
void 
f (int i, ...)
{
}
void
g (void)
{
  f (1, NULL);
}

On gcc442b.zip it works correctly.

no warning:
  f (1, NULL);
  f (1, (void *)0);
  f (1, ((void *)0));	/* output by gcc -E */
warning:
  f (1, 0);
  f (1, 0L);

Any other platform?


Thanks,
Jan


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