summaryrefslogtreecommitdiffstats
path: root/libcxx/test
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2016-12-03 00:27:13 +0000
committerEric Fiselier <eric@efcs.ca>2016-12-03 00:27:13 +0000
commit465bd0fc004592dc0eb6a2971c38fcb4f80445bc (patch)
treedc335364d7a6ae31c56d15511289e132cdcd2f0a /libcxx/test
parentd7a50d1d6b097d5fbf64d7aaa4d76adede1a5106 (diff)
downloadbcm5719-llvm-465bd0fc004592dc0eb6a2971c38fcb4f80445bc.tar.gz
bcm5719-llvm-465bd0fc004592dc0eb6a2971c38fcb4f80445bc.zip
Enable warnings by default for C++ >= 11 and fix -Wshadow occurances
llvm-svn: 288557
Diffstat (limited to 'libcxx/test')
-rw-r--r--libcxx/test/libcxx/test/config.py5
-rw-r--r--libcxx/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp7
-rw-r--r--libcxx/test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp2
-rw-r--r--libcxx/test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp2
-rw-r--r--libcxx/test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp2
-rw-r--r--libcxx/test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp2
-rw-r--r--libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp6
-rw-r--r--libcxx/test/std/experimental/memory/memory.resource/memory.resource.public/allocate.pass.cpp4
-rw-r--r--libcxx/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.index/difference_type.pass.cpp33
-rw-r--r--libcxx/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp24
10 files changed, 42 insertions, 45 deletions
diff --git a/libcxx/test/libcxx/test/config.py b/libcxx/test/libcxx/test/config.py
index 94499596989..4a2c1d72bfe 100644
--- a/libcxx/test/libcxx/test/config.py
+++ b/libcxx/test/libcxx/test/config.py
@@ -640,8 +640,7 @@ class Configuration(object):
'-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER',
'-Wall', '-Wextra', '-Werror'
]
- # FIXME turn this back on after fixing potential breakage.
- #self.cxx.addWarningFlagIfSupported('-Wshadow')
+ self.cxx.addWarningFlagIfSupported('-Wshadow')
self.cxx.addWarningFlagIfSupported('-Wno-unused-command-line-argument')
self.cxx.addWarningFlagIfSupported('-Wno-attributes')
self.cxx.addWarningFlagIfSupported('-Wno-pessimizing-move')
@@ -649,10 +648,10 @@ class Configuration(object):
self.cxx.addWarningFlagIfSupported('-Wno-user-defined-literals')
# TODO(EricWF) Remove the unused warnings once the test suite
# compiles clean with them.
+ self.cxx.addWarningFlagIfSupported('-Wno-sign-compare')
self.cxx.addWarningFlagIfSupported('-Wno-unused-local-typedef')
self.cxx.addWarningFlagIfSupported('-Wno-unused-variable')
self.cxx.addWarningFlagIfSupported('-Wno-unused-parameter')
- self.cxx.addWarningFlagIfSupported('-Wno-sign-compare')
std = self.get_lit_conf('std', None)
if std in ['c++98', 'c++03']:
# The '#define static_assert' provided by libc++ in C++03 mode
diff --git a/libcxx/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp b/libcxx/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp
index a6becb1bafa..830e8123150 100644
--- a/libcxx/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp
+++ b/libcxx/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp
@@ -87,9 +87,10 @@ TEST_CASE(access_denied_test_case)
env.create_file(testFile, 42);
// Test that we can iterator over the directory before changing the perms
- directory_iterator it(testDir);
- TEST_REQUIRE(it != directory_iterator{});
-
+ {
+ directory_iterator it(testDir);
+ TEST_REQUIRE(it != directory_iterator{});
+ }
// Change the permissions so we can no longer iterate
permissions(testDir, perms::none);
diff --git a/libcxx/test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp b/libcxx/test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp
index 5be934968c4..7881c9700d6 100644
--- a/libcxx/test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp
+++ b/libcxx/test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp
@@ -28,7 +28,6 @@ namespace fs = std::experimental::filesystem;
int main() {
using namespace fs;
- const path p("/foo/bar/baz");
{
path p;
ASSERT_NOEXCEPT(p.clear());
@@ -37,6 +36,7 @@ int main() {
assert(p.empty());
}
{
+ const path p("/foo/bar/baz");
path p2(p);
assert(p == p2);
p2.clear();
diff --git a/libcxx/test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp b/libcxx/test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp
index 7cf3564bb9b..79660943272 100644
--- a/libcxx/test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp
+++ b/libcxx/test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp
@@ -30,8 +30,8 @@ int main()
using namespace fs;
const char* const value = "hello world";
const std::string str_value = value;
- path p(value);
{ // Check signature
+ path p(value);
ASSERT_SAME_TYPE(path::value_type const*, decltype(p.c_str()));
ASSERT_NOEXCEPT(p.c_str());
}
diff --git a/libcxx/test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp b/libcxx/test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp
index 7f8df27faf0..db132648377 100644
--- a/libcxx/test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp
+++ b/libcxx/test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp
@@ -28,8 +28,8 @@ int main()
{
using namespace fs;
const char* const value = "hello world";
- path p(value);
{ // Check signature
+ path p(value);
ASSERT_SAME_TYPE(path::string_type const&, decltype(p.native()));
ASSERT_NOEXCEPT(p.native());
}
diff --git a/libcxx/test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp b/libcxx/test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp
index 9ef83f989aa..013d26cdb7f 100644
--- a/libcxx/test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp
+++ b/libcxx/test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp
@@ -30,8 +30,8 @@ int main()
using namespace fs;
using string_type = path::string_type;
const char* const value = "hello world";
- path p(value);
{ // Check signature
+ path p(value);
static_assert(std::is_convertible<path, string_type>::value, "");
static_assert(std::is_constructible<string_type, path>::value, "");
ASSERT_SAME_TYPE(string_type, decltype(p.operator string_type()));
diff --git a/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp b/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp
index 1cddccd0d72..8f6009d399c 100644
--- a/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp
+++ b/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp
@@ -91,8 +91,10 @@ TEST_CASE(access_denied_test_case)
env.create_file(testFile, 42);
// Test that we can iterator over the directory before changing the perms
- RDI it(testDir);
- TEST_REQUIRE(it != RDI{});
+ {
+ RDI it(testDir);
+ TEST_REQUIRE(it != RDI{});
+ }
// Change the permissions so we can no longer iterate
permissions(testDir, perms::none);
diff --git a/libcxx/test/std/experimental/memory/memory.resource/memory.resource.public/allocate.pass.cpp b/libcxx/test/std/experimental/memory/memory.resource/memory.resource.public/allocate.pass.cpp
index 26cf903fe0d..efb529b3c11 100644
--- a/libcxx/test/std/experimental/memory/memory.resource/memory.resource.public/allocate.pass.cpp
+++ b/libcxx/test/std/experimental/memory/memory.resource/memory.resource.public/allocate.pass.cpp
@@ -73,8 +73,8 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
{
TestResource R2;
- auto& P = R2.getController();
- P.throw_on_alloc = true;
+ auto& P2 = R2.getController();
+ P2.throw_on_alloc = true;
memory_resource& M2 = R2;
try {
M2.allocate(42);
diff --git a/libcxx/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.index/difference_type.pass.cpp b/libcxx/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.index/difference_type.pass.cpp
index 928da00617e..bf7a8e33ee5 100644
--- a/libcxx/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.index/difference_type.pass.cpp
+++ b/libcxx/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.index/difference_type.pass.cpp
@@ -18,9 +18,7 @@
#include <iterator>
#include <cassert>
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#include <memory>
-#endif
#include "test_macros.h"
#include "test_iterators.h"
@@ -36,29 +34,28 @@ test(It i, typename std::iterator_traits<It>::difference_type n,
assert(rr == x);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
struct do_nothing
{
void operator()(void*) const {}
};
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
int main()
{
- char s[] = "1234567890";
- test(random_access_iterator<char*>(s+5), 4, '0');
- test(s+5, 4, '0');
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- int i[5];
- typedef std::unique_ptr<int, do_nothing> Ptr;
- Ptr p[5];
- for (unsigned j = 0; j < 5; ++j)
- p[j].reset(i+j);
- test(p, 3, Ptr(i+3));
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
+ {
+ char s[] = "1234567890";
+ test(random_access_iterator<char*>(s+5), 4, '0');
+ test(s+5, 4, '0');
+ }
+#if TEST_STD_VER >= 11
+ {
+ int i[5];
+ typedef std::unique_ptr<int, do_nothing> Ptr;
+ Ptr p[5];
+ for (unsigned j = 0; j < 5; ++j)
+ p[j].reset(i+j);
+ test(p, 3, Ptr(i+3));
+ }
+#endif
#if TEST_STD_VER > 14
{
constexpr const char *p = "123456789";
diff --git a/libcxx/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp b/libcxx/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp
index 5665cb86cf1..4c5d816b8c2 100644
--- a/libcxx/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp
+++ b/libcxx/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp
@@ -17,9 +17,7 @@
#include <iterator>
#include <cassert>
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#include <memory>
-#endif
#include "test_macros.h"
@@ -44,25 +42,25 @@ test(It i, typename std::iterator_traits<It>::value_type x)
assert(x2 == x);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
struct do_nothing
{
void operator()(void*) const {}
};
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
int main()
{
- A a;
- test(&a, A());
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- int i;
- std::unique_ptr<int, do_nothing> p(&i);
- test(&p, std::unique_ptr<int, do_nothing>(&i));
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
+ {
+ A a;
+ test(&a, A());
+ }
+#if TEST_STD_VER >= 11
+ {
+ int i;
+ std::unique_ptr<int, do_nothing> p(&i);
+ test(&p, std::unique_ptr<int, do_nothing>(&i));
+ }
+#endif
#if TEST_STD_VER > 14
{
constexpr const char *p = "123456789";
OpenPOWER on IntegriCloud