Add printf attribute support

This commit is contained in:
Michael Meissner 1997-05-05 18:10:05 +00:00
parent 654b084539
commit 23b04e791d
2 changed files with 17 additions and 2 deletions

View File

@ -1,3 +1,10 @@
Mon May 5 14:08:34 1997 Mike Meissner <meissner@cygnus.com>
* 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 <cagney@b1.cygnus.com>
* sim-config.h (FORCED_ALIGNMENT): New alignment option -

View File

@ -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 */