summaryrefslogtreecommitdiff
path: root/CMake
diff options
context:
space:
mode:
authorSergei Nikulov <sergey.nikulov@gmail.com>2019-01-11 12:05:17 +0300
committerSergei Nikulov <snikulov@users.noreply.github.com>2019-01-11 22:48:54 +0300
commit52e27fe9c6421d36337c0b69df6ca2b3b2d72613 (patch)
treec06a2f13b90e3b8df7249da2d43f22507fa4d349 /CMake
parentba243235ec04af62aee2cfc31bf0f05488e59fe7 (diff)
downloadcurl-52e27fe9c6421d36337c0b69df6ca2b3b2d72613.tar.gz
cmake: added checks for HAVE_VARIADIC_MACROS_C99 and HAVE_VARIADIC_MACROS_GCC
Diffstat (limited to 'CMake')
-rw-r--r--CMake/CurlTests.c46
1 files changed, 44 insertions, 2 deletions
diff --git a/CMake/CurlTests.c b/CMake/CurlTests.c
index 9388c835b..0756b2a31 100644
--- a/CMake/CurlTests.c
+++ b/CMake/CurlTests.c
@@ -553,8 +553,8 @@ main() {
#include <time.h>
int
main() {
- struct timespec ts = {0, 0};
- clock_gettime(CLOCK_MONOTONIC, &ts);
+ struct timespec ts = {0, 0};
+ clock_gettime(CLOCK_MONOTONIC, &ts);
return 0;
}
#endif
@@ -565,3 +565,45 @@ main() {
return 0;
}
#endif
+#ifdef HAVE_VARIADIC_MACROS_C99
+#define c99_vmacro3(first, ...) fun3(first, __VA_ARGS__)
+#define c99_vmacro2(first, ...) fun2(first, __VA_ARGS__)
+
+int fun3(int arg1, int arg2, int arg3);
+int fun2(int arg1, int arg2);
+
+int fun3(int arg1, int arg2, int arg3) {
+ return arg1 + arg2 + arg3;
+}
+int fun2(int arg1, int arg2) {
+ return arg1 + arg2;
+}
+
+int
+main() {
+ int res3 = c99_vmacro3(1, 2, 3);
+ int res2 = c99_vmacro2(1, 2);
+ return 0;
+}
+#endif
+#ifdef HAVE_VARIADIC_MACROS_GCC
+#define gcc_vmacro3(first, args...) fun3(first, args)
+#define gcc_vmacro2(first, args...) fun2(first, args)
+
+int fun3(int arg1, int arg2, int arg3);
+int fun2(int arg1, int arg2);
+
+int fun3(int arg1, int arg2, int arg3) {
+ return arg1 + arg2 + arg3;
+}
+int fun2(int arg1, int arg2) {
+ return arg1 + arg2;
+}
+
+int
+main() {
+ int res3 = gcc_vmacro3(1, 2, 3);
+ int res2 = gcc_vmacro2(1, 2);
+ return 0;
+}
+#endif