From: Pete Batard Date: Mon, 9 Apr 2012 21:28:34 +0000 (+0100) Subject: Windows: Fix support for variadic macros X-Git-Tag: upstream/1.0.21~691 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=974251ba94861d03dbe9837a902d84e83d301cda;p=platform%2Fupstream%2Flibusb.git Windows: Fix support for variadic macros * Visual C++ did not support variadic macros until VS2005, as per http://msdn.microsoft.com/en-us/library/ms177415%28v=VS.80%29.aspx --- diff --git a/libusb/libusbi.h b/libusb/libusbi.h index 9a978ad..fa8597c 100644 --- a/libusb/libusbi.h +++ b/libusb/libusbi.h @@ -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) diff --git a/libusb/os/poll_windows.c b/libusb/os/poll_windows.c index 99cc5e1..5204bcb 100644 --- a/libusb/os/poll_windows.c +++ b/libusb/os/poll_windows.c @@ -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(...)