Revision: 4904
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4904&view=rev
Author:   ossman_
Date:     2012-04-26 08:51:19 +0000 (Thu, 26 Apr 2012)
Log Message:
-----------
Allow gcc to check for correct usage of the formatting string for the
logging class.

Modified Paths:
--------------
    trunk/common/rfb/LogWriter.h

Modified: trunk/common/rfb/LogWriter.h
===================================================================
--- trunk/common/rfb/LogWriter.h        2012-04-26 04:33:11 UTC (rev 4903)
+++ trunk/common/rfb/LogWriter.h        2012-04-26 08:51:19 UTC (rev 4904)
@@ -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);

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Tigervnc-commits mailing list
Tigervnc-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-commits

Reply via email to