diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2004-04-15 12:22:19 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2004-04-15 12:22:19 (GMT) |
commit | fad91fb77038a243711677e904314ff0f283a68c (patch) | |
tree | 89337a6d28353128b27da9115ac1452d50907b91 /Modules | |
parent | c7a42a1b1f633d89d1d80d8b2703202b0827724e (diff) | |
download | CMake-fad91fb77038a243711677e904314ff0f283a68c.zip CMake-fad91fb77038a243711677e904314ff0f283a68c.tar.gz CMake-fad91fb77038a243711677e904314ff0f283a68c.tar.bz2 |
ENH: fix tests for non-ansi c on hp and remove warnings for ansi c
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CheckForPthreads.c | 11 | ||||
-rw-r--r-- | Modules/CheckFunctionExists.c | 17 | ||||
-rw-r--r-- | Modules/CheckTypeSize.c | 10 | ||||
-rw-r--r-- | Modules/CheckVariableExists.c | 10 | ||||
-rw-r--r-- | Modules/TestBigEndian.c | 16 |
5 files changed, 43 insertions, 21 deletions
diff --git a/Modules/CheckForPthreads.c b/Modules/CheckForPthreads.c index 0f57245..2f0c203 100644 --- a/Modules/CheckForPthreads.c +++ b/Modules/CheckForPthreads.c @@ -5,8 +5,13 @@ void* runner(void*); int res = 0; -int main() -{ +#ifdef __CLASSIC_C__ +int main(){ + int ac; + char*av[]; +#else +int main(int ac, char*av[]){ +#endif pthread_t tid[2]; pthread_create(&tid[0], 0, runner, (void*)1); pthread_create(&tid[1], 0, runner, (void*)2); @@ -14,7 +19,7 @@ int main() usleep(1); // for strange behavior on single-processor sun pthread_join(tid[0], 0); pthread_join(tid[1], 0); - + if(ac > 1000){return *av[0];} return res; } diff --git a/Modules/CheckFunctionExists.c b/Modules/CheckFunctionExists.c index e064c09..607b3e8 100644 --- a/Modules/CheckFunctionExists.c +++ b/Modules/CheckFunctionExists.c @@ -1,16 +1,19 @@ #ifdef CHECK_FUNCTION_EXISTS char CHECK_FUNCTION_EXISTS(); - -int main(int ac, char*av[]) -{ - int ret = 0; +#ifdef __CLASSIC_C__ +int main(){ + int ac; + char*av[]; +#else +int main(int ac, char*av[]){ +#endif CHECK_FUNCTION_EXISTS(); - if(ac > 100) + if(ac > 1000) { - ret = *av[0]; + return *av[0]; } - return ret; + return 0; } #else /* CHECK_FUNCTION_EXISTS */ diff --git a/Modules/CheckTypeSize.c b/Modules/CheckTypeSize.c index 43de439..f814289 100644 --- a/Modules/CheckTypeSize.c +++ b/Modules/CheckTypeSize.c @@ -8,8 +8,14 @@ # include <stdint.h> #endif /* HAVE_STDINT_H */ -int main() -{ +#ifdef __CLASSIC_C__ +int main(){ + int ac; + char*av[]; +#else +int main(int ac, char*av[]){ +#endif + if(ac > 1000){return *av[0];} return sizeof(CHECK_TYPE_SIZE_TYPE); } diff --git a/Modules/CheckVariableExists.c b/Modules/CheckVariableExists.c index e4d1e8d..419c1b0 100644 --- a/Modules/CheckVariableExists.c +++ b/Modules/CheckVariableExists.c @@ -2,10 +2,16 @@ extern int CHECK_VARIABLE_EXISTS; -int main() -{ +#ifdef __CLASSIC_C__ +int main(){ + int ac; + char*av[]; +#else +int main(int ac, char*av[]){ +#endif int* p; p = &CHECK_VARIABLE_EXISTS; + if(ac > 1000){return *av[0];} return 0; } diff --git a/Modules/TestBigEndian.c b/Modules/TestBigEndian.c index 97647ed..db08ceb 100644 --- a/Modules/TestBigEndian.c +++ b/Modules/TestBigEndian.c @@ -1,5 +1,10 @@ -int main (int ac, char*av[]) { - int ret = 1; +#ifdef __CLASSIC_C__ +int main(){ + int ac; + char*av[]; +#else +int main(int ac, char*av[]){ +#endif /* Are we little or big endian? From Harbison&Steele. */ union { @@ -7,9 +12,6 @@ int main (int ac, char*av[]) { char c[sizeof (long)]; } u; u.l = 1; - if(ac > 100) - { - ret = *av[0]; - } - return (u.c[sizeof (long) - 1] == 1)?ret:0; + if(ac > 1000){return *av[0];} + return (u.c[sizeof (long) - 1] == 1)?1:0; } |