From: Ulrich Weigand Date: Wed, 24 Oct 2012 12:22:56 +0000 (+0000) Subject: A number of test cases assume that an "int" parameter or return value X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=923099773fe4bbc52a25a5d3d92236b5e37cef93;p=clang A number of test cases assume that an "int" parameter or return value will be represented in the IR as a plain "i32" type. This causes the tests to spuriously fail on platforms where int is not a 32-bit type, or where the ABI requires attributes like "signext" or "zeroext" to be used. This patch adds -triple or -target parameters to force those tests to use the i386-unknown-unknown target. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166551 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/CodeGen/PR3589-freestanding-libcalls.c b/test/CodeGen/PR3589-freestanding-libcalls.c index 8b8282fb80..40e5fb1121 100644 --- a/test/CodeGen/PR3589-freestanding-libcalls.c +++ b/test/CodeGen/PR3589-freestanding-libcalls.c @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -emit-llvm %s -o - | grep 'declare i32 @printf' | count 1 -// RUN: %clang_cc1 -O2 -emit-llvm %s -o - | grep 'declare i32 @puts' | count 1 -// RUN: %clang_cc1 -ffreestanding -O2 -emit-llvm %s -o - | grep 'declare i32 @puts' | count 0 +// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm %s -o - | grep 'declare i32 @printf' | count 1 +// RUN: %clang_cc1 -triple i386-unknown-unknown -O2 -emit-llvm %s -o - | grep 'declare i32 @puts' | count 1 +// RUN: %clang_cc1 -triple i386-unknown-unknown -ffreestanding -O2 -emit-llvm %s -o - | grep 'declare i32 @puts' | count 0 int printf(const char *, ...); diff --git a/test/CodeGen/decl-in-prototype.c b/test/CodeGen/decl-in-prototype.c index 949793da44..2c0fc4fc3b 100644 --- a/test/CodeGen/decl-in-prototype.c +++ b/test/CodeGen/decl-in-prototype.c @@ -1,4 +1,4 @@ -// RUN: %clang -emit-llvm -S -o - %s | FileCheck %s +// RUN: %clang -target i386-unknown-unknown -emit-llvm -S -o - %s | FileCheck %s const int AA = 5; diff --git a/test/CodeGen/extern-inline.c b/test/CodeGen/extern-inline.c index e3df9968bf..77cb270191 100644 --- a/test/CodeGen/extern-inline.c +++ b/test/CodeGen/extern-inline.c @@ -1,5 +1,5 @@ -// RUN: %clang -S -emit-llvm -std=gnu89 -o - %s | FileCheck %s -// RUN: %clang -S -emit-llvm -fgnu89-inline -o - %s | FileCheck %s +// RUN: %clang -target i386-unknown-unknown -S -emit-llvm -std=gnu89 -o - %s | FileCheck %s +// RUN: %clang -target i386-unknown-unknown -S -emit-llvm -fgnu89-inline -o - %s | FileCheck %s // PR5253 // If an extern inline function is redefined, functions should call the diff --git a/test/CodeGen/inline.c b/test/CodeGen/inline.c index 2a01f255dc..addb30bde4 100644 --- a/test/CodeGen/inline.c +++ b/test/CodeGen/inline.c @@ -1,5 +1,5 @@ // RUN: echo "GNU89 tests:" -// RUN: %clang %s -O1 -emit-llvm -S -o %t -std=gnu89 +// RUN: %clang %s -target i386-unknown-unknown -O1 -emit-llvm -S -o %t -std=gnu89 // RUN: grep "define available_externally i32 @ei()" %t // RUN: grep "define i32 @foo()" %t // RUN: grep "define i32 @bar()" %t @@ -21,7 +21,7 @@ // RUN: grep "define void @testC" %t // RUN: echo "C99 tests:" -// RUN: %clang %s -O1 -emit-llvm -S -o %t -std=gnu99 +// RUN: %clang %s -target i386-unknown-unknown -O1 -emit-llvm -S -o %t -std=gnu99 // RUN: grep "define i32 @ei()" %t // RUN: grep "define available_externally i32 @foo()" %t // RUN: grep "define i32 @bar()" %t @@ -43,7 +43,7 @@ // RUN: grep "define void @testC" %t // RUN: echo "C++ tests:" -// RUN: %clang -x c++ %s -O1 -emit-llvm -S -o %t -std=c++98 +// RUN: %clang -x c++ %s -target i386-unknown-unknown -O1 -emit-llvm -S -o %t -std=c++98 // RUN: grep "define linkonce_odr i32 @_Z2eiv()" %t // RUN: grep "define linkonce_odr i32 @_Z3foov()" %t // RUN: grep "define i32 @_Z3barv()" %t diff --git a/test/CodeGen/unwind-attr.c b/test/CodeGen/unwind-attr.c index c588ca8e1b..7a79cb6047 100644 --- a/test/CodeGen/unwind-attr.c +++ b/test/CodeGen/unwind-attr.c @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fexceptions -emit-llvm -o - %s | FileCheck %s -// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck -check-prefix NOEXC %s +// RUN: %clang_cc1 -triple i386-unknown-unknown -fexceptions -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -o - %s | FileCheck -check-prefix NOEXC %s int opaque(); diff --git a/test/CodeGenCXX/2009-05-04-PureConstNounwind.cpp b/test/CodeGenCXX/2009-05-04-PureConstNounwind.cpp index 8361680546..7acc07d0c5 100644 --- a/test/CodeGenCXX/2009-05-04-PureConstNounwind.cpp +++ b/test/CodeGenCXX/2009-05-04-PureConstNounwind.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fexceptions -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple i386-unknown-unknown -fexceptions -emit-llvm %s -o - | FileCheck %s int c(void) __attribute__((const)); int p(void) __attribute__((pure)); int t(void); diff --git a/test/CodeGenCXX/cxx0x-delegating-ctors.cpp b/test/CodeGenCXX/cxx0x-delegating-ctors.cpp index ad6492f5bf..338159cd82 100644 --- a/test/CodeGenCXX/cxx0x-delegating-ctors.cpp +++ b/test/CodeGenCXX/cxx0x-delegating-ctors.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -emit-llvm -fexceptions -fcxx-exceptions -std=c++11 -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -fexceptions -fcxx-exceptions -std=c++11 -o - %s | FileCheck %s struct non_trivial { non_trivial(); diff --git a/test/CodeGenCXX/cxx0x-initializer-array.cpp b/test/CodeGenCXX/cxx0x-initializer-array.cpp index b773178e6b..df689978a8 100644 --- a/test/CodeGenCXX/cxx0x-initializer-array.cpp +++ b/test/CodeGenCXX/cxx0x-initializer-array.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++11 -S -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple i386-unknown-unknown -std=c++11 -S -emit-llvm -o - %s | FileCheck %s struct A { int a[1]; }; typedef A x[]; diff --git a/test/CodeGenCXX/devirtualize-virtual-function-calls-final.cpp b/test/CodeGenCXX/devirtualize-virtual-function-calls-final.cpp index 634bf84b41..ab781da56d 100644 --- a/test/CodeGenCXX/devirtualize-virtual-function-calls-final.cpp +++ b/test/CodeGenCXX/devirtualize-virtual-function-calls-final.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++11 %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -triple i386-unknown-unknown -std=c++11 %s -emit-llvm -o - | FileCheck %s namespace Test1 { struct A { diff --git a/test/CodeGenCXX/mangle-extern-local.cpp b/test/CodeGenCXX/mangle-extern-local.cpp index ed91da4e2e..1394c8f2a1 100644 --- a/test/CodeGenCXX/mangle-extern-local.cpp +++ b/test/CodeGenCXX/mangle-extern-local.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple i386-unknown-unknown -emit-llvm -o - | FileCheck %s // CHECK: @var1 = external global i32 // CHECK: @_ZN1N4var2E = external global i32 diff --git a/test/CodeGenCXX/member-init-assignment.cpp b/test/CodeGenCXX/member-init-assignment.cpp index 84c4a36fe2..acc7084670 100644 --- a/test/CodeGenCXX/member-init-assignment.cpp +++ b/test/CodeGenCXX/member-init-assignment.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple i386-unknown-unknown -emit-llvm -o - | FileCheck %s // PR7291 struct Foo { diff --git a/test/CodeGenCXX/nrvo.cpp b/test/CodeGenCXX/nrvo.cpp index 2feaf68241..8ff7dd7d09 100644 --- a/test/CodeGenCXX/nrvo.cpp +++ b/test/CodeGenCXX/nrvo.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -emit-llvm -O1 -o - %s | FileCheck %s -// RUN: %clang_cc1 -emit-llvm -O1 -fcxx-exceptions -fexceptions -o - %s | FileCheck --check-prefix=CHECK-EH %s +// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -O1 -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -O1 -fcxx-exceptions -fexceptions -o - %s | FileCheck --check-prefix=CHECK-EH %s // Test code generation for the named return value optimization. class X { diff --git a/test/CodeGenCXX/pr12251.cpp b/test/CodeGenCXX/pr12251.cpp index a9920c0733..f3f2ec417e 100644 --- a/test/CodeGenCXX/pr12251.cpp +++ b/test/CodeGenCXX/pr12251.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 %s -emit-llvm -O1 -relaxed-aliasing -fstrict-enums -std=c++11 -o - | FileCheck %s -// RUN: %clang_cc1 %s -emit-llvm -O1 -relaxed-aliasing -std=c++11 -o - | FileCheck --check-prefix=NO-STRICT-ENUMS %s +// RUN: %clang_cc1 %s -triple i386-unknown-unknown -emit-llvm -O1 -relaxed-aliasing -fstrict-enums -std=c++11 -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple i386-unknown-unknown -emit-llvm -O1 -relaxed-aliasing -std=c++11 -o - | FileCheck --check-prefix=NO-STRICT-ENUMS %s bool f(bool *x) { return *x; diff --git a/test/CodeGenCXX/pragma-visibility.cpp b/test/CodeGenCXX/pragma-visibility.cpp index 11a38c1d5f..0640d4244e 100644 --- a/test/CodeGenCXX/pragma-visibility.cpp +++ b/test/CodeGenCXX/pragma-visibility.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -o - %s | FileCheck %s #pragma GCC visibility push(hidden) struct x { diff --git a/test/CodeGenCXX/switch-case-folding-2.cpp b/test/CodeGenCXX/switch-case-folding-2.cpp index 7c0283fa2a..930bfeb64d 100644 --- a/test/CodeGenCXX/switch-case-folding-2.cpp +++ b/test/CodeGenCXX/switch-case-folding-2.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s // CHECK that we don't crash. extern int printf(const char*, ...); diff --git a/test/CodeGenCXX/thunk-linkonce-odr.cpp b/test/CodeGenCXX/thunk-linkonce-odr.cpp index 4f4d61d5a9..82f2148e0b 100644 --- a/test/CodeGenCXX/thunk-linkonce-odr.cpp +++ b/test/CodeGenCXX/thunk-linkonce-odr.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple i386-unknown-unknown -emit-llvm -o - | FileCheck %s // & struct A { diff --git a/test/CodeGenCXX/virtual-operator-call.cpp b/test/CodeGenCXX/virtual-operator-call.cpp index 42d38e55a0..72d49c2300 100644 --- a/test/CodeGenCXX/virtual-operator-call.cpp +++ b/test/CodeGenCXX/virtual-operator-call.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple i386-unknown-unknown -emit-llvm -o - | FileCheck %s struct A { virtual int operator-() = 0; diff --git a/test/CodeGenCXX/visibility-inlines-hidden.cpp b/test/CodeGenCXX/visibility-inlines-hidden.cpp index bf18020cc6..8519c8ced8 100644 --- a/test/CodeGenCXX/visibility-inlines-hidden.cpp +++ b/test/CodeGenCXX/visibility-inlines-hidden.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fvisibility-inlines-hidden -emit-llvm -o - %s -O2 -disable-llvm-optzns | FileCheck %s +// RUN: %clang_cc1 -triple i386-unknown-unknown -fvisibility-inlines-hidden -emit-llvm -o - %s -O2 -disable-llvm-optzns | FileCheck %s // The trickery with optimization in the run line is to get IR // generation to emit available_externally function bodies, but not diff --git a/test/CodeGenObjC/property.m b/test/CodeGenObjC/property.m index f72b52b3eb..aab7c73ad0 100644 --- a/test/CodeGenObjC/property.m +++ b/test/CodeGenObjC/property.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -o - %s | FileCheck %s // PR13820 // REQUIRES: LP64 diff --git a/test/Frontend/ast-codegen.c b/test/Frontend/ast-codegen.c index b5b2157e21..b85c5dcf50 100644 --- a/test/Frontend/ast-codegen.c +++ b/test/Frontend/ast-codegen.c @@ -1,5 +1,5 @@ -// RUN: %clang -emit-ast -o %t.ast %s -// RUN: %clang -emit-llvm -S -o - %t.ast | FileCheck %s +// RUN: %clang -target i386-unknown-unknown -emit-ast -o %t.ast %s +// RUN: %clang -target i386-unknown-unknown -emit-llvm -S -o - %t.ast | FileCheck %s // CHECK: module asm "foo" __asm__("foo");