rfb: Silence nonliteral format string warning in Logger
Clang complains loudly about this with Wformat=2, so add
a __printf_attr to help out.
Fixes:
/home/shade/dev/tigervnc/common/rfb/Logger.cxx:48:35: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
vsnprintf(buf1, sizeof(buf1)-1, format, ap);
^~~~~~
1 error generated.
diff --git a/common/rfb/Logger.h b/common/rfb/Logger.h
index e53764b..b75594c 100644
--- a/common/rfb/Logger.h
+++ b/common/rfb/Logger.h
@@ -28,6 +28,12 @@
// and is attached to a particular Logger instance and
// is assigned a particular log level.
+#ifdef __GNUC__
+# define __printf_attr(a, b) __attribute__((__format__ (__printf__, a, b)))
+#else
+# define __printf_attr(a, b)
+#endif // __GNUC__
+
namespace rfb {
class Logger {
@@ -45,7 +51,7 @@
// -=- Write data to a log
virtual void write(int level, const char *logname, const char *text) = 0;
- void write(int level, const char *logname, const char* format, va_list ap);
+ void write(int level, const char *logname, const char* format, va_list ap) __printf_attr(4, 0);
// -=- Register a logger