Support tests in freestanding

Summary:
Freestanding is *weird*. The standard allows it to differ in a bunch of odd
manners from regular C++, and the committee would like to improve that
situation. I'd like to make libc++ behave better with what freestanding should
be, so that it can be a tool we use in improving the standard. To do that we
need to try stuff out, both with "freestanding the language mode" and
"freestanding the library subset".

Let's start with the super basic: run the libc++ tests in freestanding, using
clang as the compiler, and see what works. The easiest hack to do this:

In utils/libcxx/test/config.py add:

  self.cxx.compile_flags += ['-ffreestanding']

Run the tests and they all fail.

Why? Because in freestanding `main` isn't special. This "not special" property
has two effects: main doesn't get mangled, and main isn't allowed to omit its
`return` statement. The first means main gets mangled and the linker can't
create a valid executable for us to test. The second means we spew out warnings
(ew) and the compiler doesn't insert the `return` we omitted, and main just
falls of the end and does whatever undefined behavior (if you're luck, ud2
leading to non-zero return code).

Let's start my work with the basics. This patch changes all libc++ tests to
declare `main` as `int main(int, char**` so it mangles consistently (enabling us
to declare another `extern "C"` main for freestanding which calls the mangled
one), and adds `return 0;` to all places where it was missing. This touches 6124
files, and I apologize.

The former was done with The Magic Of Sed.

The later was done with a (not quite correct but decent) clang tool:

  https://gist.github.com/jfbastien/793819ff360baa845483dde81170feed

This works for most tests, though I did have to adjust a few places when e.g.
the test runs with `-x c`, macros are used for main (such as for the filesystem
tests), etc.

Once this is in we can create a freestanding bot which will prevent further
regressions. After that, we can start the real work of supporting C++
freestanding fairly well in libc++.

<rdar://problem/47754795>

Reviewers: ldionne, mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, arphaman, miyuki, libcxx-commits

Differential Revision: https://reviews.llvm.org/D57624

llvm-svn: 353086
This commit is contained in:
JF Bastien 2019-02-04 20:31:13 +00:00
parent 6fd4e7fe02
commit 2df59c5068
6123 changed files with 18208 additions and 6227 deletions

View File

@ -24,7 +24,7 @@ function(check_cxx_atomics varname)
#include <atomic>
std::atomic<uintptr_t> x;
std::atomic<uintmax_t> y;
int main() {
int main(int, char**) {
return x + y;
}
" ${varname})

View File

@ -53,7 +53,7 @@ assertion handler as follows:
#define _LIBCPP_DEBUG 1
#include <string>
int main() {
int main(int, char**) {
std::__libcpp_debug_function = std::__libcpp_throw_debug_function;
try {
std::string::iterator bad_it;

View File

@ -119,7 +119,7 @@ to throw in cases where the user was confident the call should succeed. (See bel
set_file_times("/tmp/foo", new_times); // OK, supported by most FSes
}
int main() {
int main(int, char**) {
path p = "/tmp/foo";
file_status st = status(p);
if (!exists(st) || !is_regular_file(st))
@ -128,6 +128,7 @@ to throw in cases where the user was confident the call should succeed. (See bel
return 1;
// It seems reasonable to assume this call should succeed.
file_time_type tp = last_write_time(p); // BAD! Throws value_too_large.
return 0;
}

View File

@ -39,10 +39,12 @@ struct gen
};
int main()
int main(int, char**)
{
std::vector<int> v;
std::random_shuffle(v.begin(), v.end());
gen r;
std::random_shuffle(v.begin(), v.end(), r);
return 0;
}

View File

@ -40,10 +40,12 @@ struct gen
};
int main()
int main(int, char**)
{
int v[1] = {1};
std::random_shuffle(&v[0], &v[1]); // expected-error{{'random_shuffle<int *>' is deprecated}}
gen r;
std::random_shuffle(&v[0], &v[1], r); // expected-error{{'random_shuffle<int *, gen &>' is deprecated}}
return 0;
}

View File

@ -210,8 +210,10 @@ void test_upper_and_lower_bound() {
}
}
int main() {
int main(int, char**) {
test_passing();
test_failing();
test_upper_and_lower_bound();
return 0;
}

View File

@ -28,7 +28,7 @@ TEST_CONSTEXPR bool test(IntType max_v = IntType(std::numeric_limits<UnderlyingT
} // namespace
int main()
int main(int, char**)
{
{
assert(test<char>());
@ -52,4 +52,6 @@ int main()
#endif // !defined(_LIBCPP_HAS_NO_INT128)
}
#endif // TEST_STD_VER >= 11
return 0;
}

View File

@ -14,6 +14,8 @@
#error _LIBCPP_VERSION not defined
#endif
int main()
int main(int, char**)
{
return 0;
}

View File

@ -35,7 +35,7 @@ template <typename T> struct atomic_test : public std::__atomic_base<T> {
}
};
int main() {
int main(int, char**) {
// structs and unions can't be defined in the template invocation.
// Work around this with a typedef.
@ -89,4 +89,6 @@ int main() {
CHECK_ALIGNMENT(struct LLIArr16 { long long int i[16]; });
CHECK_ALIGNMENT(struct Padding { char c; /* padding */ long long int i; });
CHECK_ALIGNMENT(union IntFloat { int i; float f; });
return 0;
}

View File

@ -27,7 +27,7 @@ X x;
std::atomic_flag global = ATOMIC_FLAG_INIT;
#endif
int main()
int main(int, char**)
{
#if TEST_STD_VER >= 11
assert(global.test_and_set() == 1);
@ -40,4 +40,6 @@ int main()
std::atomic_flag f(true);
assert(f.test_and_set() == 1);
}
return 0;
}

View File

@ -19,7 +19,7 @@
#include <atomic>
int main() {
int main(int, char**) {
std::atomic<int> x(42);
volatile std::atomic<int>& vx = x;
int val1 = 1; ((void)val1);
@ -124,4 +124,6 @@ int main() {
std::atomic_compare_exchange_strong_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_acquire);
std::atomic_compare_exchange_strong_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_seq_cst);
}
return 0;
}

View File

@ -18,6 +18,8 @@
#include <atomic>
int main()
int main(int, char**)
{
return 0;
}

View File

@ -12,6 +12,8 @@
'libcpp-has-no-threads' is available iff _LIBCPP_HAS_NO_THREADS is defined
#endif
int main()
int main(int, char**)
{
return 0;
}

View File

@ -16,6 +16,8 @@
#error _LIBCPP_VERSION not defined
#endif
int main()
int main(int, char**)
{
return 0;
}

View File

@ -14,6 +14,8 @@
#error _LIBCPP_VERSION not defined
#endif
int main()
int main(int, char**)
{
return 0;
}

View File

@ -22,7 +22,7 @@ struct BadCompare {
}
};
int main() {
int main(int, char**) {
static_assert(!std::__invokable<BadCompare const&, int const&, int const&>::value, "");
static_assert(std::__invokable<BadCompare&, int const&, int const&>::value, "");
@ -44,4 +44,6 @@ int main() {
using C = std::multimap<long, int, BadCompare>;
C s;
}
return 0;
}

View File

@ -14,6 +14,8 @@
#error _LIBCPP_VERSION not defined
#endif
int main()
int main(int, char**)
{
return 0;
}

View File

@ -1608,11 +1608,13 @@ test5()
assert(h.__is_black_ == true);
}
int main()
int main(int, char**)
{
test1();
test2();
test3();
test4();
test5();
return 0;
}

View File

@ -53,6 +53,8 @@ void testKeyValueTrait() {
}
}
int main() {
int main(int, char**) {
testKeyValueTrait();
return 0;
}

View File

@ -93,8 +93,10 @@ test2()
assert(c.__right_ == 0);
}
int main()
int main(int, char**)
{
test1();
test2();
return 0;
}

View File

@ -1641,10 +1641,12 @@ test4()
assert(root.__is_black_ == false);
}
int main()
int main(int, char**)
{
test1();
test2();
test3();
test4();
return 0;
}

View File

@ -93,8 +93,10 @@ test2()
assert(c.__right_ == 0);
}
int main()
int main(int, char**)
{
test1();
test2();
return 0;
}

View File

@ -15,7 +15,9 @@
#include <map>
int main() {
int main(int, char**) {
std::map<int, int> m;
((void)m);
return 0;
}

View File

@ -14,6 +14,8 @@
#error _LIBCPP_VERSION not defined
#endif
int main()
int main(int, char**)
{
return 0;
}

View File

@ -14,6 +14,8 @@
#error _LIBCPP_VERSION not defined
#endif
int main()
int main(int, char**)
{
return 0;
}

View File

@ -17,9 +17,11 @@ namespace __gnu_cxx {
template class hash_map<int, int>;
}
int main() {
int main(int, char**) {
typedef __gnu_cxx::hash_map<int, int> Map;
Map m;
Map m2(m);
((void)m2);
return 0;
}

View File

@ -17,9 +17,11 @@ namespace __gnu_cxx {
template class hash_set<int>;
}
int main() {
int main(int, char**) {
typedef __gnu_cxx::hash_set<int> Set;
Set s;
Set s2(s);
((void)s2);
return 0;
}

View File

@ -29,7 +29,7 @@ inline bool CheckDebugThrows(Array& Arr) {
return false;
}
int main()
int main(int, char**)
{
{
typedef std::array<int, 0> C;
@ -45,4 +45,6 @@ int main()
assert(CheckDebugThrows(c));
assert(CheckDebugThrows(cc));
}
return 0;
}

View File

@ -29,7 +29,7 @@ inline bool CheckDebugThrows(Array& Arr) {
return false;
}
int main()
int main(int, char**)
{
{
typedef std::array<int, 0> C;
@ -45,4 +45,6 @@ int main()
assert(CheckDebugThrows(c));
assert(CheckDebugThrows(cc));
}
return 0;
}

View File

@ -29,7 +29,7 @@ inline bool CheckDebugThrows(Array& Arr, size_t Index) {
return false;
}
int main()
int main(int, char**)
{
{
typedef std::array<int, 0> C;
@ -49,4 +49,6 @@ int main()
assert(CheckDebugThrows(cc, 0));
assert(CheckDebugThrows(cc, 1));
}
return 0;
}

View File

@ -14,6 +14,8 @@
#error _LIBCPP_VERSION not defined
#endif
int main()
int main(int, char**)
{
return 0;
}

View File

@ -22,10 +22,12 @@ struct A {
std::deque<A>::reverse_iterator it2;
};
int main()
int main(int, char**)
{
A a;
assert(a.d.size() == 0);
a.it = a.d.begin();
a.it2 = a.d.rend();
return 0;
}

View File

@ -16,10 +16,12 @@
#include <deque>
int main() {
int main(int, char**) {
std::deque<int> q;
q.push_back(0);
q.pop_back();
q.pop_back();
std::exit(1);
return 0;
}

View File

@ -14,6 +14,8 @@
#error _LIBCPP_VERSION not defined
#endif
int main()
int main(int, char**)
{
return 0;
}

View File

@ -14,6 +14,8 @@
#error _LIBCPP_VERSION not defined
#endif
int main()
int main(int, char**)
{
return 0;
}

View File

@ -19,7 +19,7 @@
#include <cstdlib>
#include <cassert>
int main()
int main(int, char**)
{
std::list<int> l1;
l1.push_back(1); l1.push_back(2); l1.push_back(3);
@ -27,4 +27,6 @@ int main()
std::list<int> l2 = l1;
l2.erase(i);
assert(false);
return 0;
}

View File

@ -25,10 +25,12 @@
#include "test_allocator.h"
#include "min_allocator.h"
int main()
int main(int, char**)
{
std::list<int> l1 = {1, 2, 3};
std::list<int>::iterator i = l1.begin();
std::list<int> l2 = std::move(l1);
assert(*l2.erase(i) == 2);
return 0;
}

View File

@ -37,10 +37,12 @@ public:
double getd() const {return d_;}
};
int main()
int main(int, char**)
{
std::list<A> c1;
std::list<A> c2;
std::list<A>::iterator i = c1.emplace(c2.cbegin(), 2, 3.5);
assert(false);
return 0;
}

View File

@ -20,11 +20,13 @@
#include <cassert>
#include <cstdlib>
int main()
int main(int, char**)
{
int a1[] = {1, 2, 3};
std::list<int> l1(a1, a1+3);
std::list<int>::const_iterator i = l1.end();
l1.erase(i);
assert(false);
return 0;
}

View File

@ -20,7 +20,7 @@
#include <cassert>
#include <cstdlib>
int main()
int main(int, char**)
{
int a1[] = {1, 2, 3};
std::list<int> l1(a1, a1+3);
@ -28,4 +28,6 @@ int main()
std::list<int>::const_iterator i = l2.begin();
l1.erase(i);
assert(false);
return 0;
}

View File

@ -20,12 +20,14 @@
#include <cassert>
#include <cstdlib>
int main()
int main(int, char**)
{
int a1[] = {1, 2, 3};
std::list<int> l1(a1, a1+3);
std::list<int> l2(a1, a1+3);
std::list<int>::iterator i = l1.erase(l2.cbegin(), next(l1.cbegin()));
assert(false);
return 0;
}

View File

@ -20,11 +20,13 @@
#include <cassert>
#include <cstdlib>
int main()
int main(int, char**)
{
int a1[] = {1, 2, 3};
std::list<int> l1(a1, a1+3);
std::list<int> l2(a1, a1+3);
std::list<int>::iterator i = l1.erase(l1.cbegin(), next(l2.cbegin()));
assert(false);
return 0;
}

View File

@ -20,11 +20,13 @@
#include <cassert>
#include <cstdlib>
int main()
int main(int, char**)
{
int a1[] = {1, 2, 3};
std::list<int> l1(a1, a1+3);
std::list<int> l2(a1, a1+3);
std::list<int>::iterator i = l1.erase(l2.cbegin(), next(l2.cbegin()));
assert(false);
return 0;
}

View File

@ -20,10 +20,12 @@
#include <cassert>
#include <cstdlib>
int main()
int main(int, char**)
{
int a1[] = {1, 2, 3};
std::list<int> l1(a1, a1+3);
std::list<int>::iterator i = l1.erase(next(l1.cbegin()), l1.cbegin());
assert(false);
return 0;
}

View File

@ -23,7 +23,7 @@
#include <cassert>
#include "test_iterators.h"
int main()
int main(int, char**)
{
{
std::list<int> v(100);
@ -35,4 +35,6 @@ int main()
input_iterator<const int*>(a+N));
assert(false);
}
return 0;
}

View File

@ -20,10 +20,12 @@
#include <cstdlib>
#include <cassert>
int main()
int main(int, char**)
{
std::list<int> v1(3);
std::list<int> v2(3);
v1.insert(v2.begin(), 4);
assert(false);
return 0;
}

View File

@ -20,10 +20,12 @@
#include <cstdlib>
#include <cassert>
int main()
int main(int, char**)
{
std::list<int> c1(100);
std::list<int> c2;
std::list<int>::iterator i = c1.insert(next(c2.cbegin(), 10), 5, 1);
assert(false);
return 0;
}

View File

@ -21,11 +21,13 @@
#include <cassert>
int main()
int main(int, char**)
{
std::list<int> v1(3);
std::list<int> v2(3);
int i = 4;
v1.insert(v2.begin(), i);
assert(false);
return 0;
}

View File

@ -20,7 +20,7 @@
#include <cstdlib>
#include <cassert>
int main()
int main(int, char**)
{
int a[] = {1, 2, 3};
std::list<int> c(a, a+3);
@ -32,4 +32,6 @@ int main()
assert(c.empty());
c.pop_back(); // operation under test
assert(false);
return 0;
}

View File

@ -20,7 +20,7 @@
#include <cstdlib>
#include <cassert>
int main()
int main(int, char**)
{
{
std::list<int> v1(3);
@ -28,4 +28,6 @@ int main()
v1.splice(v2.begin(), v2);
assert(false);
}
return 0;
}

View File

@ -20,7 +20,7 @@
#include <cstdlib>
#include <cassert>
int main()
int main(int, char**)
{
{
std::list<int> v1(3);
@ -28,4 +28,6 @@ int main()
v1.splice(v1.begin(), v2, v1.begin());
assert(false);
}
return 0;
}

View File

@ -20,7 +20,7 @@
#include <cstdlib>
#include <cassert>
int main()
int main(int, char**)
{
{
std::list<int> v1(3);
@ -28,4 +28,6 @@ int main()
v1.splice(v1.begin(), v2, v2.begin(), v1.end());
assert(false);
}
return 0;
}

View File

@ -14,6 +14,8 @@
#error _LIBCPP_VERSION not defined
#endif
int main()
int main(int, char**)
{
return 0;
}

View File

@ -28,7 +28,7 @@ void do_exit() {
exit(0);
}
int main()
int main(int, char**)
{
#if TEST_STD_VER >= 11
{
@ -68,5 +68,5 @@ int main()
}
}
#else
int main () { return 0; }
int main(int, char**) { return 0; }
#endif

View File

@ -219,7 +219,7 @@ void test_resize_param() {
assert(is_contiguous_container_asan_correct(v));
}
int main() {
int main(int, char**) {
test_push_back();
test_emplace_back();
test_insert_range();
@ -230,4 +230,6 @@ int main() {
test_insert_n2();
test_resize();
test_resize_param();
return 0;
}

View File

@ -15,7 +15,9 @@
#include <vector>
#include <type_traits>
int main()
int main(int, char**)
{
std::vector<const int> v = {1, 2, 3};
return 0;
}

View File

@ -23,7 +23,7 @@
#include "test_macros.h"
#include "min_allocator.h"
int main()
int main(int, char**)
{
{
typedef int T;
@ -49,8 +49,10 @@ int main()
#else
int main()
int main(int, char**)
{
return 0;
}
#endif

View File

@ -23,7 +23,7 @@
#include "test_macros.h"
#include "min_allocator.h"
int main()
int main(int, char**)
{
{
typedef int T;
@ -45,8 +45,10 @@ int main()
#else
int main()
int main(int, char**)
{
return 0;
}
#endif

View File

@ -23,7 +23,7 @@
#include "test_macros.h"
#include "min_allocator.h"
int main()
int main(int, char**)
{
{
typedef int T;
@ -45,8 +45,10 @@ int main()
#else
int main()
int main(int, char**)
{
return 0;
}
#endif

View File

@ -23,7 +23,7 @@
#include "test_macros.h"
#include "min_allocator.h"
int main()
int main(int, char**)
{
{
typedef int T;
@ -47,8 +47,10 @@ int main()
#else
int main()
int main(int, char**)
{
return 0;
}
#endif

View File

@ -23,7 +23,7 @@
#include "test_macros.h"
#include "min_allocator.h"
int main()
int main(int, char**)
{
{
typedef int T;
@ -49,8 +49,10 @@ int main()
#else
int main()
int main(int, char**)
{
return 0;
}
#endif

View File

@ -23,7 +23,7 @@
#include "test_macros.h"
#include "min_allocator.h"
int main()
int main(int, char**)
{
{
typedef int T;
@ -49,8 +49,10 @@ int main()
#else
int main()
int main(int, char**)
{
return 0;
}
#endif

View File

@ -23,7 +23,7 @@
#include "test_macros.h"
#include "min_allocator.h"
int main()
int main(int, char**)
{
{
typedef int T;
@ -47,8 +47,10 @@ int main()
#else
int main()
int main(int, char**)
{
return 0;
}
#endif

View File

@ -23,7 +23,7 @@
#include "test_macros.h"
#include "min_allocator.h"
int main()
int main(int, char**)
{
{
typedef int T;
@ -47,8 +47,10 @@ int main()
#else
int main()
int main(int, char**)
{
return 0;
}
#endif

View File

@ -23,7 +23,7 @@
#include "test_macros.h"
#include "min_allocator.h"
int main()
int main(int, char**)
{
{
typedef int T;
@ -49,8 +49,10 @@ int main()
#else
int main()
int main(int, char**)
{
return 0;
}
#endif

View File

@ -23,7 +23,7 @@
#include "test_macros.h"
#include "min_allocator.h"
int main()
int main(int, char**)
{
{
typedef int T;
@ -53,8 +53,10 @@ int main()
#else
int main()
int main(int, char**)
{
return 0;
}
#endif

View File

@ -23,7 +23,7 @@
#include "test_macros.h"
#include "min_allocator.h"
int main()
int main(int, char**)
{
{
typedef int T;
@ -51,8 +51,10 @@ int main()
#else
int main()
int main(int, char**)
{
return 0;
}
#endif

View File

@ -23,7 +23,7 @@
#include "test_macros.h"
#include "min_allocator.h"
int main()
int main(int, char**)
{
{
typedef int T;
@ -51,8 +51,10 @@ int main()
#else
int main()
int main(int, char**)
{
return 0;
}
#endif

View File

@ -23,7 +23,7 @@
#include "test_macros.h"
#include "min_allocator.h"
int main()
int main(int, char**)
{
{
typedef int T;
@ -47,8 +47,10 @@ int main()
#else
int main()
int main(int, char**)
{
return 0;
}
#endif

View File

@ -16,10 +16,12 @@
#include <vector>
int main() {
int main(int, char**) {
std::vector<int> v;
v.push_back(0);
v.pop_back();
v.pop_back();
std::exit(1);
return 0;
}

View File

@ -48,6 +48,8 @@ void test_ctor_under_alloc() {
}
}
int main() {
int main(int, char**) {
test_ctor_under_alloc();
return 0;
}

View File

@ -51,6 +51,8 @@ void test_ctor_under_alloc() {
}
}
int main() {
int main(int, char**) {
test_ctor_under_alloc();
return 0;
}

View File

@ -14,6 +14,8 @@
#error _LIBCPP_VERSION not defined
#endif
int main()
int main(int, char**)
{
return 0;
}

View File

@ -53,6 +53,8 @@ void testKeyValueTrait() {
}
}
int main() {
int main(int, char**) {
testKeyValueTrait();
return 0;
}

View File

@ -74,7 +74,7 @@ fuzz_unordered_map_reserve(unsigned num_inserts,
assert(m.bucket_count() >= num_reserve2);
}
int main()
int main(int, char**)
{
test_next_pow2();

View File

@ -36,7 +36,7 @@ is_prime(size_t n)
return true;
}
int main()
int main(int, char**)
{
assert(std::__next_prime(0) == 0);
for (std::size_t n = 1; n <= 100000; ++n)
@ -47,4 +47,6 @@ int main()
assert(!is_prime(i));
assert(is_prime(p));
}
return 0;
}

View File

@ -29,7 +29,7 @@ struct BadEqual {
}
};
int main() {
int main(int, char**) {
static_assert(!std::__invokable<BadEqual const&, int const&, int const&>::value, "");
static_assert(std::__invokable<BadEqual&, int const&, int const&>::value, "");
@ -54,4 +54,6 @@ int main() {
using C = std::unordered_multimap<long, int, BadHash, BadEqual>;
C s;
}
return 0;
}

View File

@ -24,7 +24,7 @@
#include "test_macros.h"
#include "min_allocator.h"
int main()
int main(int, char**)
{
{
typedef std::unordered_map<int, std::string> C;
@ -53,8 +53,10 @@ int main()
#else
int main()
int main(int, char**)
{
return 0;
}
#endif

View File

@ -24,7 +24,7 @@
#include "test_macros.h"
#include "min_allocator.h"
int main()
int main(int, char**)
{
{
typedef std::unordered_map<int, std::string> C;
@ -49,8 +49,10 @@ int main()
#else
int main()
int main(int, char**)
{
return 0;
}
#endif

View File

@ -24,7 +24,7 @@
#include "test_macros.h"
#include "min_allocator.h"
int main()
int main(int, char**)
{
{
typedef std::unordered_map<int, std::string> C;
@ -50,8 +50,10 @@ int main()
#else
int main()
int main(int, char**)
{
return 0;
}
#endif

View File

@ -24,7 +24,7 @@
#include "test_macros.h"
#include "min_allocator.h"
int main()
int main(int, char**)
{
{
typedef std::unordered_map<int, std::string> C;
@ -47,8 +47,10 @@ int main()
#else
int main()
int main(int, char**)
{
return 0;
}
#endif

View File

@ -14,6 +14,8 @@
#error _LIBCPP_VERSION not defined
#endif
int main()
int main(int, char**)
{
return 0;
}

View File

@ -42,7 +42,7 @@ struct GoodHashNoDefault {
size_t operator()(T const&) const { return 0; }
};
int main() {
int main(int, char**) {
{
using Set = std::unordered_set<VT>;
@ -66,4 +66,6 @@ int main() {
using Set = std::unordered_set<int, GoodHashNoDefault>;
Set s(/*bucketcount*/42, GoodHashNoDefault(nullptr));
}
return 0;
}

View File

@ -14,6 +14,8 @@
#error _LIBCPP_VERSION not defined
#endif
int main()
int main(int, char**)
{
return 0;
}

View File

@ -51,7 +51,7 @@ private:
// FIXME Add tests here
};
int main()
int main(int, char**)
{
using SetAlloc = test_allocator<int>;
using MapAlloc = test_allocator<std::pair<const int, int>>;
@ -66,4 +66,6 @@ int main()
AssociativeContainerChecks<
std::multimap<int, int, std::less<int>, MapAlloc>, CT_MultiMap>::run();
}
return 0;
}

View File

@ -307,7 +307,7 @@ private:
}
};
int main()
int main(int, char**)
{
using Alloc = test_allocator<int>;
{
@ -323,4 +323,6 @@ int main()
SequenceContainerChecks<
std::deque<int, Alloc>, CT_Deque>::run();
}
return 0;
}

View File

@ -93,7 +93,9 @@ private:
}
};
int main()
int main(int, char**)
{
StringContainerChecks<>::run();
return 0;
}

View File

@ -49,7 +49,7 @@ private:
};
int main()
int main(int, char**)
{
using SetAlloc = test_allocator<int>;
using MapAlloc = test_allocator<std::pair<const int, int>>;
@ -67,4 +67,6 @@ int main()
std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, SetAlloc>,
CT_UnorderedMultiSet>::run();
}
return 0;
}

View File

@ -27,7 +27,7 @@ void signal_handler(int signal)
std::_Exit(EXIT_FAILURE);
}
int main()
int main(int, char**)
{
if (std::signal(SIGABRT, signal_handler) != SIG_ERR)
_LIBCPP_ASSERT(false, "foo");

View File

@ -23,7 +23,7 @@
#include <type_traits>
#include <__debug>
int main()
int main(int, char**)
{
{
std::__libcpp_debug_function = std::__libcpp_throw_debug_function;
@ -37,4 +37,6 @@ int main()
std::__libcpp_debug_exception
>::value), "must be an exception");
}
return 0;
}

View File

@ -26,10 +26,12 @@
#include <__debug>
#include <cassert>
int main()
int main(int, char**)
{
try {
_LIBCPP_ASSERT(false, "foo");
assert(false);
} catch (...) {}
return 0;
}

View File

@ -22,7 +22,9 @@
#include <memory>
#include <type_traits>
int main()
int main(int, char**)
{
std::auto_ptr<int> p;
return 0;
}

View File

@ -30,9 +30,11 @@
#include <memory>
#include "test_macros.h"
int main()
int main(int, char**)
{
typedef std::auto_ptr<int> AP; // expected-error{{'auto_ptr<int>' is deprecated}}
typedef std::auto_ptr<void> APV; // expected-error{{'auto_ptr<void>' is deprecated}}
typedef std::auto_ptr_ref<int> APR; // expected-error{{'auto_ptr_ref<int>' is deprecated}}
return 0;
}

View File

@ -14,6 +14,8 @@
#error _LIBCPP_VERSION not defined
#endif
int main()
int main(int, char**)
{
return 0;
}

View File

@ -14,8 +14,10 @@
#error _LIBCPP_VERSION not defined
#endif
int main()
int main(int, char**)
{
std::complex<double> d;
(void)d;
return 0;
}

View File

@ -39,4 +39,6 @@ extern "C" {
#include <wctype.h>
}
int main() {}
int main(int, char**) {
return 0;
}

View File

@ -14,6 +14,8 @@
#error _LIBCPP_VERSION not defined
#endif
int main()
int main(int, char**)
{
return 0;
}

View File

@ -14,10 +14,12 @@
#error _LIBCPP_VERSION not defined
#endif
int main()
int main(int, char**)
{
std::complex<double> cd;
(void)cd;
double x = sin(1.0);
(void)x; // to placate scan-build
return 0;
}

View File

@ -31,7 +31,7 @@ struct Foo {
int identity(int v) { return v; }
};
int main()
int main(int, char**)
{
typedef std::pointer_to_unary_function<int, int> PUF; // expected-error{{'pointer_to_unary_function<int, int>' is deprecated}}
typedef std::pointer_to_binary_function<int, int, int> PBF; // expected-error{{'pointer_to_binary_function<int, int, int>' is deprecated}}
@ -55,4 +55,6 @@ int main()
std::mem_fun_ref<int, Foo, int>(&Foo::identity); // expected-error{{'mem_fun_ref<int, Foo, int>' is deprecated}}
std::mem_fun_ref<int, Foo>(&Foo::const_zero); // expected-error{{'mem_fun_ref<int, Foo>' is deprecated}}
std::mem_fun_ref<int, Foo, int>(&Foo::const_identity); // expected-error{{'mem_fun_ref<int, Foo, int>' is deprecated}}
return 0;
}

View File

@ -30,7 +30,7 @@ struct Foo {
int sum(int a, int b) const { return a + b; }
};
int main()
int main(int, char**)
{
typedef std::pointer_to_unary_function<int, int> PUF;
typedef std::pointer_to_binary_function<int, int, int> PBF;
@ -60,4 +60,6 @@ int main()
assert((std::mem_fun_ref(&Foo::zero)(f) == 0));
assert((std::mem_fun_ref(&Foo::identity)(f, 5) == 5));
return 0;
}

Some files were not shown because too many files have changed in this diff Show More