aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2015-02-08 18:49:02 +0100
committerAris Adamantiadis <aris@0xbadc0de.be>2015-02-08 18:49:02 +0100
commita653e27a2e949bb62041509c2aab9787b3fbd480 (patch)
tree447ab0c92e616da9edd97c9915a851281394ce33
parentd3f30da158093e564d97db4182bcfff1e97a309a (diff)
downloadlibssh-a653e27a2e949bb62041509c2aab9787b3fbd480.tar.gz
libssh-a653e27a2e949bb62041509c2aab9787b3fbd480.tar.xz
libssh-a653e27a2e949bb62041509c2aab9787b3fbd480.zip
buffer: detect compilers not supporting __VA_ARGS__
-rw-r--r--ConfigureChecks.cmake12
-rw-r--r--config.h.cmake1
2 files changed, 13 insertions, 0 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index 5f570c3c..13a0f4dc 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -203,6 +203,18 @@ int main(void)
return 0;
}" HAVE_GCC_VOLATILE_MEMORY_PROTECTION)
+check_c_source_compiles("
+#include <stdio.h>
+#define __VA_NARG__(...) (__VA_NARG_(_0, ## __VA_ARGS__, __RSEQ_N()) - 1)
+#define __VA_NARG_(...) __VA_ARG_N(__VA_ARGS__)
+#define __VA_ARG_N( _1, _2, _3, _4, _5, _6, _7, _8, _9,_10,N,...) N
+#define __RSEQ_N() 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
+#define myprintf(format, ...) printf((format), __VA_NARG__(__VA_ARGS__), __VA_ARGS__)
+int main(void) {
+ myprintf(\"%d %d %d %d\",1,2,3);
+ return 0;
+}" HAVE_GCC_NARG_MACRO)
+
if (WITH_DEBUG_CRYPTO)
set(DEBUG_CRYPTO 1)
endif (WITH_DEBUG_CRYPTO)
diff --git a/config.h.cmake b/config.h.cmake
index 86538e17..0d30d5df 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -144,6 +144,7 @@
#cmakedefine HAVE_MSC_THREAD_LOCAL_STORAGE 1
#cmakedefine HAVE_GCC_VOLATILE_MEMORY_PROTECTION 1
+#cmakedefine HAVE_GCC_NARG_MACRO 1
/* Define to 1 if you want to enable GSSAPI */
#cmakedefine WITH_GSSAPI 1