From 19fa3376100f59d083383a5db03a969a4a45066b Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sat, 18 Jul 2015 21:53:16 +0000 Subject: [PATCH] Fix warnings in test/std/algorithms llvm-svn: 242626 --- libcxx/test/libcxx/test/config.py | 7 +++++-- .../alg.partitions/stable_partition.pass.cpp | 10 +++++----- .../std/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp | 8 +++----- .../alg.nonmodifying/mismatch/mismatch_pred.pass.cpp | 5 +++-- .../alg.sorting/alg.set.operations/includes/includes.pass.cpp | 4 ++-- .../alg.set.operations/includes/includes_comp.pass.cpp | 4 ++-- 6 files changed, 20 insertions(+), 18 deletions(-) diff --git a/libcxx/test/libcxx/test/config.py b/libcxx/test/libcxx/test/config.py index 8e421f3..41e015a 100644 --- a/libcxx/test/libcxx/test/config.py +++ b/libcxx/test/libcxx/test/config.py @@ -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): diff --git a/libcxx/test/std/algorithms/alg.modifying.operations/alg.partitions/stable_partition.pass.cpp b/libcxx/test/std/algorithms/alg.modifying.operations/alg.partitions/stable_partition.pass.cpp index 7810dec..cf23c77 100644 --- a/libcxx/test/std/algorithms/alg.modifying.operations/alg.partitions/stable_partition.pass.cpp +++ b/libcxx/test/std/algorithms/alg.modifying.operations/alg.partitions/stable_partition.pass.cpp @@ -17,10 +17,9 @@ #include #include -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include -#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 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*> >(); test*>(); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 test1*> >(); #endif } diff --git a/libcxx/test/std/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp b/libcxx/test/std/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp index abc89dc..eb37cca 100644 --- a/libcxx/test/std/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp +++ b/libcxx/test/std/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp @@ -17,18 +17,16 @@ #include #include +#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 II; typedef random_access_iterator RAI; @@ -39,7 +37,7 @@ int main() assert(std::mismatch(RAI(ia), RAI(ia + sa), RAI(ib)) == (std::pair(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(ia+3), II(ib+3)))); diff --git a/libcxx/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp b/libcxx/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp index 8d85d99..3e1dfd1 100644 --- a/libcxx/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp +++ b/libcxx/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp @@ -19,10 +19,11 @@ #include #include +#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 II; typedef random_access_iterator RAI; diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes.pass.cpp index 8db8177..70abd18 100644 --- a/libcxx/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes.pass.cpp +++ b/libcxx/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes.pass.cpp @@ -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))); diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes_comp.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes_comp.pass.cpp index 7e1aef4..299dc89 100644 --- a/libcxx/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes_comp.pass.cpp +++ b/libcxx/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes_comp.pass.cpp @@ -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())); assert(!std::includes(Iter1(ia), Iter1(ia), Iter2(ib), Iter2(ib+1), std::less())); -- 2.7.4