Permalink
Browse files

cmake: added checks for HAVE_VARIADIC_MACROS_C99 and HAVE_VARIADIC_MA…

…CROS_GCC
  • Loading branch information...
snikulov committed Jan 11, 2019
1 parent 61faa0b commit e2b6cdb6ad22ff85164357ce70cf3f92f4f54e95
Showing with 46 additions and 2 deletions.
  1. +44 −2 CMake/CurlTests.c
  2. +2 −0 CMakeLists.txt
@@ -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
@@ -972,6 +972,8 @@ foreach(CURL_TEST
HAVE_INET_NTOA_R_DECL_REENTRANT
HAVE_GETADDRINFO
HAVE_FILE_OFFSET_BITS
HAVE_VARIADIC_MACROS_C99
HAVE_VARIADIC_MACROS_GCC
)
curl_internal_test(${CURL_TEST})
endforeach()

0 comments on commit e2b6cdb

Please sign in to comment.