diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2015-05-05 18:45:47 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2015-05-05 18:45:47 +0200 |
commit | ad09009201f5abc185f853b6db6d8747ce52a1d7 (patch) | |
tree | 0dbc8036fd9e87f39434fb5c5f4b17b2782c6127 /include/libssh | |
parent | e4e3b3052fa6050a796796e22a0c4b52cb7e0835 (diff) | |
download | libssh-ad09009201f5abc185f853b6db6d8747ce52a1d7.tar.gz libssh-ad09009201f5abc185f853b6db6d8747ce52a1d7.tar.xz libssh-ad09009201f5abc185f853b6db6d8747ce52a1d7.zip |
include: Fix variadic macro issues with MSVC
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'include/libssh')
-rw-r--r-- | include/libssh/priv.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/include/libssh/priv.h b/include/libssh/priv.h index 0c5129c5..360546c8 100644 --- a/include/libssh/priv.h +++ b/include/libssh/priv.h @@ -311,10 +311,18 @@ int match_hostname(const char *host, const char *pattern, unsigned int len); * Get the argument cound of variadic arguments */ #ifdef HAVE_GCC_NARG_MACRO +/* + * Since MSVC 2010 there is a bug in passing __VA_ARGS__ to subsequent + * macros as a single token, which results in: + * warning C4003: not enough actual parameters for macro '_VA_ARG_N' + * and incorrect behavior. This fixes issue. + */ +#define VA_APPLY_VARIADIC_MACRO(macro, tuple) macro tuple + #define __VA_NARG__(...) \ (__VA_NARG_(_0, ## __VA_ARGS__, __RSEQ_N()) - 1) #define __VA_NARG_(...) \ - __VA_ARG_N(__VA_ARGS__) + VA_APPLY_VARIADIC_MACRO(__VA_ARG_N, (__VA_ARGS__)) #define __VA_ARG_N( \ _1, _2, _3, _4, _5, _6, _7, _8, _9,_10, \ _11,_12,_13,_14,_15,_16,_17,_18,_19,_20, \ |