This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: `sentinel' gcc-3.x/OpenBSD compat. [Re: [patch 1/3] Make obconcat use stdarg]
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Cc: Jan Kratochvil <jan dot kratochvil at redhat dot com>, Mark Kettenis <mark dot kettenis at xs4all dot nl>
- Date: Sat, 1 May 2010 01:10:37 +0100
- Subject: Re: `sentinel' gcc-3.x/OpenBSD compat. [Re: [patch 1/3] Make obconcat use stdarg]
- References: <20100430181605.GA19190@host0.dyn.jankratochvil.net> <201004301908.o3UJ8mGf006742@glazunov.sibelius.xs4all.nl> <20100430221839.GA21100@host0.dyn.jankratochvil.net>
First off, to be clear, I like the idea of the patch. I was going
to mention the need for the cast as well, so, excuse me jumping in.
On Friday 30 April 2010 23:18:39, Jan Kratochvil wrote:
> FSF GCC 3.3.5 does not support this attribute:
> void f (int i, ...) __attribute__ ((__sentinel__));
> sentinel.c:1: warning: `__sentinel__' attribute directive ignored
> (+ there are no traces of any `sentinel' in the gcc-3.3.5 sources)
I sure have seen this with OpenBSD's 3.x.x compiler.
You must be aware of libiberty's `concat', but have you seen
src/include/ansidecl.h's ATTRIBUTE_SENTINEL?
I don't understand why we reinvent these macros for this, given
that one of the first things defs.h does is include ansidecl.h.
E.g, defs.h has both ATTR_FORMAT which looks like could be
replaced by ATTRIBUTE_PRINTF, and also has ATTR_NORETURN, which
looks like could be replaced by ATTRIBUTE_NORETURN. We already
use ATTRIBUTE_UNUSED in a lot of places.
> OTOH a requirement of some special sentinel expression instead of simple `NULL'
> for obconcat would nullify its stdarg convenience.
I don't understand what you mean here. Why not just do what we do
with `concat' to handle this (which is what the gcc manual says to
do), that is, just write `(char *) NULL' instead of NULL for
the sentinel, and be done with it.
--
Pedro Alves