Add __printflike() from FreeBSD. #if 0 out FreeBSD specific extension for now. # # # patch "sys/sys/cdefs.h" # from [03c25b5f0381cc519cff842542ae176c6e8cbb16] # to [3050ae8e1f365db94376b79881541521a9b5107b] # ============================================================ --- sys/sys/cdefs.h 03c25b5f0381cc519cff842542ae176c6e8cbb16 +++ sys/sys/cdefs.h 3050ae8e1f365db94376b79881541521a9b5107b @@ -322,6 +322,34 @@ #endif /* + * Compiler-dependent macros to declare that functions take printf-like + * or scanf-like arguments. They are null except for versions of gcc + * that are known to support the features properly (old versions of gcc-2 + * didn't permit keeping the keywords out of the application namespace). + */ +#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 + +#if 0 +/* Compiler-dependent macros that rely on FreeBSD-specific extensions. */ +#if __FreeBSD_cc_version >= 300001 && defined(__GNUC__) && !defined(__INTEL_COMPILER) +#define __printf0like(fmtarg, firstvararg) \ + __attribute__((__format__ (__printf0__, fmtarg, firstvararg))) +#else +#define __printf0like(fmtarg, firstvararg) +#endif +#endif + +/* * Macros for manipulating "link sets". Link sets are arrays of pointers * to objects, which are gathered up by the linker. *