summaryrefslogtreecommitdiffstats
path: root/common/rdr
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2015-03-03 16:11:26 +0100
committerPierre Ossman <ossman@cendio.se>2015-03-03 16:11:26 +0100
commit5b3c5f49b103d45ce11cd7c0319c82b95ee61e58 (patch)
tree4b17ae7e0911471fe177c645d438dd68cf790ad0 /common/rdr
parenteb95532f5c0e9e6891233ab7ca4d2a10e1fe1d32 (diff)
downloadtigervnc-5b3c5f49b103d45ce11cd7c0319c82b95ee61e58.tar.gz
tigervnc-5b3c5f49b103d45ce11cd7c0319c82b95ee61e58.zip
Tag the Exception constructor as a printf function
This allows the compiler to analyse the format strings and arguments for correctness.
Diffstat (limited to 'common/rdr')
-rw-r--r--common/rdr/Exception.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/common/rdr/Exception.h b/common/rdr/Exception.h
index ea10f9d7..f533dcce 100644
--- a/common/rdr/Exception.h
+++ b/common/rdr/Exception.h
@@ -21,12 +21,18 @@
#ifndef __RDR_EXCEPTION_H__
#define __RDR_EXCEPTION_H__
+#ifdef __GNUC__
+# define __printf_attr(a, b) __attribute__((__format__ (__printf__, a, b)))
+#else
+# define __printf_attr(a, b)
+#endif // __GNUC__
+
namespace rdr {
struct Exception {
enum { len = 256 };
char str_[len];
- Exception(const char *format = 0, ...);
+ Exception(const char *format = 0, ...) __printf_attr(2, 3);
virtual ~Exception() {}
virtual const char* str() const { return str_; }
};