helpers.h: silence compiler warnings about xasprintf

This commit is contained in:
William Hubbs 2018-02-10 16:48:22 -06:00
parent 68b9b0bc2a
commit 0110487722

View File

@ -28,9 +28,11 @@
#if __GNUC__ > 2 || defined(__INTEL_COMPILER) #if __GNUC__ > 2 || defined(__INTEL_COMPILER)
# define _dead __attribute__((__noreturn__)) # define _dead __attribute__((__noreturn__))
# define _unused __attribute__((__unused__)) # define _unused __attribute__((__unused__))
# define _xasprintf(a, b) __attribute__((__format__(__printf__, a, b)))
#else #else
# define _dead # define _dead
# define _unused # define _unused
# define _xasprintf(a, b)
#endif #endif
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
@ -132,7 +134,7 @@ _unused static bool existss(const char *pathname)
* functions to handle memory allocation. * functions to handle memory allocation.
* this function was originally written by Mike Frysinger. * this function was originally written by Mike Frysinger.
*/ */
_unused static int xasprintf(char **strp, const char *fmt, ...) _unused _xasprintf(2,3) static int xasprintf(char **strp, const char *fmt, ...)
{ {
va_list ap; va_list ap;
int len; int len;