Fix some llvm-gcc warnings in testcases, mostly by adding includes or adding
declarations. These are the fixes that I was pretty confident about, there are
still a lot of other llvm-gcc warnings of which I'm not sure if they can be
safely ignored or fixed, without breaking the test case.

This fixes 11 testcases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52176 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/FrontendC++/2005-02-11-AnonymousUnion.cpp b/test/FrontendC++/2005-02-11-AnonymousUnion.cpp
index b0ff7e7..87ababc 100644
--- a/test/FrontendC++/2005-02-11-AnonymousUnion.cpp
+++ b/test/FrontendC++/2005-02-11-AnonymousUnion.cpp
@@ -21,7 +21,7 @@
 }
 
 // Make sure that normal unions work.  duh :)
-volatile union {
+volatile union U_t {
   short S;
   int i;
 } U;
diff --git a/test/FrontendC/2002-02-18-64bitConstant.c b/test/FrontendC/2002-02-18-64bitConstant.c
index 6fd3e29..31e5c6e 100644
--- a/test/FrontendC/2002-02-18-64bitConstant.c
+++ b/test/FrontendC/2002-02-18-64bitConstant.c
@@ -2,7 +2,9 @@
 
 /* GCC wasn't handling 64 bit constants right fixed */
 
-void main() {
+#include <stdio.h>
+
+int main() {
   long long Var = 123455678902ll;
   printf("%lld\n", Var);
 }
diff --git a/test/FrontendC/2002-04-08-LocalArray.c b/test/FrontendC/2002-04-08-LocalArray.c
index af6ebd6..75475a1 100644
--- a/test/FrontendC/2002-04-08-LocalArray.c
+++ b/test/FrontendC/2002-04-08-LocalArray.c
@@ -3,7 +3,7 @@
 /* GCC is not outputting the static array to the LLVM backend, so bad things
  * happen.  Note that if this is defined static, everything seems fine.
  */
-void test(unsigned X) {
+double test(unsigned X) {
   double student_t[30]={0.0 , 12.706 , 4.303 , 3.182 , 2.776 , 2.571 ,
                                2.447 , 2.365 , 2.306 , 2.262 , 2.228 ,
                                2.201 , 2.179 , 2.160 , 2.145 , 2.131 ,
diff --git a/test/FrontendC/2002-08-02-UnionTest.c b/test/FrontendC/2002-08-02-UnionTest.c
index bc44e46..e0862ed 100644
--- a/test/FrontendC/2002-08-02-UnionTest.c
+++ b/test/FrontendC/2002-08-02-UnionTest.c
@@ -13,7 +13,7 @@
   return Global;
 }
 
-void main() {
+int main() {
   union X test = foo();
   printf("0x%p", test.B);
 }
diff --git a/test/FrontendC/2003-10-02-UnionLValueError.c b/test/FrontendC/2003-10-02-UnionLValueError.c
index 732f93a..2ded0c6 100644
--- a/test/FrontendC/2003-10-02-UnionLValueError.c
+++ b/test/FrontendC/2003-10-02-UnionLValueError.c
@@ -1,5 +1,7 @@
 // RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
 
+#include <stdio.h>
+
 union U{
   int i[8];
   char s[80];
diff --git a/test/FrontendC/2004-02-13-Memset.c b/test/FrontendC/2004-02-13-Memset.c
index 89ab9b9..423108b 100644
--- a/test/FrontendC/2004-02-13-Memset.c
+++ b/test/FrontendC/2004-02-13-Memset.c
@@ -1,5 +1,7 @@
 // RUN: %llvmgcc -xc %s -c -o - | llvm-dis | grep llvm.memset | count 3
 
+#include <memory.h>
+
 void test(int* X, char *Y) {
   memset(X, 4, 1000);
   bzero(Y, 100);
diff --git a/test/FrontendC/2004-02-20-Builtins.c b/test/FrontendC/2004-02-20-Builtins.c
index 82b7dc1..0c9ac7c 100644
--- a/test/FrontendC/2004-02-20-Builtins.c
+++ b/test/FrontendC/2004-02-20-Builtins.c
@@ -1,5 +1,7 @@
 // RUN: %llvmgcc -O3 -xc %s -c -o - | llvm-dis | not grep builtin
 
+#include <math.h>
+
 void zsqrtxxx(float num) {
    num = sqrt(num);
 }
diff --git a/test/FrontendC/2005-07-20-SqrtNoErrno.c b/test/FrontendC/2005-07-20-SqrtNoErrno.c
index fd976a6..3f85f72 100644
--- a/test/FrontendC/2005-07-20-SqrtNoErrno.c
+++ b/test/FrontendC/2005-07-20-SqrtNoErrno.c
@@ -1,4 +1,4 @@
-// RUN: %llvmgcc %s -S -o - -fno-math-errno | gccas | llvm-dis | grep llvm.sqrt
+// RUN: %llvmgcc %s -S -o - -fno-math-errno | grep llvm.sqrt
 #include <math.h>
 
 float foo(float X) {
diff --git a/test/FrontendC/2005-10-18-VariableSizedElementCrash.c b/test/FrontendC/2005-10-18-VariableSizedElementCrash.c
index 867e4d2..b916662 100644
--- a/test/FrontendC/2005-10-18-VariableSizedElementCrash.c
+++ b/test/FrontendC/2005-10-18-VariableSizedElementCrash.c
@@ -2,7 +2,7 @@
 
 int sub1(int i, char *pi) {
   typedef int foo[i];
-  struct bar {foo f1; int f2:3; int f3:4} *p = (struct bar *) pi;
+  struct bar {foo f1; int f2:3; int f3:4;} *p = (struct bar *) pi;
   xxx(p->f1);  
   return p->f3;
 }
diff --git a/test/FrontendC/2007-09-27-ComplexIntCompare.c b/test/FrontendC/2007-09-27-ComplexIntCompare.c
index ee9a85c..50626e5 100644
--- a/test/FrontendC/2007-09-27-ComplexIntCompare.c
+++ b/test/FrontendC/2007-09-27-ComplexIntCompare.c
@@ -1,5 +1,8 @@
 // RUN: %llvmgcc -S %s -o -  
 // PR1708
+
+#include <stdlib.h>
+
 struct s { _Complex unsigned short x; };
 struct s gs = { 100 + 200i };
 struct s __attribute__((noinline)) foo (void) { return gs; }
diff --git a/test/FrontendC/libcalls.c b/test/FrontendC/libcalls.c
index c027ea4..648dc6f 100644
--- a/test/FrontendC/libcalls.c
+++ b/test/FrontendC/libcalls.c
@@ -4,6 +4,8 @@
 // RUN: %llvmgcc %s -S -emit-llvm -O1 -o - | grep {call.*ldexp}
 // RUN: %llvmgcc %s -S -emit-llvm -O3 -fno-builtin -o - | grep {call.*exp2f}
 
+float exp2f(float);
+
 float t4(unsigned char x) {
   return exp2f(x);
 }