diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-12-04 13:39:22 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-12-04 13:39:22 -0800 |
commit | 1f2e533010513cc99435e8781226abec5cc53f6f (patch) | |
tree | a141c9cf144428fceab227be8616b0924834f10c | |
parent | 82e8eac6669a5e766f295685c973c0cd677d3cb9 (diff) | |
download | xcb-util-1f2e533010513cc99435e8781226abec5cc53f6f.tar.gz |
atoms: add format attribute to makenames() function
Quiets clang warning:
atoms.c:53:22: warning: format string is not a string literal [-Wformat-nonliteral]
n = vasprintf(&ret, fmt, ap);
^~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | src/atoms.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/atoms.c b/src/atoms.c index e5c33e5..559579f 100644 --- a/src/atoms.c +++ b/src/atoms.c @@ -13,6 +13,14 @@ #include <stdarg.h> #include "xcb_atom.h" +#ifndef __has_attribute +# define __has_attribute(x) 0 /* Compatibility with older compilers. */ +#endif + +#if __has_attribute(__format__) \ + || defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 203) +__attribute__((__format__(__printf__,1,2))) +#endif static char *makename(const char *fmt, ...) { char *ret; |