From 6ede18d41ca8d4e712b49c47028b4919aa3798c1 Mon Sep 17 00:00:00 2001 From: steve Date: Fri, 24 May 2002 19:05:30 +0000 Subject: [PATCH] support GCC __attributes__ for printf formats. --- veriuser.h | 13 +++++++++++-- vpi/sys_display.c | 7 +++++-- vpi_user.h | 17 ++++++++++++++--- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/veriuser.h b/veriuser.h index 826b6e2f1..7a786cd33 100644 --- a/veriuser.h +++ b/veriuser.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: veriuser.h,v 1.2 2002/05/23 03:35:42 steve Exp $" +#ident "$Id: veriuser.h,v 1.3 2002/05/24 19:05:30 steve Exp $" #endif /* @@ -39,9 +39,15 @@ # define EXTERN_C_END #endif +#ifndef __GNUC__ +# undef __attribute__ +# define __attribute__(x) +#endif + EXTERN_C_START -extern void io_printf (const char *, ...); +extern void io_printf (const char *, ...) + __attribute__((format (printf,1,2))); extern int tf_dofinish(void); extern int tf_dostop(void); @@ -50,6 +56,9 @@ EXTERN_C_END /* * $Log: veriuser.h,v $ + * Revision 1.3 2002/05/24 19:05:30 steve + * support GCC __attributes__ for printf formats. + * * Revision 1.2 2002/05/23 03:35:42 steve * Add the io_printf function to libveriuser. * diff --git a/vpi/sys_display.c b/vpi/sys_display.c index 4467be0a7..a401a8ad4 100644 --- a/vpi/sys_display.c +++ b/vpi/sys_display.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: sys_display.c,v 1.36 2002/04/06 20:25:45 steve Exp $" +#ident "$Id: sys_display.c,v 1.37 2002/05/24 19:05:30 steve Exp $" #endif # include "config.h" @@ -290,7 +290,7 @@ static int format_str(vpiHandle scope, unsigned int mcd, } else { vpi_get_value(argv[idx], &value); if (value.format == vpiSuppressVal){ - vpi_printf("\nERROR: parameter does not have a printable value!\n", fmt); + vpi_printf("\nERROR: parameter does not have a printable value!\n"); goto bail_out; } @@ -1111,6 +1111,9 @@ void sys_display_register() /* * $Log: sys_display.c,v $ + * Revision 1.37 2002/05/24 19:05:30 steve + * support GCC __attributes__ for printf formats. + * * Revision 1.36 2002/04/06 20:25:45 steve * cbValueChange automatically replays. * diff --git a/vpi_user.h b/vpi_user.h index 1d9be0e0a..0b9a5c01f 100644 --- a/vpi_user.h +++ b/vpi_user.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vpi_user.h,v 1.10 2002/05/23 03:34:46 steve Exp $" +#ident "$Id: vpi_user.h,v 1.11 2002/05/24 19:05:30 steve Exp $" #endif @@ -37,6 +37,11 @@ # define EXTERN_C_END #endif +#ifndef __GNUC__ +# undef __attribute__ +# define __attribute__(x) +#endif + EXTERN_C_START # include @@ -200,7 +205,9 @@ typedef struct t_vpi_value { /* VPI FUNCTIONS */ extern void vpi_register_systf(const struct t_vpi_systf_data*ss); -extern void vpi_printf(const char*fmt, ...); +extern void vpi_printf(const char*fmt, ...) + __attribute__((format (printf,1,2))); + /* vpi_vprintf is non-standard. */ extern void vpi_vprintf(const char*fmt, va_list ap); @@ -208,7 +215,8 @@ extern unsigned int vpi_mcd_close(unsigned int mcd); extern char *vpi_mcd_name(unsigned int mcd); extern unsigned int vpi_mcd_open(char *name); extern unsigned int vpi_mcd_open_x(char *name, char *mode); -extern int vpi_mcd_printf(unsigned int mcd, const char*fmt, ...); +extern int vpi_mcd_printf(unsigned int mcd, const char*fmt, ...) + __attribute__((format (printf,2,3))); extern int vpi_mcd_fputc(unsigned int mcd, unsigned char x); extern int vpi_mcd_fgetc(unsigned int mcd); @@ -317,6 +325,9 @@ EXTERN_C_END /* * $Log: vpi_user.h,v $ + * Revision 1.11 2002/05/24 19:05:30 steve + * support GCC __attributes__ for printf formats. + * * Revision 1.10 2002/05/23 03:34:46 steve * Export the vpi_vprintf function. *