Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: jan.kratochvil@redhat.com
Cc: gdb-patches@sourceware.org
Subject: Re: `sentinel' gcc-3.x/OpenBSD compat.  [Re: [patch 1/3] Make obconcat use stdarg]
Date: Sat, 01 May 2010 08:53:00 -0000	[thread overview]
Message-ID: <201005010853.o418rWqT009041@glazunov.sibelius.xs4all.nl> (raw)
In-Reply-To: <20100430221839.GA21100@host0.dyn.jankratochvil.net> (message	from Jan Kratochvil on Sat, 1 May 2010 00:18:39 +0200)

> Date: Sat, 1 May 2010 00:18:39 +0200
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
> 
> On Fri, 30 Apr 2010 21:08:48 +0200, Mark Kettenis wrote:
> > > From: Jan Kratochvil <jan.kratochvil@redhat.com>
> > > 
> > > __attribute__ ((sentinel)) availability for gcc >= 4.0 I have copied from
> > > <glib-2.0/glib/gmacros.h>.  It roughly matches the GCC ChangeLog dates.
> > 
> > The OpenBSD system compile, which is based on GCC 3.3.5, already has
> > the sentinel attribute.
> 
> 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)
> 
> OpenBSD-4.6-amd64 from md5sum
> 	28edaa65b16bd5381ebf645d27039a94  openbsd-install46.iso
> does not boot for me on Fedora 12 x86_64 KVM using
> 	kernel-2.6.32.11-99.fc12.x86_64
> 	qemu-system-x86-0.11.0-13.fc12.x86_64
> as it hangs on "setting tty flags"; I have not found any OpenBSD Live image.

OpenBSD runs on real hardware so we blame this one on KVM ;)

> Moreover I do not consider relevant to support this attribute on so obsolete
> compiler.  Not using the attribute has no effect on users building GDB.
> This attribute is useful only for the GDB developers.

Fair enough; this feature is nice to have but in no way essential.

> > 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?  Could you provide a login there?  As NULL is commonly
> defined using (such as in <dbus-1.0/dbus/dbus-macros.h>):
> 
> #ifndef NULL
> #  ifdef __cplusplus
> #    define NULL        (0L)
> #  else /* !__cplusplus */
> #    define NULL        ((void*) 0)
> #  endif /* !__cplusplus */
> #endif
> 
> forcing NULL to be ((void *) 0) may make GDB C++ compatibility problematic
> (I do not understand reasons for the conditional above, though).

Beats me why the dbus developers think they have to provide their own
definition of NULL when one is readily available by including <stddef.h>, even on freestanding environments.

I don't see why using (char *)NULL as sentinel would cause problems in
C++.  Anyway, GDB is written in ISO C90, not C++.

> OTOH a requirement of some special sentinel expression instead of
> simple `NULL' for obconcat would nullify its stdarg convenience.

Dunno, I don't think using (char *)NULL is much more complicated.  And
ultimately, given the way a null pointer constant is defined in ISO
C99, the cast is simply required for varargs functions.

> Therefore something could be placed to configure.ac for NULL
> redefinition depending on the test on the specific build system.

I think that would be a bad idea.


  parent reply	other threads:[~2010-05-01  8:53 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-30 18:16 [patch 1/3] Make obconcat use stdarg Jan Kratochvil
2010-04-30 18:38 ` Tom Tromey
2010-04-30 19:07   ` Jan Kratochvil
2010-04-30 19:09 ` Mark Kettenis
2010-04-30 22:18   ` `sentinel' gcc-3.x/OpenBSD compat. [Re: [patch 1/3] Make obconcat use stdarg] Jan Kratochvil
2010-05-01  0:10     ` Pedro Alves
2010-05-02 12:04       ` [patch] ATTR_* -> ATTRIBUTE_* unification [Re: `sentinel' gcc-3.x/OpenBSD compat.] Jan Kratochvil
2010-05-02 15:33         ` Pedro Alves
2010-05-02 21:37           ` Jan Kratochvil
2010-05-02 23:20             ` [patch] ATTR_NORETURN -> ATTRIBUTE_NORETURN unification [Re: [patch] ATTR_* -> ATTRIBUTE_* unification] Jan Kratochvil
2010-05-02 23:42               ` Pedro Alves
2010-05-02 23:53                 ` Jan Kratochvil
2010-05-03  7:18                   ` Pierre Muller
2010-05-03  7:44                     ` Jan Kratochvil
2010-05-04  6:34                       ` Pierre Muller
2010-05-04 15:28                         ` Joel Brobecker
     [not found]                   ` <6652.26431233368$1272871093@news.gmane.org>
2010-05-03 18:15                     ` Tom Tromey
2010-05-01  6:07     ` `sentinel' gcc-3.x/OpenBSD compat. [Re: [patch 1/3] Make obconcat use stdarg] Eli Zaretskii
2010-05-02  6:49       ` Jan Kratochvil
2010-05-01  8:53     ` Mark Kettenis [this message]
2010-05-07 16:58       ` Jan Kratochvil
2010-05-07 22:34         ` Tom Tromey
2010-05-08  4:59           ` Jan Kratochvil
2010-05-02  7:52   ` [patch 1/3] Make obconcat use stdarg Jan Kratochvil
2010-05-03 18:25     ` Tom Tromey
2010-05-03 20:19     ` Mark Kettenis
2010-05-03 21:00       ` Pedro Alves
2010-05-04 21:03         ` Mark Kettenis
2010-05-07 14:31           ` Jan Kratochvil
2010-05-07 14:36             ` Pedro Alves
2010-05-07 14:44               ` Jan Kratochvil
2010-05-07 14:44             ` Mark Kettenis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201005010853.o418rWqT009041@glazunov.sibelius.xs4all.nl \
    --to=mark.kettenis@xs4all.nl \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox