Fix warnings in test/std/algorithms

llvm-svn: 242626
This commit is contained in:
Eric Fiselier 2015-07-18 21:53:16 +00:00
parent b67e689f02
commit 19fa337610
6 changed files with 20 additions and 18 deletions

View File

@ -570,8 +570,11 @@ class Configuration(object):
def configure_warnings(self):
enable_warnings = self.get_lit_bool('enable_warnings', False)
if enable_warnings:
self.cxx.compile_flags += ['-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER',
'-Wall', '-Werror']
self.cxx.compile_flags += [
'-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER',
'-Wall', '-Werror'
]
self.cxx.addCompileFlagIfSupported('-Wno-c++11-extensions')
self.cxx.addCompileFlagIfSupported('-Wno-user-defined-literals')
def configure_sanitizer(self):

View File

@ -17,10 +17,9 @@
#include <algorithm>
#include <cassert>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#include <memory>
#endif
#include "test_macros.h"
#include "test_iterators.h"
struct is_odd
@ -283,7 +282,7 @@ test()
}
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if TEST_STD_VER >= 11
struct is_null
{
@ -298,9 +297,10 @@ test1()
const unsigned size = 5;
std::unique_ptr<int> array[size];
Iter r = std::stable_partition(Iter(array), Iter(array+size), is_null());
assert(r == Iter(array+size));
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif // TEST_STD_VER >= 11
int main()
{
@ -308,7 +308,7 @@ int main()
test<random_access_iterator<std::pair<int,int>*> >();
test<std::pair<int,int>*>();
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if TEST_STD_VER >= 11
test1<bidirectional_iterator<std::unique_ptr<int>*> >();
#endif
}

View File

@ -17,18 +17,16 @@
#include <algorithm>
#include <cassert>
#include "test_macros.h"
#include "test_iterators.h"
#if _LIBCPP_STD_VER > 11
#define HAS_FOUR_ITERATOR_VERSION
#endif
int main()
{
int ia[] = {0, 1, 2, 2, 0, 1, 2, 3};
const unsigned sa = sizeof(ia)/sizeof(ia[0]);
int ib[] = {0, 1, 2, 3, 0, 1, 2, 3};
const unsigned sb = sizeof(ib)/sizeof(ib[0]);
const unsigned sb = sizeof(ib)/sizeof(ib[0]); ((void)sb); // unused in c++11
typedef input_iterator<const int*> II;
typedef random_access_iterator<const int*> RAI;
@ -39,7 +37,7 @@ int main()
assert(std::mismatch(RAI(ia), RAI(ia + sa), RAI(ib))
== (std::pair<RAI, RAI>(RAI(ia+3), RAI(ib+3))));
#ifdef HAS_FOUR_ITERATOR_VERSION
#if TEST_STD_VER > 11 // We have the four iteration version
assert(std::mismatch(II(ia), II(ia + sa), II(ib), II(ib+sb))
== (std::pair<II, II>(II(ia+3), II(ib+3))));

View File

@ -19,10 +19,11 @@
#include <functional>
#include <cassert>
#include "test_macros.h"
#include "test_iterators.h"
#include "counting_predicates.hpp"
#if _LIBCPP_STD_VER > 11
#if TEST_STD_VER > 11
#define HAS_FOUR_ITERATOR_VERSION
#endif
@ -31,7 +32,7 @@ int main()
int ia[] = {0, 1, 2, 2, 0, 1, 2, 3};
const unsigned sa = sizeof(ia)/sizeof(ia[0]);
int ib[] = {0, 1, 2, 3, 0, 1, 2, 3};
const unsigned sb = sizeof(ib)/sizeof(ib[0]);
const unsigned sb = sizeof(ib)/sizeof(ib[0]); ((void)sb); // unused in c++11
typedef input_iterator<const int*> II;
typedef random_access_iterator<const int*> RAI;

View File

@ -29,9 +29,9 @@ test()
int ib[] = {2, 4};
const unsigned sb = sizeof(ib)/sizeof(ib[0]);
int ic[] = {1, 2};
const unsigned sc = sizeof(ic)/sizeof(ic[0]);
const unsigned sc = sizeof(ic)/sizeof(ic[0]); ((void)sc);
int id[] = {3, 3, 3, 3};
const unsigned sd = sizeof(id)/sizeof(id[0]);
const unsigned sd = sizeof(id)/sizeof(id[0]); ((void)sd);
assert(std::includes(Iter1(ia), Iter1(ia), Iter2(ib), Iter2(ib)));
assert(!std::includes(Iter1(ia), Iter1(ia), Iter2(ib), Iter2(ib+1)));

View File

@ -30,9 +30,9 @@ test()
int ib[] = {2, 4};
const unsigned sb = sizeof(ib)/sizeof(ib[0]);
int ic[] = {1, 2};
const unsigned sc = sizeof(ic)/sizeof(ic[0]);
const unsigned sc = sizeof(ic)/sizeof(ic[0]); ((void)sc);
int id[] = {3, 3, 3, 3};
const unsigned sd = sizeof(id)/sizeof(id[0]);
const unsigned sd = sizeof(id)/sizeof(id[0]); ((void)sd);
assert(std::includes(Iter1(ia), Iter1(ia), Iter2(ib), Iter2(ib), std::less<int>()));
assert(!std::includes(Iter1(ia), Iter1(ia), Iter2(ib), Iter2(ib+1), std::less<int>()));