1 |
commit: 0110487722646ebf9bc2c4e12b4b4a3c358cb10d |
2 |
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com> |
3 |
AuthorDate: Sat Feb 10 22:48:22 2018 +0000 |
4 |
Commit: William Hubbs <williamh <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Feb 10 22:48:22 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=01104877 |
7 |
|
8 |
helpers.h: silence compiler warnings about xasprintf |
9 |
|
10 |
src/includes/helpers.h | 4 +++- |
11 |
1 file changed, 3 insertions(+), 1 deletion(-) |
12 |
|
13 |
diff --git a/src/includes/helpers.h b/src/includes/helpers.h |
14 |
index 6e0ad19f..037a7859 100644 |
15 |
--- a/src/includes/helpers.h |
16 |
+++ b/src/includes/helpers.h |
17 |
@@ -28,9 +28,11 @@ |
18 |
#if __GNUC__ > 2 || defined(__INTEL_COMPILER) |
19 |
# define _dead __attribute__((__noreturn__)) |
20 |
# define _unused __attribute__((__unused__)) |
21 |
+# define _xasprintf(a, b) __attribute__((__format__(__printf__, a, b))) |
22 |
#else |
23 |
# define _dead |
24 |
# define _unused |
25 |
+# define _xasprintf(a, b) |
26 |
#endif |
27 |
|
28 |
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) |
29 |
@@ -132,7 +134,7 @@ _unused static bool existss(const char *pathname) |
30 |
* functions to handle memory allocation. |
31 |
* this function was originally written by Mike Frysinger. |
32 |
*/ |
33 |
-_unused static int xasprintf(char **strp, const char *fmt, ...) |
34 |
+_unused _xasprintf(2,3) static int xasprintf(char **strp, const char *fmt, ...) |
35 |
{ |
36 |
va_list ap; |
37 |
int len; |