Windows: Fix support for variadic macros
authorPete Batard <pete@akeo.ie>
Mon, 9 Apr 2012 21:28:34 +0000 (22:28 +0100)
committerPete Batard <pete@akeo.ie>
Mon, 9 Apr 2012 21:28:34 +0000 (22:28 +0100)
* Visual C++ did not support variadic macros until VS2005, as per
  http://msdn.microsoft.com/en-us/library/ms177415%28v=VS.80%29.aspx

libusb/libusbi.h
libusb/os/poll_windows.c

index 9a978ad..fa8597c 100644 (file)
@@ -131,7 +131,7 @@ void usbi_log(struct libusb_context *ctx, enum usbi_log_level level,
 void usbi_log_v(struct libusb_context *ctx, enum usbi_log_level level,
        const char *function, const char *format, va_list args);
 
-#if !defined(_MSC_VER) || _MSC_VER > 1200
+#if !defined(_MSC_VER) || _MSC_VER >= 1400
 
 #ifdef ENABLE_LOGGING
 #define _usbi_log(ctx, level, ...) usbi_log(ctx, level, __FUNCTION__, __VA_ARGS__)
@@ -149,7 +149,7 @@ void usbi_log_v(struct libusb_context *ctx, enum usbi_log_level level,
 #define usbi_warn(ctx, ...) _usbi_log(ctx, LOG_LEVEL_WARNING, __VA_ARGS__)
 #define usbi_err(ctx, ...) _usbi_log(ctx, LOG_LEVEL_ERROR, __VA_ARGS__)
 
-#else /* !defined(_MSC_VER) || _MSC_VER > 1200 */
+#else /* !defined(_MSC_VER) || _MSC_VER >= 1400 */
 
 #ifdef ENABLE_LOGGING
 #define LOG_BODY(ctxt, level) \
@@ -180,7 +180,7 @@ static inline void usbi_dbg(const char *format, ...)
 { }
 #endif
 
-#endif /* !defined(_MSC_VER) || _MSC_VER > 1200 */
+#endif /* !defined(_MSC_VER) || _MSC_VER >= 1400 */
 
 #define USBI_GET_CONTEXT(ctx) if (!(ctx)) (ctx) = usbi_default_context
 #define DEVICE_CTX(dev) ((dev)->ctx)
index 99cc5e1..5204bcb 100644 (file)
@@ -52,9 +52,9 @@
 #if defined(DEBUG_POLL_WINDOWS)
 #define poll_dbg usbi_dbg
 #else
-// MSVC6 cannot use a variadic argument and non MSVC
+// MSVC++ < 2005 cannot use a variadic argument and non MSVC
 // compilers produce warnings if parenthesis are ommitted.
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && _MSC_VER < 1400
 #define poll_dbg
 #else
 #define poll_dbg(...)