Analogous to __printflike and __scanflike, add the macro __format_arg which

expands to the GCC format_arg attribute if supported.

This fixes a syntax error in <nl_types.h> for compilers/tools not
implementing the GCC __attribute__ extensions.
This commit is contained in:
Stefan Farfeleder 2006-01-26 20:53:40 +00:00
parent c74da55a0e
commit 3acb8d3f94
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=154867
3 changed files with 4 additions and 8 deletions

View File

@ -97,8 +97,7 @@ typedef __nl_item nl_item;
__BEGIN_DECLS
nl_catd catopen(const char *, int);
char *catgets(nl_catd, int, int, const char *)
__attribute__((__format_arg__(4)));
char *catgets(nl_catd, int, int, const char *) __format_arg(4);
int catclose(nl_catd);
__END_DECLS

View File

@ -328,12 +328,7 @@ char *tempnam(const char *, const char *);
int asprintf(char **, const char *, ...) __printflike(2, 3);
char *ctermid_r(char *);
char *fgetln(FILE *, size_t *);
#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3
#define __ATTR_FORMAT_ARG __attribute__((__format_arg__(2)))
#else
#define __ATTR_FORMAT_ARG
#endif
__const char *fmtcheck(const char *, const char *) __ATTR_FORMAT_ARG;
__const char *fmtcheck(const char *, const char *) __format_arg(2);
int fpurge(FILE *);
void setbuffer(FILE *, char *, int);
int setlinebuf(FILE *);

View File

@ -324,11 +324,13 @@
#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
#define __printflike(fmtarg, firstvararg)
#define __scanflike(fmtarg, firstvararg)
#define __format_arg(fmtarg)
#else
#define __printflike(fmtarg, firstvararg) \
__attribute__((__format__ (__printf__, fmtarg, firstvararg)))
#define __scanflike(fmtarg, firstvararg) \
__attribute__((__format__ (__scanf__, fmtarg, firstvararg)))
#define __format_arg(fmtarg) __attribute__((__format_arg__ (fmtarg)))
#endif
/* Compiler-dependent macros that rely on FreeBSD-specific extensions. */