From: Chandler Carruth Date: Tue, 16 Nov 2010 10:26:08 +0000 (+0000) Subject: This really seems like a boring set of fixes to our tests to make them more X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ba772ba69ba0661f059f49c58395f870eb5c4df3;p=clang This really seems like a boring set of fixes to our tests to make them more independent of the underlying system. Let me know if any of these are too aggressive. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119345 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/CodeGen/lineno-dbginfo.c b/test/CodeGen/lineno-dbginfo.c index 176d4157f3..72fa337eaf 100644 --- a/test/CodeGen/lineno-dbginfo.c +++ b/test/CodeGen/lineno-dbginfo.c @@ -1,4 +1,4 @@ -// RUN: echo "#include " > %t.h +// RUN: echo "#include " > %t.h // RUN: %clang -S -g -include %t.h %s -emit-llvm -o %t.ll // RUN: grep "i32 5" %t.ll // outer is at line number 5. diff --git a/test/Preprocessor/clang_headers.c b/test/Preprocessor/clang_headers.c index f2dec4fbe5..41bd754104 100644 --- a/test/Preprocessor/clang_headers.c +++ b/test/Preprocessor/clang_headers.c @@ -1,3 +1,3 @@ -// RUN: %clang_cc1 -E %s +// RUN: %clang_cc1 -ffreestanding -E %s #include diff --git a/test/Preprocessor/has_include.c b/test/Preprocessor/has_include.c index c34c348803..fdcae78b75 100644 --- a/test/Preprocessor/has_include.c +++ b/test/Preprocessor/has_include.c @@ -1,23 +1,23 @@ -// RUN: %clang_cc1 -Eonly -verify %s +// RUN: %clang_cc1 -ffreestanding -Eonly -verify %s // Try different path permutations of __has_include with existing file. -#if __has_include("stdio.h") +#if __has_include("stdint.h") #else #error "__has_include failed (1)." #endif -#if __has_include() +#if __has_include() #else #error "__has_include failed (2)." #endif // Try unary expression. -#if !__has_include("stdio.h") +#if !__has_include("stdint.h") #error "__has_include failed (5)." #endif // Try binary expression. -#if __has_include("stdio.h") && __has_include("stddef.h") +#if __has_include("stdint.h") && __has_include("stddef.h") #else #error "__has_include failed (6)." #endif @@ -44,12 +44,12 @@ #endif // Try unary expression. -#if !__has_include_next("stdio.h") // expected-warning {{#include_next in primary source file}} +#if !__has_include_next("stdint.h") // expected-warning {{#include_next in primary source file}} #error "__has_include_next failed (5)." #endif // Try binary expression. -#if __has_include_next("stdio.h") && __has_include("stddef.h") // expected-warning {{#include_next in primary source file}} +#if __has_include_next("stdint.h") && __has_include("stddef.h") // expected-warning {{#include_next in primary source file}} #else #error "__has_include_next failed (6)." #endif @@ -68,16 +68,16 @@ // FIXME: I don't quite know how to avoid preprocessor side effects. // Use FileCheck? // It also assert due to unterminated #if's. -//#if __has_include("stdio.h" -//#if __has_include "stdio.h") -//#if __has_include(stdio.h) +//#if __has_include("stdint.h" +//#if __has_include "stdint.h") +//#if __has_include(stdint.h) //#if __has_include() //#if __has_include( //#if __has_include) //#if __has_include -//#if __has_include( -//#if __has_include) -//#if __has_include("stdio.h) -//#if __has_include(stdio.h") -//#if __has_include() +//#if __has_include( +//#if __has_include) +//#if __has_include("stdint.h) +//#if __has_include(stdint.h") +//#if __has_include() diff --git a/test/Preprocessor/header_lookup1.c b/test/Preprocessor/header_lookup1.c index f93d0afe33..f52e4fe6ce 100644 --- a/test/Preprocessor/header_lookup1.c +++ b/test/Preprocessor/header_lookup1.c @@ -1,2 +1,2 @@ -// RUN: %clang -fno-ms-extensions -I /usr/include %s -E | grep 'stdio.h.*3.*4' -#include +// RUN: %clang -fno-ms-extensions %s -E | grep 'stddef.h.*3.*4' +#include diff --git a/test/Preprocessor/include-directive2.c b/test/Preprocessor/include-directive2.c index b205325f60..5f1ee3cfbc 100644 --- a/test/Preprocessor/include-directive2.c +++ b/test/Preprocessor/include-directive2.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -Eonly -verify %s +// RUN: %clang_cc1 -ffreestanding -Eonly -verify %s # define HEADER # include HEADER diff --git a/test/Sema/attr-malloc.c b/test/Sema/attr-malloc.c index 9970b9de4f..2cec84de49 100644 --- a/test/Sema/attr-malloc.c +++ b/test/Sema/attr-malloc.c @@ -1,7 +1,10 @@ // RUN: %clang -Xclang -verify -fsyntax-only %s // RUN: %clang -emit-llvm -S -o %t %s -#include +#include + +// Declare malloc here explicitly so we don't depend on system headers. +void * malloc(size_t) __attribute((malloc)); int no_vars __attribute((malloc)); // expected-warning {{functions returning a pointer type}} diff --git a/test/Sema/i-c-e.c b/test/Sema/i-c-e.c index 1347ee85e0..4c2962d4b2 100644 --- a/test/Sema/i-c-e.c +++ b/test/Sema/i-c-e.c @@ -1,4 +1,4 @@ -// RUN: %clang %s -fsyntax-only -Xclang -verify -pedantic -fpascal-strings +// RUN: %clang %s -ffreestanding -fsyntax-only -Xclang -verify -pedantic -fpascal-strings #include #include diff --git a/test/Sema/shift.c b/test/Sema/shift.c index 558a7d2006..4273cab98e 100644 --- a/test/Sema/shift.c +++ b/test/Sema/shift.c @@ -1,4 +1,4 @@ -// RUN: %clang -Wall -fsyntax-only -Xclang -verify %s +// RUN: %clang -Wall -ffreestanding -fsyntax-only -Xclang -verify %s #include diff --git a/test/Sema/x86-builtin-palignr.c b/test/Sema/x86-builtin-palignr.c index 8f90c81fd8..a703c800ab 100644 --- a/test/Sema/x86-builtin-palignr.c +++ b/test/Sema/x86-builtin-palignr.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -target-feature +ssse3 -verify %s +// RUN: %clang_cc1 -ffreestanding -fsyntax-only -target-feature +ssse3 -verify %s // Temporarily xfail this on windows. // XFAIL: win32