From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29808 invoked by alias); 2 May 2010 12:04:51 -0000 Received: (qmail 29744 invoked by uid 22791); 2 May 2010 12:04:46 -0000 X-SWARE-Spam-Status: No, hits=-4.7 required=5.0 tests=BAYES_20,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_BJ,TW_RG,TW_VW,TW_XS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 02 May 2010 12:04:32 +0000 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o42C4PGZ024931 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 2 May 2010 08:04:25 -0400 Received: from host0.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o42C4MRF012848 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 2 May 2010 08:04:24 -0400 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.4/8.14.4) with ESMTP id o42C4L8v019467; Sun, 2 May 2010 14:04:21 +0200 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.4/8.14.4/Submit) id o42C4K3F019457; Sun, 2 May 2010 14:04:20 +0200 Date: Sun, 02 May 2010 12:04:00 -0000 From: Jan Kratochvil To: Pedro Alves Cc: gdb-patches@sourceware.org, Mark Kettenis Subject: [patch] ATTR_* -> ATTRIBUTE_* unification [Re: `sentinel' gcc-3.x/OpenBSD compat.] Message-ID: <20100502120419.GA19249@host0.dyn.jankratochvil.net> References: <20100430181605.GA19190@host0.dyn.jankratochvil.net> <201004301908.o3UJ8mGf006742@glazunov.sibelius.xs4all.nl> <20100430221839.GA21100@host0.dyn.jankratochvil.net> <201005010110.37403.pedro@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201005010110.37403.pedro@codesourcery.com> User-Agent: Mutt/1.5.20 (2009-08-17) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-05/txt/msg00011.txt.bz2 > On Friday 30 April 2010 23:18:39, Jan Kratochvil wrote: > > FSF GCC 3.3.5 does not support this attribute: > > sentinel.c:1: warning: `__sentinel__' attribute directive ignored > On Fri, 30 Apr 2010 21:08:48 +0200, Mark Kettenis wrote: # The OpenBSD system compile, which is based on GCC 3.3.5, already has On Sat, 01 May 2010 02:10:37 +0200, Pedro Alves wrote: > I sure have seen this with OpenBSD's 3.x.x compiler. include/ansidecl.h: /* Attribute `sentinel' was valid as of gcc 3.5. */ Isn't it more true for OpenBSD's 3.5.x - and not 3.3.5 - one? > You must be aware of libiberty's `concat', but have you seen > src/include/ansidecl.h's ATTRIBUTE_SENTINEL? Neither of them. > E.g, defs.h has both ATTR_FORMAT which looks like could be > replaced by ATTRIBUTE_PRINTF, 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. 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. > and also has ATTR_NORETURN, which looks like could be replaced by > ATTRIBUTE_NORETURN. That would come next after a check-in. Thanks, Jan gdb/ 2010-05-02 Jan Kratochvil * ada-lang.c (lim_warning): Change ATTR_FORMAT to ATTRIBUTE_PRINTF. * amd64-tdep.c (amd64_insn_length_fprintf): Likewise. * cli-out.c (cli_field_fmt, cli_message, out_field_fmt): Likewise. * complaints.c (find_complaint): New ATTRIBUTE_PRINTF. (vcomplaint): Change ATTR_FORMAT to ATTRIBUTE_PRINTF. * complaints.h (complaint, internal_complaint): Likewise. * defs.h: Change ATTR_FORMAT to ATTRIBUTE_PRINTF in the top comment. (ATTR_FORMAT): Remove. (query, nquery, yquery, vprintf_filtered, vfprintf_filtered) (fprintf_filtered, fprintfi_filtered, printf_filtered, printfi_filtered) (vprintf_unfiltered, vfprintf_unfiltered, fprintf_unfiltered) (printf_unfiltered, xasprintf, xvasprintf, xstrprintf, xstrvprintf) (xsnprintf, verror, error, vfatal, fatal, internal_verror) (internal_error, internal_vwarning, internal_warning, warning) (vwarning): Change ATTR_FORMAT to ATTRIBUTE_PRINTF. * disasm.c (fprintf_disasm): Likewise. * exceptions.c (throw_it): Likewise. * exceptions.h (exception_fprintf, throw_verror, throw_vfatal) (throw_error): Likewise. * language.h (type_error, range_error): Likewise. * linespec.c (cplusplus_error): Likewise. * mi/mi-interp.c (mi_interp_query_hook): Likewise. * mi/mi-out.c (mi_field_fmt, mi_message): Likewise. * monitor.c (monitor_debug): Likewise. * parser-defs.h (parser_fprintf): Likewise. * serial.h (serial_printf): Likewise. * tui/tui-hooks.c (tui_query_hook): Likewise. * ui-out.c (default_field_fmt, default_message, uo_field_fmt) (uo_message): Likewise. * ui-out.h (ui_out_field_fmt, ui_out_message): Likewise. * utils.c (vfprintf_maybe_filtered, internal_vproblem, defaulted_query): Likewise. * xml-support.h (gdb_xml_debug, gdb_xml_error): Likewise. gdbserver/ 2010-05-02 Jan Kratochvil * 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/ada-lang.c +++ b/gdb/ada-lang.c @@ -501,7 +501,7 @@ cond_offset_target (CORE_ADDR address, long offset) /* FIXME: cagney/2004-10-10: This function is mimicking the behavior provided by "complaint". */ -static void lim_warning (const char *format, ...) ATTR_FORMAT (printf, 1, 2); +static void lim_warning (const char *format, ...) ATTRIBUTE_PRINTF (1, 2); static void lim_warning (const char *format, ...) --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -1026,7 +1026,7 @@ amd64_skip_prefixes (gdb_byte *insn) This function is a nop, we don't want to print anything, we just want to compute the length of the insn. */ -static int ATTR_FORMAT (printf, 2, 3) +static int ATTRIBUTE_PRINTF (2, 3) amd64_insn_length_fprintf (void *stream, const char *format, ...) { return 0; --- a/gdb/cli-out.c +++ b/gdb/cli-out.c @@ -51,12 +51,12 @@ static void cli_field_string (struct ui_out *uiout, int fldno, int width, static void cli_field_fmt (struct ui_out *uiout, int fldno, int width, enum ui_align align, const char *fldname, const char *format, - va_list args) ATTR_FORMAT (printf, 6, 0); + va_list args) ATTRIBUTE_PRINTF (6, 0); static void cli_spaces (struct ui_out *uiout, int numspaces); static void cli_text (struct ui_out *uiout, const char *string); static void cli_message (struct ui_out *uiout, int verbosity, const char *format, va_list args) - ATTR_FORMAT (printf, 3, 0); + ATTRIBUTE_PRINTF (3, 0); static void cli_wrap_hint (struct ui_out *uiout, char *identstring); static void cli_flush (struct ui_out *uiout); static int cli_redirect (struct ui_out *uiout, struct ui_file *outstream); @@ -95,7 +95,7 @@ static void field_separator (void); static void out_field_fmt (struct ui_out *uiout, int fldno, const char *fldname, - const char *format,...) ATTR_FORMAT (printf, 4, 5); + const char *format,...) ATTRIBUTE_PRINTF (4, 5); /* Mark beginning of a table */ --- a/gdb/complaints.c +++ b/gdb/complaints.c @@ -120,7 +120,7 @@ get_complaints (struct complaints **c) return (*c); } -static struct complain * +static struct complain * ATTRIBUTE_PRINTF (4, 0) find_complaint (struct complaints *complaints, const char *file, int line, const char *fmt) { @@ -164,7 +164,7 @@ static int stop_whining = 0; /* Print a complaint, and link the complaint block into a chain for later handling. */ -static void ATTR_FORMAT (printf, 4, 0) +static void ATTRIBUTE_PRINTF (4, 0) vcomplaint (struct complaints **c, const char *file, int line, const char *fmt, va_list args) { --- a/gdb/complaints.h +++ b/gdb/complaints.h @@ -31,10 +31,10 @@ extern struct complaints *symfile_complaints; /* Register a complaint. */ extern void complaint (struct complaints **complaints, const char *fmt, - ...) ATTR_FORMAT (printf, 2, 3); + ...) ATTRIBUTE_PRINTF (2, 3); extern void internal_complaint (struct complaints **complaints, const char *file, int line, const char *fmt, - ...) ATTR_FORMAT (printf, 4, 5); + ...) ATTRIBUTE_PRINTF (4, 5); /* Clear out / initialize all complaint counters that have ever been incremented. If LESS_VERBOSE is 1, be less verbose about --- a/gdb/defs.h +++ b/gdb/defs.h @@ -1,4 +1,5 @@ -/* *INDENT-OFF* */ /* ATTR_FORMAT confuses indent, avoid running it for now */ +/* *INDENT-OFF* */ /* ATTRIBUTE_PRINTF confuses indent, avoid running it + for now. */ /* Basic, host-specific, and target-specific definitions for GDB. Copyright (C) 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, @@ -296,14 +297,6 @@ struct cleanup #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 - /* Be conservative and use enum bitfields only with GCC. This is copied from gcc 3.3.1, system.h. */ @@ -404,9 +397,9 @@ extern void null_cleanup (void *); extern int myread (int, char *, int); -extern int query (const char *, ...) ATTR_FORMAT (printf, 1, 2); -extern int nquery (const char *, ...) ATTR_FORMAT (printf, 1, 2); -extern int yquery (const char *, ...) ATTR_FORMAT (printf, 1, 2); +extern int query (const char *, ...) ATTRIBUTE_PRINTF (1, 2); +extern int nquery (const char *, ...) ATTRIBUTE_PRINTF (1, 2); +extern int yquery (const char *, ...) ATTRIBUTE_PRINTF (1, 2); extern void init_page_info (void); @@ -492,25 +485,25 @@ extern void puts_filtered_tabular (char *string, int width, int right); extern void puts_debug (char *prefix, char *string, char *suffix); -extern void vprintf_filtered (const char *, va_list) ATTR_FORMAT (printf, 1, 0); +extern void vprintf_filtered (const char *, va_list) ATTRIBUTE_PRINTF (1, 0); -extern void vfprintf_filtered (struct ui_file *, const char *, va_list) ATTR_FORMAT (printf, 2, 0); +extern void vfprintf_filtered (struct ui_file *, const char *, va_list) ATTRIBUTE_PRINTF (2, 0); -extern void fprintf_filtered (struct ui_file *, const char *, ...) ATTR_FORMAT (printf, 2, 3); +extern void fprintf_filtered (struct ui_file *, const char *, ...) ATTRIBUTE_PRINTF (2, 3); -extern void fprintfi_filtered (int, struct ui_file *, const char *, ...) ATTR_FORMAT (printf, 3, 4); +extern void fprintfi_filtered (int, struct ui_file *, const char *, ...) ATTRIBUTE_PRINTF (3, 4); -extern void printf_filtered (const char *, ...) ATTR_FORMAT (printf, 1, 2); +extern void printf_filtered (const char *, ...) ATTRIBUTE_PRINTF (1, 2); -extern void printfi_filtered (int, const char *, ...) ATTR_FORMAT (printf, 2, 3); +extern void printfi_filtered (int, const char *, ...) ATTRIBUTE_PRINTF (2, 3); -extern void vprintf_unfiltered (const char *, va_list) ATTR_FORMAT (printf, 1, 0); +extern void vprintf_unfiltered (const char *, va_list) ATTRIBUTE_PRINTF (1, 0); -extern void vfprintf_unfiltered (struct ui_file *, const char *, va_list) ATTR_FORMAT (printf, 2, 0); +extern void vfprintf_unfiltered (struct ui_file *, const char *, va_list) ATTRIBUTE_PRINTF (2, 0); -extern void fprintf_unfiltered (struct ui_file *, const char *, ...) ATTR_FORMAT (printf, 2, 3); +extern void fprintf_unfiltered (struct ui_file *, const char *, ...) ATTRIBUTE_PRINTF (2, 3); -extern void printf_unfiltered (const char *, ...) ATTR_FORMAT (printf, 1, 2); +extern void printf_unfiltered (const char *, ...) ATTRIBUTE_PRINTF (1, 2); extern void print_spaces (int, struct ui_file *); @@ -900,19 +893,19 @@ extern void *xzalloc (size_t); /* Like asprintf/vasprintf but get an internal_error if the call fails. */ -extern void xasprintf (char **ret, const char *format, ...) ATTR_FORMAT (printf, 2, 3); +extern void xasprintf (char **ret, const char *format, ...) ATTRIBUTE_PRINTF (2, 3); extern void xvasprintf (char **ret, const char *format, va_list ap) - ATTR_FORMAT (printf, 2, 0); + ATTRIBUTE_PRINTF (2, 0); /* Like asprintf and vasprintf, but return the string, throw an error if no memory. */ -extern char *xstrprintf (const char *format, ...) ATTR_FORMAT (printf, 1, 2); +extern char *xstrprintf (const char *format, ...) ATTRIBUTE_PRINTF (1, 2); extern char *xstrvprintf (const char *format, va_list ap) - ATTR_FORMAT (printf, 1, 0); + ATTRIBUTE_PRINTF (1, 0); /* Like snprintf, but throw an error if the output buffer is too small. */ extern int xsnprintf (char *str, size_t size, const char *format, ...) - ATTR_FORMAT (printf, 3, 4); + ATTRIBUTE_PRINTF (3, 4); extern int parse_escape (struct gdbarch *, char **); @@ -929,36 +922,36 @@ extern char *quit_pre_print; extern char *warning_pre_print; extern NORETURN void verror (const char *fmt, va_list ap) - ATTR_NORETURN ATTR_FORMAT (printf, 1, 0); + ATTR_NORETURN ATTRIBUTE_PRINTF (1, 0); -extern NORETURN void error (const char *fmt, ...) ATTR_NORETURN ATTR_FORMAT (printf, 1, 2); +extern NORETURN void error (const char *fmt, ...) ATTR_NORETURN ATTRIBUTE_PRINTF (1, 2); extern NORETURN void error_stream (struct ui_file *) ATTR_NORETURN; extern NORETURN void vfatal (const char *fmt, va_list ap) - ATTR_NORETURN ATTR_FORMAT (printf, 1, 0); + ATTR_NORETURN ATTRIBUTE_PRINTF (1, 0); -extern NORETURN void fatal (const char *fmt, ...) ATTR_NORETURN ATTR_FORMAT (printf, 1, 2); +extern NORETURN void fatal (const char *fmt, ...) ATTR_NORETURN ATTRIBUTE_PRINTF (1, 2); extern NORETURN void internal_verror (const char *file, int line, const char *, va_list ap) - ATTR_NORETURN ATTR_FORMAT (printf, 3, 0); + ATTR_NORETURN ATTRIBUTE_PRINTF (3, 0); extern NORETURN void internal_error (const char *file, int line, - const char *, ...) ATTR_NORETURN ATTR_FORMAT (printf, 3, 4); + const char *, ...) ATTR_NORETURN ATTRIBUTE_PRINTF (3, 4); extern void internal_vwarning (const char *file, int line, const char *, va_list ap) - ATTR_FORMAT (printf, 3, 0); + ATTRIBUTE_PRINTF (3, 0); extern void internal_warning (const char *file, int line, - const char *, ...) ATTR_FORMAT (printf, 3, 4); + const char *, ...) ATTRIBUTE_PRINTF (3, 4); extern NORETURN void nomem (long) ATTR_NORETURN; -extern void warning (const char *, ...) ATTR_FORMAT (printf, 1, 2); +extern void warning (const char *, ...) ATTRIBUTE_PRINTF (1, 2); -extern void vwarning (const char *, va_list args) ATTR_FORMAT (printf, 1, 0); +extern void vwarning (const char *, va_list args) ATTRIBUTE_PRINTF (1, 0); /* List of known OS ABIs. If you change this, make sure to update the table in osabi.c. */ --- a/gdb/disasm.c +++ b/gdb/disasm.c @@ -335,7 +335,7 @@ do_assembly_only (struct gdbarch *gdbarch, struct ui_out *uiout, /* Initialize the disassemble info struct ready for the specified stream. */ -static int ATTR_FORMAT (printf, 2, 3) +static int ATTRIBUTE_PRINTF (2, 3) fprintf_disasm (void *stream, const char *format, ...) { va_list args; --- a/gdb/exceptions.c +++ b/gdb/exceptions.c @@ -374,7 +374,7 @@ print_any_exception (struct ui_file *file, const char *prefix, } } -NORETURN static void ATTR_NORETURN ATTR_FORMAT (printf, 3, 0) +NORETURN static void ATTR_NORETURN ATTRIBUTE_PRINTF (3, 0) throw_it (enum return_reason reason, enum errors error, const char *fmt, va_list ap) { --- a/gdb/exceptions.h +++ b/gdb/exceptions.h @@ -153,7 +153,7 @@ int exceptions_state_mc_action_iter_1 (void); extern void exception_print (struct ui_file *file, struct gdb_exception e); extern void exception_fprintf (struct ui_file *file, struct gdb_exception e, const char *prefix, - ...) ATTR_FORMAT (printf, 3, 4); + ...) ATTRIBUTE_PRINTF (3, 4); /* Throw an exception (as described by "struct gdb_exception"). Will execute a LONG JUMP to the inner most containing exception handler @@ -168,11 +168,11 @@ extern void exception_fprintf (struct ui_file *file, struct gdb_exception e, extern NORETURN void throw_exception (struct gdb_exception exception) ATTR_NORETURN; extern NORETURN void throw_verror (enum errors, const char *fmt, va_list ap) - ATTR_NORETURN ATTR_FORMAT (printf, 2, 0); + ATTR_NORETURN ATTRIBUTE_PRINTF (2, 0); extern NORETURN void throw_vfatal (const char *fmt, va_list ap) - ATTR_NORETURN ATTR_FORMAT (printf, 1, 0); + ATTR_NORETURN ATTRIBUTE_PRINTF (1, 0); extern NORETURN void throw_error (enum errors error, const char *fmt, - ...) ATTR_NORETURN ATTR_FORMAT (printf, 2, 3); + ...) ATTR_NORETURN ATTRIBUTE_PRINTF (2, 3); /* Instead of deprecated_throw_reason, code should use catch_exception and throw_exception. */ --- 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 */ #ifndef ATTR_MALLOC #if defined(__GNUC__) && (__GNUC__ >= 3) @@ -444,7 +453,7 @@ char* buffer_finish (struct buffer *buffer); /* Simple printf to BUFFER function. Current implemented formatters: %s - grow an xml escaped text in OBSTACK. */ void buffer_xml_printf (struct buffer *buffer, const char *format, ...) - ATTR_FORMAT (printf, 2, 3); + ATTRIBUTE_PRINTF (2, 3); #define buffer_grow_str(BUFFER,STRING) \ buffer_grow (BUFFER, STRING, strlen (STRING)) @@ -459,11 +468,11 @@ void *xcalloc (size_t, size_t) ATTR_MALLOC; char *xstrdup (const char *) ATTR_MALLOC; void freeargv (char **argv); void perror_with_name (const char *string); -void error (const char *string,...) ATTR_NORETURN ATTR_FORMAT (printf, 1, 2); -void fatal (const char *string,...) ATTR_NORETURN ATTR_FORMAT (printf, 1, 2); +void error (const char *string,...) ATTR_NORETURN ATTRIBUTE_PRINTF (1, 2); +void fatal (const char *string,...) ATTR_NORETURN ATTRIBUTE_PRINTF (1, 2); void internal_error (const char *file, int line, const char *, ...) - ATTR_NORETURN ATTR_FORMAT (printf, 3, 4); -void warning (const char *string,...) ATTR_FORMAT (printf, 1, 2); + ATTR_NORETURN ATTRIBUTE_PRINTF (3, 4); +void warning (const char *string,...) ATTRIBUTE_PRINTF (1, 2); char *paddress (CORE_ADDR addr); char *pulongest (ULONGEST u); char *plongest (LONGEST l); --- a/gdb/gdbserver/tracepoint.c +++ b/gdb/gdbserver/tracepoint.c @@ -22,7 +22,7 @@ #include #include -static void trace_debug_1 (const char *, ...) ATTR_FORMAT (printf, 1, 2); +static void trace_debug_1 (const char *, ...) ATTRIBUTE_PRINTF (1, 2); static void trace_debug_1 (const char *fmt, ...) --- a/gdb/language.h +++ b/gdb/language.h @@ -461,9 +461,9 @@ extern void binop_type_check (struct value *, struct value *, int); /* Error messages */ -extern void type_error (const char *, ...) ATTR_FORMAT (printf, 1, 2); +extern void type_error (const char *, ...) ATTRIBUTE_PRINTF (1, 2); -extern void range_error (const char *, ...) ATTR_FORMAT (printf, 1, 2); +extern void range_error (const char *, ...) ATTRIBUTE_PRINTF (1, 2); /* Data: Does this value represent "truth" to the current language? */ --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -80,7 +80,7 @@ static struct symtabs_and_lines find_method (int funfirstline, static NORETURN void cplusplus_error (const char *name, const char *fmt, ...) - ATTR_NORETURN ATTR_FORMAT (printf, 2, 3); + ATTR_NORETURN ATTRIBUTE_PRINTF (2, 3); static int total_number_of_methods (struct type *type); --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -44,7 +44,7 @@ static void mi_command_loop (int mi_version); so we can report interesting things that happened "behind the mi's back" in this command */ static int mi_interp_query_hook (const char *ctlstr, va_list ap) - ATTR_FORMAT (printf, 1, 0); + ATTRIBUTE_PRINTF (1, 0); static void mi3_command_loop (void); static void mi2_command_loop (void); --- a/gdb/mi/mi-out.c +++ b/gdb/mi/mi-out.c @@ -55,12 +55,12 @@ static void mi_field_string (struct ui_out *uiout, int fldno, int width, static void mi_field_fmt (struct ui_out *uiout, int fldno, int width, enum ui_align align, const char *fldname, const char *format, - va_list args) ATTR_FORMAT (printf, 6, 0); + va_list args) ATTRIBUTE_PRINTF (6, 0); static void mi_spaces (struct ui_out *uiout, int numspaces); static void mi_text (struct ui_out *uiout, const char *string); static void mi_message (struct ui_out *uiout, int verbosity, const char *format, va_list args) - ATTR_FORMAT (printf, 3, 0); + ATTRIBUTE_PRINTF (3, 0); static void mi_wrap_hint (struct ui_out *uiout, char *identstring); static void mi_flush (struct ui_out *uiout); --- a/gdb/monitor.c +++ b/gdb/monitor.c @@ -119,7 +119,7 @@ static ptid_t monitor_ptid; /* Monitor specific debugging information. Typically only useful to the developer of a new monitor interface. */ -static void monitor_debug (const char *fmt, ...) ATTR_FORMAT(printf, 1, 2); +static void monitor_debug (const char *fmt, ...) ATTRIBUTE_PRINTF (1, 2); static int monitor_debug_p = 0; --- a/gdb/parser-defs.h +++ b/gdb/parser-defs.h @@ -318,7 +318,7 @@ extern void print_subexp_standard (struct expression *, int *, /* Function used to avoid direct calls to fprintf in the code generated by the bison parser. */ -extern void parser_fprintf (FILE *, const char *, ...) ATTR_FORMAT (printf, 2 ,3); +extern void parser_fprintf (FILE *, const char *, ...) ATTRIBUTE_PRINTF (2, 3); extern int exp_uses_objfile (struct expression *exp, struct objfile *objfile); --- a/gdb/serial.h +++ b/gdb/serial.h @@ -87,7 +87,7 @@ extern int serial_write (struct serial *scb, const char *str, int len); /* Write a printf style string onto the serial port. */ extern void serial_printf (struct serial *desc, - const char *,...) ATTR_FORMAT (printf, 2, 3); + const char *,...) ATTRIBUTE_PRINTF (2, 3); /* Allow pending output to drain. */ --- a/gdb/tui/tui-hooks.c +++ b/gdb/tui/tui-hooks.c @@ -64,7 +64,7 @@ tui_new_objfile_hook (struct objfile* objfile) tui_display_main (); } -static int ATTR_FORMAT (printf, 1, 0) +static int ATTRIBUTE_PRINTF (1, 0) tui_query_hook (const char *msg, va_list argp) { int retval; --- a/gdb/ui-out.c +++ b/gdb/ui-out.c @@ -177,12 +177,12 @@ static void default_field_fmt (struct ui_out *uiout, int fldno, int width, enum ui_align align, const char *fldname, const char *format, - va_list args) ATTR_FORMAT (printf, 6, 0); + va_list args) ATTRIBUTE_PRINTF (6, 0); static void default_spaces (struct ui_out *uiout, int numspaces); static void default_text (struct ui_out *uiout, const char *string); static void default_message (struct ui_out *uiout, int verbosity, const char *format, - va_list args) ATTR_FORMAT (printf, 3, 0); + va_list args) ATTRIBUTE_PRINTF (3, 0); static void default_wrap_hint (struct ui_out *uiout, char *identstring); static void default_flush (struct ui_out *uiout); @@ -245,12 +245,12 @@ static void uo_field_skip (struct ui_out *uiout, int fldno, int width, static void uo_field_fmt (struct ui_out *uiout, int fldno, int width, enum ui_align align, const char *fldname, const char *format, va_list args) - ATTR_FORMAT (printf, 6, 0); + ATTRIBUTE_PRINTF (6, 0); static void uo_spaces (struct ui_out *uiout, int numspaces); static void uo_text (struct ui_out *uiout, const char *string); static void uo_message (struct ui_out *uiout, int verbosity, const char *format, va_list args) - ATTR_FORMAT (printf, 3, 0); + ATTRIBUTE_PRINTF (3, 0); static void uo_wrap_hint (struct ui_out *uiout, char *identstring); static void uo_flush (struct ui_out *uiout); static int uo_redirect (struct ui_out *uiout, struct ui_file *outstream); --- a/gdb/ui-out.h +++ b/gdb/ui-out.h @@ -124,7 +124,7 @@ extern void ui_out_field_stream (struct ui_out *uiout, const char *fldname, extern void ui_out_field_fmt (struct ui_out *uiout, const char *fldname, const char *format, ...) - ATTR_FORMAT (printf, 3, 4); + ATTRIBUTE_PRINTF (3, 4); extern void ui_out_field_skip (struct ui_out *uiout, const char *fldname); @@ -134,7 +134,7 @@ extern void ui_out_text (struct ui_out *uiout, const char *string); extern void ui_out_message (struct ui_out *uiout, int verbosity, const char *format, ...) - ATTR_FORMAT (printf, 3, 4); + ATTRIBUTE_PRINTF (3, 4); extern struct ui_stream *ui_out_stream_new (struct ui_out *uiout); --- a/gdb/utils.c +++ b/gdb/utils.c @@ -92,7 +92,7 @@ void (*deprecated_error_begin_hook) (void); /* Prototypes for local functions */ static void vfprintf_maybe_filtered (struct ui_file *, const char *, - va_list, int) ATTR_FORMAT (printf, 2, 0); + va_list, int) ATTRIBUTE_PRINTF (2, 0); static void fputs_maybe_filtered (const char *, struct ui_file *, int); @@ -916,7 +916,7 @@ struct internal_problem has been reported, and assuming GDB didn't quit, the caller can either allow execution to resume or throw an error. */ -static void ATTR_FORMAT (printf, 4, 0) +static void ATTRIBUTE_PRINTF (4, 0) internal_vproblem (struct internal_problem *problem, const char *file, int line, const char *fmt, va_list ap) { @@ -1452,7 +1452,7 @@ gdb_print_host_address (const void *addr, struct ui_file *stream) ARGS are the arguments passed along with the CTLSTR argument to printf. */ -static int ATTR_FORMAT (printf, 1, 0) +static int ATTRIBUTE_PRINTF (1, 0) defaulted_query (const char *ctlstr, const char defchar, va_list args) { int answer; --- a/gdb/xml-support.h +++ b/gdb/xml-support.h @@ -199,13 +199,13 @@ int gdb_xml_parse (struct gdb_xml_parser *parser, const char *buffer); /* Issue a debugging message from one of PARSER's handlers. */ void gdb_xml_debug (struct gdb_xml_parser *parser, const char *format, ...) - ATTR_FORMAT (printf, 2, 0); + ATTRIBUTE_PRINTF (2, 0); /* Issue an error message from one of PARSER's handlers, and stop parsing. */ void gdb_xml_error (struct gdb_xml_parser *parser, const char *format, ...) - ATTR_NORETURN ATTR_FORMAT (printf, 2, 0); + ATTR_NORETURN ATTRIBUTE_PRINTF (2, 0); /* Parse an integer attribute into a ULONGEST. */