X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2F_PDCLIB%2Fstdarg.c;h=abb1f4c4f7478b8208b6074b1ca856c997ea381a;hb=4286850c5d7c3df9d8bdc7470e4b77ca9b05edb6;hp=defd5fef31d8f7d9129c4cf6b2aac5d3ecc6c724;hpb=48343738db657a317d2d217f3e4ed5b6c37bd621;p=pdclib.old diff --git a/functions/_PDCLIB/stdarg.c b/functions/_PDCLIB/stdarg.c index defd5fe..abb1f4c 100644 --- a/functions/_PDCLIB/stdarg.c +++ b/functions/_PDCLIB/stdarg.c @@ -1,21 +1,17 @@ /* $Id$ */ -/* Release $Name$ */ - /* stdarg This file is part of the Public Domain C Library (PDCLib). Permission is granted to use, modify, and / or redistribute at will. */ -#ifdef TEST - -#include <_PDCLIB_test.h> #include #include #include +#ifdef TEST -unsigned int rc = 0; +#include <_PDCLIB_test.h> typedef int (*intfunc_t)( void ); @@ -32,6 +28,11 @@ enum tag_t TAG_FUNCPTR }; +static int dummy( void ) +{ + return INT_MAX; +} + static int test( enum tag_t s, ... ) { enum tag_t tag = s; @@ -85,7 +86,9 @@ static int test( enum tag_t s, ... ) } case TAG_FUNCPTR: { - TESTCASE( (va_arg( ap, intfunc_t ))() == INT_MAX ); + intfunc_t function; + TESTCASE( ( function = va_arg( ap, intfunc_t ) ) == dummy ); + TESTCASE( function() == INT_MAX ); tag = va_arg( ap, enum tag_t ); break; } @@ -98,12 +101,7 @@ static int test( enum tag_t s, ... ) } } -int dummy() -{ - return INT_MAX; -} - -int main() +int main( void ) { int x = INT_MAX; long double d = LDBL_MAX; @@ -114,5 +112,4 @@ int main() test( TAG_INTPTR, &x, TAG_LDBLPTR, &d, TAG_FUNCPTR, dummy, TAG_END ); return TEST_RESULTS; } - #endif