ENH: fix tests for non-ansi c on hp and remove warnings for ansi c

This commit is contained in:
Bill Hoffman 2004-04-15 08:22:19 -04:00
parent c7a42a1b1f
commit fad91fb770
5 changed files with 43 additions and 21 deletions

View File

@ -5,8 +5,13 @@
void* runner(void*); void* runner(void*);
int res = 0; 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_t tid[2];
pthread_create(&tid[0], 0, runner, (void*)1); pthread_create(&tid[0], 0, runner, (void*)1);
pthread_create(&tid[1], 0, runner, (void*)2); pthread_create(&tid[1], 0, runner, (void*)2);
@ -14,7 +19,7 @@ int main()
usleep(1); // for strange behavior on single-processor sun usleep(1); // for strange behavior on single-processor sun
pthread_join(tid[0], 0); pthread_join(tid[0], 0);
pthread_join(tid[1], 0); pthread_join(tid[1], 0);
if(ac > 1000){return *av[0];}
return res; return res;
} }

View File

@ -1,16 +1,19 @@
#ifdef CHECK_FUNCTION_EXISTS #ifdef CHECK_FUNCTION_EXISTS
char CHECK_FUNCTION_EXISTS(); char CHECK_FUNCTION_EXISTS();
#ifdef __CLASSIC_C__
int main(int ac, char*av[]) int main(){
{ int ac;
int ret = 0; char*av[];
#else
int main(int ac, char*av[]){
#endif
CHECK_FUNCTION_EXISTS(); CHECK_FUNCTION_EXISTS();
if(ac > 100) if(ac > 1000)
{ {
ret = *av[0]; return *av[0];
} }
return ret; return 0;
} }
#else /* CHECK_FUNCTION_EXISTS */ #else /* CHECK_FUNCTION_EXISTS */

View File

@ -8,8 +8,14 @@
# include <stdint.h> # include <stdint.h>
#endif /* HAVE_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); return sizeof(CHECK_TYPE_SIZE_TYPE);
} }

View File

@ -2,10 +2,16 @@
extern int CHECK_VARIABLE_EXISTS; 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; int* p;
p = &CHECK_VARIABLE_EXISTS; p = &CHECK_VARIABLE_EXISTS;
if(ac > 1000){return *av[0];}
return 0; return 0;
} }

View File

@ -1,5 +1,10 @@
int main (int ac, char*av[]) { #ifdef __CLASSIC_C__
int ret = 1; int main(){
int ac;
char*av[];
#else
int main(int ac, char*av[]){
#endif
/* Are we little or big endian? From Harbison&Steele. */ /* Are we little or big endian? From Harbison&Steele. */
union union
{ {
@ -7,9 +12,6 @@ int main (int ac, char*av[]) {
char c[sizeof (long)]; char c[sizeof (long)];
} u; } u;
u.l = 1; u.l = 1;
if(ac > 100) if(ac > 1000){return *av[0];}
{ return (u.c[sizeof (long) - 1] == 1)?1:0;
ret = *av[0];
}
return (u.c[sizeof (long) - 1] == 1)?ret:0;
} }