#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, ...) __printf_attr(2, 3);
+ Exception(const char *format = 0, ...)
+ __attribute__((__format__ (__printf__, 2, 3)));
virtual ~Exception() {}
virtual const char* str() const { return str_; }
};
#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 v##name(const char* fmt, va_list ap) __printf_attr(2, 0) { \
+ inline void v##name(const char* fmt, va_list ap) \
+ __attribute__((__format__ (__printf__, 2, 0))) \
+ { \
if (m_log && (level <= m_level)) \
m_log->write(level, m_name, fmt, ap); \
} \
- inline void name(const char* fmt, ...) __printf_attr(2, 3) { \
+ inline void name(const char* fmt, ...) \
+ __attribute__((__format__ (__printf__, 2, 3))) \
+ { \
if (m_log && (level <= m_level)) { \
va_list ap; va_start(ap, fmt); \
m_log->write(level, m_name, fmt, ap);\
void setLevel(int level);
int getLevel(void) { return m_level; }
- inline void write(int level, const char* format, ...) __printf_attr(3, 4) {
+ inline void write(int level, const char* format, ...)
+ __attribute__((__format__ (__printf__, 3, 4)))
+ {
if (m_log && (level <= m_level)) {
va_list ap;
va_start(ap, format);
// 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 {
// -=- 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) __printf_attr(4, 0);
+ void write(int level, const char *logname, const char* format, va_list ap)
+ __attribute__((__format__ (__printf__, 4, 0)));
// -=- Register a logger
// throwConnFailedException() prints a message to the log, sends a conn
// failed message to the client (if possible) and throws a
// ConnFailedException.
- void throwConnFailedException(const char* format, ...) __printf_attr(2, 3);
+ void throwConnFailedException(const char* format, ...)
+ __attribute__((__format__ (__printf__, 2, 3)));
void setState(stateEnum s) { state_ = s; }
struct timeval;
-#ifdef __GNUC__
-# define __printf_attr(a, b) __attribute__((__format__ (__printf__, a, b)))
-#else
-# define __printf_attr(a, b)
-#endif // __GNUC__
-
namespace rfb {
// -=- Class to handle cleanup of arrays of characters
~CharArray() {
delete [] buf;
}
- void format(const char *fmt, ...) __printf_attr(2, 3);
+ void format(const char *fmt, ...)
+ __attribute__((__format__ (__printf__, 2, 3)));
// Get the buffer pointer & clear it (i.e. caller takes ownership)
char* takeBuf() {char* tmp = buf; buf = 0; return tmp;}
void replaceBuf(char* b) {delete [] buf; buf = b;}
void vncInitRFB(void);
-#ifdef __GNUC__
-# define __printf_attr(a, b) __attribute__((__format__ (__printf__, a, b)))
-#else
-# define __printf_attr(a, b)
-#endif // __GNUC__
-
-void vncLogError(const char *name, const char *format, ...) __printf_attr(2, 3);
-void vncLogStatus(const char *name, const char *format, ...) __printf_attr(2, 3);
-void vncLogInfo(const char *name, const char *format, ...) __printf_attr(2, 3);
-void vncLogDebug(const char *name, const char *format, ...) __printf_attr(2, 3);
+void vncLogError(const char *name, const char *format, ...)
+ __attribute__((__format__ (__printf__, 2, 3)));
+void vncLogStatus(const char *name, const char *format, ...)
+ __attribute__((__format__ (__printf__, 2, 3)));
+void vncLogInfo(const char *name, const char *format, ...)
+ __attribute__((__format__ (__printf__, 2, 3)));
+void vncLogDebug(const char *name, const char *format, ...)
+ __attribute__((__format__ (__printf__, 2, 3)));
int vncSetParam(const char *name, const char *value);
int vncSetParamSimple(const char *nameAndValue);
extern "C" {
#endif
-#ifdef __GNUC__
-# define __printf_attr(a, b) __attribute__((__format__ (__printf__, a, b)))
-# define __noreturn_attr __attribute__((noreturn))
-#else
-# define __printf_attr(a, b)
-# define __noreturn_attr
-#endif // __GNUC__
-
const char *vncGetDisplay(void);
unsigned long vncGetServerGeneration(void);
-void vncFatalError(const char *format, ...) __printf_attr(1, 2) __noreturn_attr;
+void vncFatalError(const char *format, ...)
+ __attribute__((__format__ (__printf__, 1, 2)))
+ __attribute__((noreturn));
int vncGetScreenCount(void);
class Fl_Scrollbar;
-#ifdef __GNUC__
-# define __printf_attr(a, b) __attribute__((__format__ (__printf__, a, b)))
-#else
-# define __printf_attr(a, b)
-#endif // __GNUC__
-
class DesktopWindow : public Fl_Window {
public:
private:
static void menuOverlay(void *data);
- void setOverlay(const char *text, ...) __printf_attr(2, 3);
+ void setOverlay(const char *text, ...)
+ __attribute__((__format__ (__printf__, 2, 3)));
static void updateOverlay(void *data);
static int fltkDispatch(int event, Fl_Window *win);
#define VNCSERVERNAMELEN 256
-#ifdef __GNUC__
-# define __printf_attr(a, b) __attribute__((__format__ (__printf__, a, b)))
-#else
-# define __printf_attr(a, b)
-#endif // __GNUC__
-
namespace rdr {
struct Exception;
};
-void abort_vncviewer(const char *error, ...) __printf_attr(1, 2);
-void abort_connection(const char *error, ...) __printf_attr(1, 2);
+void abort_vncviewer(const char *error, ...)
+ __attribute__((__format__ (__printf__, 1, 2)));
+void abort_connection(const char *error, ...)
+ __attribute__((__format__ (__printf__, 1, 2)));
void abort_connection_with_unexpected_error(const rdr::Exception &);
void disconnect();