Fix some llvm-gcc warnings in testcases, mostly by adding includes or adding
authorMatthijs Kooijman <matthijs@stdin.nl>
Tue, 10 Jun 2008 14:37:44 +0000 (14:37 +0000)
committerMatthijs Kooijman <matthijs@stdin.nl>
Tue, 10 Jun 2008 14:37:44 +0000 (14:37 +0000)
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

test/FrontendC++/2005-02-11-AnonymousUnion.cpp
test/FrontendC/2002-02-18-64bitConstant.c
test/FrontendC/2002-04-08-LocalArray.c
test/FrontendC/2002-08-02-UnionTest.c
test/FrontendC/2003-10-02-UnionLValueError.c
test/FrontendC/2004-02-13-Memset.c
test/FrontendC/2004-02-20-Builtins.c
test/FrontendC/2005-07-20-SqrtNoErrno.c
test/FrontendC/2005-10-18-VariableSizedElementCrash.c
test/FrontendC/2007-09-27-ComplexIntCompare.c
test/FrontendC/libcalls.c

index b0ff7e7507588a073a2819dc00821620385072b7..87ababc5f183a1aa2d81d1cd5641d00c110a2c59 100644 (file)
@@ -21,7 +21,7 @@ int test2(short F) {
 }
 
 // Make sure that normal unions work.  duh :)
-volatile union {
+volatile union U_t {
   short S;
   int i;
 } U;
index 6fd3e29d24299cc32ab9744bc8c028911a802fa1..31e5c6eada4bd605c8531ece8712307d72bcf79a 100644 (file)
@@ -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);
 }
index af6ebd6bdf9082eef5082aff6aec29a35efe1905..75475a1b3bd11e65b34b14dacc866d53549f3cd0 100644 (file)
@@ -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 ,
index bc44e461dec5119b7be84159c2bb0b19a095895f..e0862ed10cf6b2e1b84b77564c9bc8d09ad29755 100644 (file)
@@ -13,7 +13,7 @@ union X foo() {
   return Global;
 }
 
-void main() {
+int main() {
   union X test = foo();
   printf("0x%p", test.B);
 }
index 732f93a77311798bbeb3369bfa3fa7f3ad802838..2ded0c64b42e0b0a535776d328212c3105707d27 100644 (file)
@@ -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];
index 89ab9b9e4c064c3572de137874feecd986264485..423108b44754c2d90cbd73842bdcd953ccf483be 100644 (file)
@@ -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);
index 82b7dc1f34cb97ae9898a9c5efa36dd25b47b58d..0c9ac7cae8afb3c444e0e749c3eedf34e2ec3570 100644 (file)
@@ -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);
 }
index fd976a679331167bbb7b3971293a7e7c38d2698a..3f85f7280196c36d7695ae895d23b1cdf7e63eda 100644 (file)
@@ -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) {
index 867e4d285e60793e498571171766bb5f608b7dde..b9166621db4a86f66aa16cc5d47f2fd7cf7a262b 100644 (file)
@@ -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;
 }
index ee9a85c2454d1a273f2fc460ada2b94ffccf1a5e..50626e548c6166701cd1eccf772c483b818f6538 100644 (file)
@@ -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; }
index c027ea4125e69a770b0645c6677c05c9d4a7d57c..648dc6f72262e006c228564566b0e1de41365c22 100644 (file)
@@ -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);
 }