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]


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


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