Allow gcc to check for correct usage of the formatting string for the
logging class.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4904 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/common/rfb/LogWriter.h b/common/rfb/LogWriter.h
index 7f8b68d..23e3069 100644
--- a/common/rfb/LogWriter.h
+++ b/common/rfb/LogWriter.h
@@ -25,12 +25,18 @@
 #include <rfb/Logger.h>
 #include <rfb/Configuration.h>
 
+#ifdef __GNUC__
+#  define __printf_attr(a, b) __attribute__((__format__ (__printf__, a, b)))
+#else
+#  define __printf_attr(a, b)
+#endif // __GNUC__
+
 // Each log writer instance has a unique textual name,
 // and is attached to a particular Log instance and
 // is assigned a particular log level.
 
 #define DEF_LOGFUNCTION(name, level) \
-  inline void name(const char* fmt, ...) { \
+  inline void name(const char* fmt, ...) __printf_attr(2, 3) { \
     if (m_log && (level <= m_level)) {     \
       va_list ap; va_start(ap, fmt);       \
       m_log->write(level, m_name, fmt, ap);\
@@ -53,7 +59,7 @@
     void setLevel(int level);
     int getLevel(void) { return m_level; }
 
-    inline void write(int level, const char* format, ...) {
+    inline void write(int level, const char* format, ...) __printf_attr(3, 4) {
       if (m_log && (level <= m_level)) {
         va_list ap;
         va_start(ap, format);