This is the mail archive of the
ecos-patches@sourceware.org
mailing list for the eCos project.
and more main() fixes
- From: Bart Veer <bartv at ecoscentric dot com>
- To: ecos-patches at sourceware dot org
- Date: Wed, 28 Jan 2009 14:46:28 GMT
- Subject: and more main() fixes
This patch fixes up the tests in language/c/libc/stdlib to cope with
configurations that do not use main().
Bart
2009-01-26 Jonathan Larmour <jifl@eCosCentric.com>
* tests/abs.c: Allow to run if CYGPKG_LIBC_STARTUP isn't there.
* tests/atoi.c: Ditto.
* tests/atol.c: Ditto.
* tests/bsearch.c: Ditto.
* tests/div.c: Ditto.
* tests/getenv.c: Ditto.
* tests/labs.c: Ditto.
* tests/ldiv.c: Ditto.
* tests/qsort.c: Ditto.
* tests/rand1.c: Ditto.
* tests/rand2.c: Ditto.
* tests/rand3.c: Ditto.
* tests/rand4.c: Ditto.
* tests/srand.c: Ditto.
* tests/strtol.c: Ditto.
* tests/strtoul.c: Ditto.
Index: tests/abs.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdlib/current/tests/abs.c,v
retrieving revision 1.3
diff -u -p -r1.3 abs.c
--- tests/abs.c 23 May 2002 23:07:22 -0000 1.3
+++ tests/abs.c 28 Jan 2009 14:45:34 -0000
@@ -49,15 +49,19 @@
//####DESCRIPTIONEND####
// INCLUDES
-
+#include <pkgconf/system.h>
#include <stdlib.h>
#include <limits.h>
#include <cyg/infra/testcase.h>
// FUNCTIONS
+#ifndef CYGPKG_LIBC_STARTUP
+void cyg_user_start(void)
+#else
int
main( int argc, char *argv[] )
+#endif
{
int x;
Index: tests/atoi.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdlib/current/tests/atoi.c,v
retrieving revision 1.4
diff -u -p -r1.4 atoi.c
--- tests/atoi.c 23 May 2002 23:07:22 -0000 1.4
+++ tests/atoi.c 28 Jan 2009 14:45:34 -0000
@@ -50,6 +50,7 @@
// INCLUDES
+#include <pkgconf/system.h>
#include <stdlib.h>
#include <cyg/infra/testcase.h>
@@ -94,8 +95,12 @@ test( CYG_ADDRWORD data )
} // test()
+#ifndef CYGPKG_LIBC_STARTUP
+void cyg_user_start(void)
+#else
int
-main(int argc, char *argv[])
+main( int argc, char *argv[] )
+#endif
{
CYG_TEST_INIT();
Index: tests/atol.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdlib/current/tests/atol.c,v
retrieving revision 1.3
diff -u -p -r1.3 atol.c
--- tests/atol.c 23 May 2002 23:07:22 -0000 1.3
+++ tests/atol.c 28 Jan 2009 14:45:34 -0000
@@ -50,6 +50,7 @@
// INCLUDES
+#include <pkgconf/system.h>
#include <stdlib.h>
#include <cyg/infra/testcase.h>
@@ -92,8 +93,12 @@ test( CYG_ADDRWORD data )
"atol() function");
} // test()
+#ifndef CYGPKG_LIBC_STARTUP
+void cyg_user_start(void)
+#else
int
-main(int argc, char *argv[])
+main( int argc, char *argv[] )
+#endif
{
CYG_TEST_INIT();
Index: tests/bsearch.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdlib/current/tests/bsearch.c,v
retrieving revision 1.3
diff -u -p -r1.3 bsearch.c
--- tests/bsearch.c 23 May 2002 23:07:22 -0000 1.3
+++ tests/bsearch.c 28 Jan 2009 14:45:34 -0000
@@ -50,6 +50,7 @@
// INCLUDES
+#include <pkgconf/system.h>
#include <stdlib.h>
#include <cyg/infra/testcase.h>
@@ -67,8 +68,12 @@ Compar( const void *int1, const void *in
return 1;
} // Compar()
+#ifndef CYGPKG_LIBC_STARTUP
+void cyg_user_start(void)
+#else
int
main( int argc, char *argv[] )
+#endif
{
int key;
int *result;
Index: tests/div.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdlib/current/tests/div.c,v
retrieving revision 1.3
diff -u -p -r1.3 div.c
--- tests/div.c 23 May 2002 23:07:22 -0000 1.3
+++ tests/div.c 28 Jan 2009 14:45:34 -0000
@@ -50,13 +50,18 @@
// INCLUDES
+#include <pkgconf/system.h>
#include <stdlib.h>
#include <cyg/infra/testcase.h>
// FUNCTIONS
+#ifndef CYGPKG_LIBC_STARTUP
+void cyg_user_start(void)
+#else
int
main( int argc, char *argv[] )
+#endif
{
int num, denom;
div_t result;
Index: tests/getenv.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdlib/current/tests/getenv.c,v
retrieving revision 1.3
diff -u -p -r1.3 getenv.c
--- tests/getenv.c 23 May 2002 23:07:22 -0000 1.3
+++ tests/getenv.c 28 Jan 2009 14:45:34 -0000
@@ -50,6 +50,7 @@
// INCLUDES
+#include <pkgconf/system.h>
#include <stdlib.h> // Main header for stdlib functions
#include <cyg/infra/testcase.h> // Testcase API
@@ -71,8 +72,12 @@ my_strcmp(const char *s1, const char *s2
return (*s1 - *s2);
} // my_strcmp()
+#ifndef CYGPKG_LIBC_STARTUP
+void cyg_user_start(void)
+#else
int
main( int argc, char *argv[] )
+#endif
{
char *str;
Index: tests/labs.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdlib/current/tests/labs.c,v
retrieving revision 1.3
diff -u -p -r1.3 labs.c
--- tests/labs.c 23 May 2002 23:07:22 -0000 1.3
+++ tests/labs.c 28 Jan 2009 14:45:35 -0000
@@ -50,13 +50,18 @@
// INCLUDES
+#include <pkgconf/system.h>
#include <stdlib.h>
#include <cyg/infra/testcase.h>
// FUNCTIONS
+#ifndef CYGPKG_LIBC_STARTUP
+void cyg_user_start(void)
+#else
int
main( int argc, char *argv[] )
+#endif
{
int x;
Index: tests/ldiv.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdlib/current/tests/ldiv.c,v
retrieving revision 1.3
diff -u -p -r1.3 ldiv.c
--- tests/ldiv.c 23 May 2002 23:07:22 -0000 1.3
+++ tests/ldiv.c 28 Jan 2009 14:45:35 -0000
@@ -50,14 +50,19 @@
// INCLUDES
+#include <pkgconf/system.h>
#include <stdlib.h>
#include <cyg/infra/testcase.h>
// FUNCTIONS
+#ifndef CYGPKG_LIBC_STARTUP
+void cyg_user_start(void)
+#else
int
main( int argc, char *argv[] )
+#endif
{
long num, denom;
ldiv_t result;
Index: tests/qsort.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdlib/current/tests/qsort.c,v
retrieving revision 1.3
diff -u -p -r1.3 qsort.c
--- tests/qsort.c 23 May 2002 23:07:22 -0000 1.3
+++ tests/qsort.c 28 Jan 2009 14:45:35 -0000
@@ -50,6 +50,7 @@
// INCLUDES
+#include <pkgconf/system.h>
#include <stdlib.h>
#include <cyg/infra/testcase.h>
@@ -68,8 +69,12 @@ Compar( const void *int1, const void *in
return 1;
} // Compar()
+#ifndef CYGPKG_LIBC_STARTUP
+void cyg_user_start(void)
+#else
int
main( int argc, char *argv[] )
+#endif
{
unsigned int ctr;
int fail=0;
Index: tests/rand1.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdlib/current/tests/rand1.c,v
retrieving revision 1.3
diff -u -p -r1.3 rand1.c
--- tests/rand1.c 23 May 2002 23:07:22 -0000 1.3
+++ tests/rand1.c 28 Jan 2009 14:45:35 -0000
@@ -50,6 +50,7 @@
// INCLUDES
+#include <pkgconf/system.h>
#include <stdlib.h>
#include <cyg/infra/testcase.h>
@@ -84,8 +85,12 @@ test( CYG_ADDRWORD data )
"C library rand() function");
} // test()
+#ifndef CYGPKG_LIBC_STARTUP
+void cyg_user_start(void)
+#else
int
-main(int argc, char *argv[])
+main( int argc, char *argv[] )
+#endif
{
CYG_TEST_INIT();
Index: tests/rand2.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdlib/current/tests/rand2.c,v
retrieving revision 1.3
diff -u -p -r1.3 rand2.c
--- tests/rand2.c 23 May 2002 23:07:22 -0000 1.3
+++ tests/rand2.c 28 Jan 2009 14:45:35 -0000
@@ -50,6 +50,7 @@
// INCLUDES
+#include <pkgconf/system.h>
#include <pkgconf/libc_stdlib.h> // CYGNUM_LIBC_RAND_SEED
#include <stdlib.h>
#include <cyg/infra/testcase.h>
@@ -90,8 +91,12 @@ test( CYG_ADDRWORD data )
"library rand() function");
} // test()
+#ifndef CYGPKG_LIBC_STARTUP
+void cyg_user_start(void)
+#else
int
-main(int argc, char *argv[])
+main( int argc, char *argv[] )
+#endif
{
CYG_TEST_INIT();
Index: tests/rand3.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdlib/current/tests/rand3.c,v
retrieving revision 1.3
diff -u -p -r1.3 rand3.c
--- tests/rand3.c 23 May 2002 23:07:22 -0000 1.3
+++ tests/rand3.c 28 Jan 2009 14:45:35 -0000
@@ -52,6 +52,7 @@
// INCLUDES
+#include <pkgconf/system.h>
#include <stdlib.h>
#include <cyg/infra/testcase.h>
@@ -83,8 +84,12 @@ my_abs(int i)
return (i < 0) ? -i : i;
} // my_abs()
+#ifndef CYGPKG_LIBC_STARTUP
+void cyg_user_start(void)
+#else
int
-main(int argc, char *argv[])
+main( int argc, char *argv[] )
+#endif
{
// divide the space from 0..RAND_MAX into NUM_BUCKETS categories *BUT*
// RAND_MAX / NUM_BUCKETS may not divide exactly so we leave space for
Index: tests/rand4.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdlib/current/tests/rand4.c,v
retrieving revision 1.3
diff -u -p -r1.3 rand4.c
--- tests/rand4.c 23 May 2002 23:07:23 -0000 1.3
+++ tests/rand4.c 28 Jan 2009 14:45:35 -0000
@@ -52,6 +52,7 @@
// CONFIGURATION
+#include <pkgconf/system.h>
#include <pkgconf/libc_stdlib.h> // Configuration header
// INCLUDES
@@ -69,8 +70,12 @@
// FUNCTIONS
+#ifndef CYGPKG_LIBC_STARTUP
+void cyg_user_start(void)
+#else
int
-main(int argc, char *argv[])
+main( int argc, char *argv[] )
+#endif
{
#if TEST_VALID
int i;
Index: tests/srand.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdlib/current/tests/srand.c,v
retrieving revision 1.3
diff -u -p -r1.3 srand.c
--- tests/srand.c 23 May 2002 23:07:23 -0000 1.3
+++ tests/srand.c 28 Jan 2009 14:45:35 -0000
@@ -50,6 +50,7 @@
// INCLUDES
+#include <pkgconf/system.h>
#include <stdlib.h>
#include <cyg/infra/testcase.h>
@@ -112,8 +113,12 @@ test( CYG_ADDRWORD data )
"C library srand() function");
} // test()
+#ifndef CYGPKG_LIBC_STARTUP
+void cyg_user_start(void)
+#else
int
-main(int argc, char *argv[])
+main( int argc, char *argv[] )
+#endif
{
CYG_TEST_INIT();
Index: tests/strtol.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdlib/current/tests/strtol.c,v
retrieving revision 1.3
diff -u -p -r1.3 strtol.c
--- tests/strtol.c 23 May 2002 23:07:23 -0000 1.3
+++ tests/strtol.c 28 Jan 2009 14:45:35 -0000
@@ -50,6 +50,7 @@
// INCLUDES
+#include <pkgconf/system.h>
#include <stdlib.h>
#include <errno.h>
#include <limits.h>
@@ -166,8 +167,12 @@ test( CYG_ADDRWORD data )
"strtol() function");
} // test()
+#ifndef CYGPKG_LIBC_STARTUP
+void cyg_user_start(void)
+#else
int
-main(int argc, char *argv[])
+main( int argc, char *argv[] )
+#endif
{
CYG_TEST_INIT();
Index: tests/strtoul.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdlib/current/tests/strtoul.c,v
retrieving revision 1.3
diff -u -p -r1.3 strtoul.c
--- tests/strtoul.c 23 May 2002 23:07:23 -0000 1.3
+++ tests/strtoul.c 28 Jan 2009 14:45:35 -0000
@@ -50,6 +50,7 @@
// INCLUDES
+#include <pkgconf/system.h>
#include <stdlib.h>
#include <errno.h>
#include <limits.h>
@@ -162,8 +163,12 @@ test( CYG_ADDRWORD data )
"strtoul() function");
} // test()
+#ifndef CYGPKG_LIBC_STARTUP
+void cyg_user_start(void)
+#else
int
-main(int argc, char *argv[])
+main( int argc, char *argv[] )
+#endif
{
CYG_TEST_INIT();