diff options
Diffstat (limited to 'Utilities/cmcurl/CMake/CurlTests.c')
-rw-r--r-- | Utilities/cmcurl/CMake/CurlTests.c | 52 |
1 files changed, 50 insertions, 2 deletions
diff --git a/Utilities/cmcurl/CMake/CurlTests.c b/Utilities/cmcurl/CMake/CurlTests.c index 9388c835b..07b516b4d 100644 --- a/Utilities/cmcurl/CMake/CurlTests.c +++ b/Utilities/cmcurl/CMake/CurlTests.c @@ -240,6 +240,7 @@ int main() #ifndef inet_ntoa_r func_type func; func = (func_type)inet_ntoa_r; + (void)func; #endif return 0; } @@ -255,6 +256,7 @@ int main() #ifndef inet_ntoa_r func_type func; func = (func_type)&inet_ntoa_r; + (void)func; #endif return 0; } @@ -553,8 +555,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 +567,49 @@ 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); + (void)res3; + (void)res2; + 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); + (void)res3; + (void)res2; + return 0; +} +#endif |