fixed lots of warnings in testprograms
authorMatthias Braun <matze@braunis.de>
Mon, 2 Jul 2007 13:48:35 +0000 (13:48 +0000)
committerMatthias Braun <matze@braunis.de>
Mon, 2 Jul 2007 13:48:35 +0000 (13:48 +0000)
[r14882]

38 files changed:
ir/be/test/Arrays.c
ir/be/test/Field.c
ir/be/test/ForTest.c
ir/be/test/GlobalCseTest.c
ir/be/test/HeapSort.c
ir/be/test/Local.c
ir/be/test/Pdg.c
ir/be/test/Queens.c
ir/be/test/Sieve.c
ir/be/test/Switcher.c
ir/be/test/ack/t7.c
ir/be/test/arr_init.c
ir/be/test/array_type.c
ir/be/test/bitfield.c
ir/be/test/compress95.c
ir/be/test/convtest.c
ir/be/test/dblstruct.c
ir/be/test/fehler10.c
ir/be/test/fehler11.c
ir/be/test/fehler14.c
ir/be/test/gcd.c
ir/be/test/harness.c
ir/be/test/kahansum.c
ir/be/test/nested_loops.c
ir/be/test/nested_loops2.c
ir/be/test/ns.c
ir/be/test/optest.h
ir/be/test/stmt_expr.c
ir/be/test/strenght_red.c
ir/be/test/struct.c
ir/be/test/switch_test.c
ir/be/test/trivial_add.c
ir/be/test/trivial_div.c
ir/be/test/trivial_max.c
ir/be/test/trivial_sum_upto.c
ir/be/test/trivial_two_times.c
ir/be/test/valist.c
ir/be/test/vandrunen.c

index 082e9ed..0e931a8 100644 (file)
@@ -1,4 +1,5 @@
 #include <stdio.h>
+#include <string.h>
 
 struct Arr2Object {
     int a[10];
@@ -36,7 +37,6 @@ static void pass_array_test(struct ArrObject *a, int a_len)
 int main(int argc, char *argv[]) {
   int i, j, bi;
   struct ArrObject ao[10];
-  struct ArrObject aob;
   struct Arr2Object a2o[2];
   struct Arr2Object a2;
 
index a78d668..7c2e667 100644 (file)
@@ -2,7 +2,7 @@
  * $Id$
  */
 
-//#include <stdio.h>
+#include <stdio.h>
 
 struct s {
   int a;
index 3ca67fb..945ab9f 100644 (file)
@@ -12,19 +12,8 @@ typedef int boolean;
 #define true   1
 #define false  0
 
-static void piff(void) {
-       int i, j, x, delta_x;
-
-       delta_x = 2;
-       j = 0;
-       x = 0;
-       for (i = 0, x = 0; i < 1000; i++, x += delta_x) {
-               j += x;
-       }
-}
-
 static int simpleloop (int a, int b) {
-       int i, j, delta_x, x;
+       int i, j;
        boolean loopfinal = true;
 
        for(i = 0; (i < 10) && loopfinal; i++) {
@@ -43,8 +32,6 @@ static int simpleloop (int a, int b) {
 }
 
 int main (int argc, char *argv[]) {
-       int i, j;
-
        printf("ForTest.c\n");
 
        simpleloop(3, 10);
index 237328c..a8d6213 100644 (file)
@@ -4,6 +4,7 @@
 // $Id$
 //
 // Testprogram to test GCC-firm : GlobalCseTest.c
+#include <stdio.h>
 
 int m(int a) {
     int b;
index 3879b78..a3c0826 100644 (file)
@@ -107,7 +107,7 @@ void heapaufbau2(int *a, int *b, int len) {
  * Heap-Methoden und gibt das sortierte Feld zurück.
  */
 int *heapsort(int *b, int len) {
-       int i, k;
+       int k;
        int *c;
        int *a;
 
index c978b66..50767a4 100644 (file)
@@ -1,3 +1,5 @@
+#include <stdio.h>
+
 //
 // GCC-firm Project
 //
index 238dda0..55de027 100644 (file)
@@ -12,6 +12,7 @@ int main(int argc, char *argv[]) {
   printf("Pdg.c\n");
 
   i = 1;
+  k = 0;
   while (i < 10) {
     j = i + 1;
     if (j == 7)
@@ -21,5 +22,6 @@ int main(int argc, char *argv[]) {
     i = i + 1;
   }
 
+  (void) k;
   return 0;
 }
index c0f4db5..f50bcfe 100644 (file)
@@ -38,43 +38,48 @@ boolean place_ok (int i) {
   int j = 0;
   boolean res;
 
+  printf("POK: %d\n", i);
+
   while (j < i) {
     if ((row[j] == row[i]) || ((myabs(row[i]-row[j])) == (i-j))) {
+               printf("F\n");
       res = false;
       return(res);
     }
     j = j+1;
   }
+  printf("T\n");
   res = true;
   return(res);
 }
 
 int solve (int n) {
-  // return the number of solutions to the n-queens problem
-  int c = 0;
-  int res = 0;
-
-  row = (void *)malloc(sizeof(*row) * n);
-  row[0] = -1;
-  while (c >= 0) {
-    row[c] = row[c]+1;
-    while ((row[c] < n) && (!place_ok(c))) {
-      row[c] = row[c]+1;
-    }
-    if (row[c] < n) { // successfully placed at (c,row[c])
-      if (c == n-1)
-       res = res+1;
-      else {
-       c = c+1;
-       row[c] = -1;
-      }
-    }
-    else // dead end, track back
-      c = c-1;
-  }
-  free(row);
-
-  return(res);
+       // return the number of solutions to the n-queens problem
+       int c = 0;
+       int res = 0;
+
+       row = (void *)malloc(sizeof(*row) * n);
+       row[0] = -1;
+       while (c >= 0) {
+               row[c] = row[c]+1;
+               while ((row[c] < n) && (!place_ok(c))) {
+                       row[c] = row[c]+1;
+               }
+               printf("RC: %d\n", row[c]);
+               if (row[c] < n) { // successfully placed at (c,row[c])
+                       if (c == n-1)
+                               res = res+1;
+                       else {
+                               c = c+1;
+                               row[c] = -1;
+                       }
+               }
+               else // dead end, track back
+                       c = c-1;
+       }
+       free(row);
+
+       return(res);
 }
 
 static void usage (const char *progname) {
index fb2e418..25c4213 100644 (file)
@@ -28,7 +28,7 @@ static void mark_count(int c) {
 static void runSieve(void) {
        int ITERATIONS = 100000;
        boolean *flags;
-       int i, prime, k, iter, p;
+       int i, prime, k;
        int iterations = 0;
        int count;
 
@@ -58,8 +58,6 @@ static void runSieve(void) {
 }
 
 int main(int argc, char *argv[]) {
-       int i;
-
        printf("Sieve.c\n");
 
        if (argc <= 1) {
index aee52de..cdecf7d 100644 (file)
@@ -15,10 +15,6 @@ static void print_int(int i) {
     printf(" %d\n", i);
 }
 
-static int id(int i) {
-  return(i);
-}
-
 // standard switch with 1 case
 static void switch1(int i) {
   switch(i) {
@@ -141,13 +137,14 @@ static void double_switch(int i) {
 
 int main (int argc, char *argv[]) {
   printf("Switcher.c\n");
-  printf(" must print:\n 0\n 2\n 0\n 3\n -1\n 2\n is 16\n multiple of 4\n\n");
+  printf(" must print:\n 0\n 2\n 0\n 3\n -1\n 2\n 5\n is 16\n multiple of 4\n\n");
   switch1(0);
   switch2(2);
   switch3(0);
   switch4(5);
   switch5(0);
   switch6(2);
+  switch7(3);
 
   double_switch(16);
   return 0;
index 69457f2..56648dd 100644 (file)
@@ -135,6 +135,7 @@ int n;
     itoa(t,cht);
     write(1,cht,strlen(cht));
     write(1,pp6,strlen(pp6));
+       abort();
 }
 
 
index fff9a7c..2c3f26f 100644 (file)
@@ -1,3 +1,5 @@
+#include <stdio.h>
+
 int arr0[] = { 0, 1, 2, 3 };
 int arr1[4] = { 3, 2, 1 };
 int arrm[3][4] = { {1}, {2,3,4,5}, {6, 7, 8 } };
index 6a6a508..668b02e 100644 (file)
@@ -1,3 +1,5 @@
+#include <stdio.h>
+
 int foo[255][4];
 
 int bar[4] = { 0, 1, 2, 3 };
index 5703c68..d92d0ca 100644 (file)
@@ -1,3 +1,5 @@
+#include <stdio.h>
+
 struct a {
        unsigned int i:1;
 };
index 3b3ed00..352db5e 100644 (file)
@@ -202,6 +202,7 @@ static char rcs_ident[] = "$Header$";
 
 #include <stdio.h>
 #include <ctype.h>
+#include <stdlib.h>
 #ifdef VMS
 #include <types.h>
 #include <stat.h>
@@ -355,8 +356,7 @@ unsigned char *OutBuff;
 
 spec_select_action(char* from_buf, int from_count, int action, char* to_buf)
 {
-    char *cp, *rindex(), *malloc();
-    struct stat statbuf;
+    char *rindex();
 #ifdef SYSV
     void onintr(), oops();
 #else
index f4a9730..3a32305 100644 (file)
@@ -12,7 +12,7 @@ int convtest_func(char c, short s, int i, float f, double d) {
        short is = s + i;
        short fs = s + f;
        short ds = s + d;
-        int ti = i + s;
+    //int ti = i + s;
        int fi = i + f;
        int di = i + d;
        float df = d + f;
index 706e65b..b59f399 100644 (file)
@@ -1,3 +1,5 @@
+#include <stdio.h>
+
 typedef struct TypeToken
 {
   int Handle;
index 6163e9d..fc39453 100644 (file)
@@ -1,3 +1,5 @@
+#include <stdio.h>
+
 void a(void);
 void b(void);
 
index 2412638..ab7b91d 100644 (file)
@@ -1,3 +1,5 @@
+#include <stdio.h>
+
 int main(void) {
 
        long long a = 0x0123456789012345;
index fc2e382..97be59b 100644 (file)
@@ -1,3 +1,5 @@
+#include <stdio.h>
+
 unsigned int c = 0xffffffff;
 unsigned short b;
 
index 2259c55..00d7645 100644 (file)
@@ -19,7 +19,7 @@ int gcd(int a, int b)
 
 int main(int argc, char** argv)
 {
-  int a = 49, b = 35, i, g;
+  int a = 49, b = 35, i, g = 0;
 
   if(argc > 2) {
       a = atoi(argv[1]);
index 4ea62e2..64f2ae7 100644 (file)
@@ -36,7 +36,6 @@ fill_text_buffer(int count, char start_char, char* text_buffer)
        long int total;         /* normalization */
        int i,j;                /* array indexers */
        char c1,c2;             /* character holders for level-three search */
-       int     writecount ;    /* Number of characters written */
        int     bufindex;
 
        /*
@@ -219,31 +218,31 @@ char      orig_text_buffer[BUFFERSIZE], comp_text_buffer[BUFFERSIZE], new_text_buffer
 int main(int argc, char *argv[])
 
 {
-int count, i, oper;
-int comp_count, new_count;
+int count, i;
+int new_count;
 char   start_char;
-int N;
-char C;
+int comp_count = 0;
 
        printf("SPEC 129.compress harness\n");
-        // for now...
-        return 0;
 
-       scanf("%i       %c      %li", &count, &start_char, &seedi);
+       //scanf("%i     %c      %li", &count, &start_char, &seedi);
+       count = 10;
+       start_char=10;
+       seedi = 12345;
        printf("Initial File Size:%i    Start character:%c\n", count, start_char, seedi);
        fill_text_buffer(count, start_char, orig_text_buffer);
        for (i = 1; i <= 25; i++)
        {
          new_count=add_line(orig_text_buffer, count, i, start_char);
          count=new_count;
-         oper=COMPRESS;
+         //oper=COMPRESS;
          printf("The starting size is: %d\n", count);
          //comp_count=spec_select_action(orig_text_buffer, count, oper, comp_text_buffer);
          printf("The compressed size is: %d\n", comp_count);
-         oper=UNCOMPRESS;
+         //oper=UNCOMPRESS;
          //new_count=spec_select_action(comp_text_buffer, comp_count, oper, new_text_buffer);
          printf("The compressed/uncompressed size is: %d\n", new_count);
-         compare_buffer(orig_text_buffer, count, new_text_buffer, new_count);
+         //compare_buffer(orig_text_buffer, count, new_text_buffer, new_count);
        }
 /* Remove comments for Debugging */
 /*
index 79d6744..d02c5a6 100644 (file)
@@ -1,3 +1,5 @@
+#include <stdio.h>
+
 float kahanSum(const float A[], int n) {
        float sum = 0.0, C = 0.0, Y, T;
        int i;
index 685054b..300eefa 100644 (file)
@@ -1,7 +1,11 @@
+#include <stdio.h>
+
+int k = 0;
+
 static void
 send_via_write()
     {
-      int r2, fd;
+      int r2 = k, fd;
     if ( r2 <= 2147483647 )
        {
        }
index 40781d3..ad805cb 100644 (file)
@@ -1,6 +1,10 @@
+#include <stdio.h>
+
+int k = 0;
+
 static void
 send_via_write() {
-  int r2;
+  int r2 = k;
   if ( r2 <= 2147483647 )
   {
   }
index f727bbf..a6306c8 100644 (file)
@@ -1,3 +1,5 @@
+#include <stdio.h>
+
 #define MAX_OPERANDS 3
 
 typedef unsigned short uint16_t;
index e36cdc5..67428b9 100644 (file)
@@ -1,3 +1,5 @@
+#include <string.h>
+
 #ifndef TESTANZ
 #define TESTANZ 21
 #define IMM         23
@@ -5,8 +7,8 @@
 #define        test16_1        42
 #define        test16_2        11
 #define test16_shift 7
-#define        test32_1        0x001200AB
-#define        test32_2        0x00341501
+#define        test32_1        (T) 0x001200AB
+#define        test32_2        (T) 0x00341501
 #define test32_shift 5
 #define test32_s    7
 #endif
index 2c439ba..ffffbf6 100644 (file)
@@ -1,3 +1,5 @@
+#include <stdio.h>
+
 #define maxint(a,b) \
        ({int _a = (a), _b = (b); _a > _b ? _a : _b; })
 
index 0bc9cd0..7ac1bf3 100644 (file)
@@ -1,3 +1,5 @@
+#include <stdio.h>
+
 int main()
 {
   int i;
index 517ea8b..5559ece 100644 (file)
@@ -1,4 +1,4 @@
-//#include <stdio.h>
+#include <stdio.h>
 
 struct A {
   int x;
index bb3869c..d1c7f97 100644 (file)
@@ -1,3 +1,5 @@
+#include <stdio.h>
+
 int test(int a)
 {
   int b = 0xff;
index a4fc8c9..80ec2f6 100644 (file)
@@ -1,3 +1,5 @@
+#include <stdio.h>
+
 /*
  * Proj's of the arguments
  * Simple DF node.
index b043382..4661755 100644 (file)
@@ -1,3 +1,4 @@
+#include <stdio.h>
 
 /*
  * Proj out of DF node
index c2aaf3e..2e0acb6 100644 (file)
@@ -1,3 +1,4 @@
+#include <stdio.h>
 
 /*
  * Control flow divertion in an if statement.
index 5f72606..6c57225 100644 (file)
@@ -1,3 +1,4 @@
+#include <stdio.h>
 
 /*
  * A simple loop
index 4eb6c42..ed949cd 100644 (file)
@@ -1,3 +1,5 @@
+#include <stdio.h>
+
 /*
  * Proj's of the arguments
  * Simple DF node.
index da9c357..a75c0b5 100644 (file)
@@ -1,3 +1,5 @@
+#include <stdio.h>
+
 #ifdef __GNUC__
 #define va_start(v,l)  __builtin_va_start(v,l)
 #define va_end(v)      __builtin_va_end(v)
index a81a3d6..3012e66 100644 (file)
@@ -1,3 +1,5 @@
+#include <stdio.h>
+
 int T6, T10, T13;
 
 /*