Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: gdb-patches@sourceware.org, Mark Kettenis <mark.kettenis@xs4all.nl>
Subject: Re: [patch] ATTR_* -> ATTRIBUTE_* unification  [Re: `sentinel' gcc-3.x/OpenBSD compat.]
Date: Sun, 02 May 2010 15:33:00 -0000	[thread overview]
Message-ID: <201005021633.14850.pedro@codesourcery.com> (raw)
In-Reply-To: <20100502120419.GA19249@host0.dyn.jankratochvil.net>

On Sunday 02 May 2010 13:04:19, Jan Kratochvil wrote:

> Attached, OK to check-in?  It is just mechanical except of one new such
> attribute for find_complaint.  Compiled on x86_64-fedora12-linux-gnu.

Thanks!

> As the new definiton assumes ATTRIBUTE_NONNULL I have checked that none of the
> ATTR_FORMAT uses has NULL as a meaningful format string.  Some empty functions
> have been also 'upgraded' to ATTRIBUTE_NONNULL-using ATTRIBUTE_PRINTF.

The GDB part looks fine to me.  Want to commit it separatelly to the
GDBserver bit?

> gdbserver/
> 2010-05-02  Jan Kratochvil  <jan.kratochvil@redhat.com>
> 
> 	* server.h (ATTRIBUTE_NONNULL, ATTRIBUTE_PRINTF): New.
> 	(ATTR_FORMAT): Remove.
> 	(buffer_xml_printf, error, fatal, internal_error, warning): Change
> 	ATTR_FORMAT to ATTRIBUTE_PRINTF.
> 	* tracepoint.c (trace_debug_1): Change ATTR_FORMAT to ATTRIBUTE_PRINTF.

> --- a/gdb/gdbserver/server.h
> +++ b/gdb/gdbserver/server.h
> @@ -62,13 +62,22 @@ extern void *memmem (const void *, size_t , const void *, size_t);
>  #endif
>  #endif
>  
> -#ifndef ATTR_FORMAT
> -#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 4))
> -#define ATTR_FORMAT(type, x, y) __attribute__ ((format(type, x, y)))
> -#else
> -#define ATTR_FORMAT(type, x, y) /* nothing */
> -#endif
> -#endif
> +/* Attribute `nonnull' was valid as of gcc 3.3.  */
> +#ifndef ATTRIBUTE_NONNULL
> +# if (GCC_VERSION >= 3003)
> +#  define ATTRIBUTE_NONNULL(m) __attribute__ ((__nonnull__ (m)))
> +# else
> +#  define ATTRIBUTE_NONNULL(m)
> +# endif /* GNUC >= 3.3 */
> +#endif /* ATTRIBUTE_NONNULL */
> +
> +/* Use ATTRIBUTE_PRINTF when the format specifier must not be NULL.
> +   This was the case for the `printf' format attribute by itself
> +   before GCC 3.3, but as of 3.3 we need to add the `nonnull'
> +   attribute to retain this behavior.  */
> +#ifndef ATTRIBUTE_PRINTF
> +#define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) ATTRIBUTE_NONNULL(m)
> +#endif /* ATTRIBUTE_PRINTF */
>  

I think this misses defining __attribute__ to empty on non-gcc.  It's
this bit in ansidecl.h that handles it:

#if (GCC_VERSION < 2007)
# define __attribute__(x)
#endif

I also see that nowhere is GCC_VERSION defined in server.h.  My fault, I missed
it when importing gdb_assert to gdbserver.  :-/  We're currently always picking
the else branch in:

if (GCC_VERSION >= 2004)
#define ASSERT_FUNCTION		__PRETTY_FUNCTION__
#else
#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
#define ASSERT_FUNCTION		__func__
#endif
#endif

Your patch adds more uses.  If you don't feel like fixing this,
I'll fix it after your patch is in.

-- 
Pedro Alves


  reply	other threads:[~2010-05-02 15:33 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 [this message]
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
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=201005021633.14850.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=mark.kettenis@xs4all.nl \
    /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