From: Ian Lance Taylor Date: Wed, 4 Feb 1998 18:18:54 +0000 (+0000) Subject: * as.h: If gcc version greater than 2.6, use `__format__' and X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e8696467494f18e5f9ca68b4c23a5c7801f0b617;p=binutils-gdb.git * as.h: If gcc version greater than 2.6, use `__format__' and `__printf__' in function attributes, rather than `format' and `printf'. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index db44d9ebaca..67ac7623966 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +Wed Feb 4 13:17:19 1998 Ian Lance Taylor + + * as.h: If gcc version greater than 2.6, use `__format__' and + `__printf__' in function attributes, rather than `format' and + `printf'. + Mon Feb 2 18:38:18 1998 Ian Lance Taylor * config/tc-sparc.c: Only include elf/sparc.h if OBJ_ELF. diff --git a/gas/as.h b/gas/as.h index 64d418b0555..d86e8bf51b8 100644 --- a/gas/as.h +++ b/gas/as.h @@ -490,21 +490,36 @@ typedef struct _pseudo_type pseudo_typeS; #ifdef USE_STDARG #if (__GNUC__ >= 2) && !defined(VMS) /* for use with -Wformat */ -#define PRINTF_LIKE(FCN) void FCN (const char *format, ...) \ - __attribute__ ((format (printf, 1, 2))) -#define PRINTF_WHERE_LIKE(FCN) void FCN (char *file, unsigned int line, \ - const char *format, ...) \ - __attribute__ ((format (printf, 3, 4))) -#else /* ANSI C with stdarg, but not GNU C */ + +#if __GNUC_MINOR__ < 6 +/* Support for double underscores in attribute names was added in gcc + 2.6, so avoid them if we are using an earlier version. */ +#define __printf__ printf +#define __format__ format +#endif + +#define PRINTF_LIKE(FCN) \ + void FCN (const char *format, ...) \ + __attribute__ ((__format__ (__printf__, 1, 2))) +#define PRINTF_WHERE_LIKE(FCN) \ + void FCN (char *file, unsigned int line, const char *format, ...) \ + __attribute__ ((__format__ (__printf__, 3, 4))) + +#else /* __GNUC__ < 2 || defined(VMS) */ + #define PRINTF_LIKE(FCN) void FCN PARAMS ((const char *format, ...)) #define PRINTF_WHERE_LIKE(FCN) void FCN PARAMS ((char *file, \ unsigned int line, \ const char *format, ...)) -#endif -#else /* not using stdarg */ + +#endif /* __GNUC__ < 2 || defined(VMS) */ + +#else /* ! USE_STDARG */ + #define PRINTF_LIKE(FCN) void FCN () #define PRINTF_WHERE_LIKE(FCN) void FCN () -#endif + +#endif /* ! USE_STDARG */ PRINTF_LIKE (as_bad); PRINTF_LIKE (as_fatal); @@ -512,6 +527,7 @@ PRINTF_LIKE (as_tsktsk); PRINTF_LIKE (as_warn); PRINTF_WHERE_LIKE (as_bad_where); PRINTF_WHERE_LIKE (as_warn_where); + void as_assert PARAMS ((const char *, int, const char *)); void as_abort PARAMS ((const char *, int, const char *));