From: Michael Meissner Date: Mon, 5 May 1997 18:10:05 +0000 (+0000) Subject: Add printf attribute support X-Git-Tag: gdb-4_18-branchpoint~5598 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=23b04e791d8abbf69a05b23632cbf22022ec0533;p=thirdparty%2Fbinutils-gdb.git Add printf attribute support --- diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 5ec59757dae..e8c67fc33c4 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,10 @@ +Mon May 5 14:08:34 1997 Mike Meissner + + * sim-trace.h (__attribute__): Define as nothing if not GNU C or + GNU C doesn't support __attributes__. + ({trace,debug}_printf): Add attribute's so -Wformat can check the + format strings. + Mon May 5 11:16:12 1997 Andrew Cagney * sim-config.h (FORCED_ALIGNMENT): New alignment option - diff --git a/sim/common/sim-trace.h b/sim/common/sim-trace.h index 2a98808e027..b400b2daba9 100644 --- a/sim/common/sim-trace.h +++ b/sim/common/sim-trace.h @@ -23,6 +23,12 @@ with this program; if not, write to the Free Software Foundation, Inc., #ifndef SIM_TRACE_H #define SIM_TRACE_H +#ifndef __attribute__ +#if !defined(__GNUC__) || (__GNUC__ < 2) || (__GNUC__ == 2 && __GNU_MINOR__ < 7) +#define __attribute__(attr) +#endif +#endif + /* Maximum number of traceable entities. */ #ifndef MAX_TRACE_VALUES #define MAX_TRACE_VALUES 12 @@ -105,7 +111,8 @@ struct _sim_cpu; /* Non-zero if "--trace-fpu" specified for CPU. */ #define TRACE_FPU_P(cpu) TRACE_P (cpu, TRACE_FPU_IDX) -extern void trace_printf PARAMS ((SIM_DESC, sim_cpu *, const char *, ...)); +extern void trace_printf PARAMS ((SIM_DESC, sim_cpu *, const char *, ...)) + __attribute__((format (printf, 3, 4))); /* Debug support. This is included here because there isn't enough of it to justify @@ -119,6 +126,7 @@ extern void trace_printf PARAMS ((SIM_DESC, sim_cpu *, const char *, ...)); /* Non-zero if "--debug-insn" specified. */ #define DEBUG_INSN_P(cpu) DEBUG_P (cpu, DEBUG_INSN_IDX) -extern void debug_printf PARAMS ((struct _sim_cpu *, const char *, ...)); +extern void debug_printf PARAMS ((struct _sim_cpu *, const char *, ...)) + __attribute__((format (printf, 2, 3))); #endif /* SIM_TRACE_H */