fixed lots of warnings in testprograms
[libfirm] / ir / be / test / XXEndless.c
1 #include <stdio.h>
2 #include <stdlib.h>
3
4
5 #define true    1
6
7 static int loop = 2;
8 static int quiet = 1;
9
10 static void nop(void) {}
11
12 static int me1(int num) {
13     int i = 0;
14
15     if (num == 1) {
16         printf("Going into endless loop 1 \n .... \n ");
17         while(7 > 2) {
18             if(!quiet)
19                 printf("%d\n", i++);
20         }
21     } else {
22         num ++;
23     }
24     return num;
25 }
26
27 static void me2(int num) {
28     int i = 0;
29
30     if (num != 2) {
31         nop();
32     } else {
33         printf("Going into endless loop 2 \n .... \n ");
34         while(true) {
35             if(!quiet)
36                 printf("%d\n", i++);
37         }
38     }
39 }
40
41 static void me3(int num) {
42     int i = 0;
43
44     printf("Going into endless loop 3 \n .... \n ");
45     while(true) {
46         if(!quiet)
47             printf("%d\n", i++);
48     }
49 }
50
51 int main(int argc, char *argv[]) {
52     printf("XXEndless.c\n");
53     if (argc != 2) {
54                 printf("\nUsage: Endless n, where n determines the loop.\n");
55                 printf("Continuing with default input.\n");
56                 return 0;
57     } else {
58                 loop = atoi(argv[1]);
59         quiet = 0;
60     }
61     me1(loop);
62     me2(loop);
63     me3(loop);
64 }