[libcxx] r288557 - Enable warnings by default for C++ >= 11 and fix -Wshadow occurances
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 2 16:27:14 PST 2016
Author: ericwf
Date: Fri Dec 2 18:27:13 2016
New Revision: 288557
URL: http://llvm.org/viewvc/llvm-project?rev=288557&view=rev
Log:
Enable warnings by default for C++ >= 11 and fix -Wshadow occurances
Modified:
libcxx/trunk/test/libcxx/test/config.py
libcxx/trunk/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp
libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp
libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp
libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp
libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp
libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp
libcxx/trunk/test/std/experimental/memory/memory.resource/memory.resource.public/allocate.pass.cpp
libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.index/difference_type.pass.cpp
libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp
Modified: libcxx/trunk/test/libcxx/test/config.py
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/config.py?rev=288557&r1=288556&r2=288557&view=diff
==============================================================================
--- libcxx/trunk/test/libcxx/test/config.py (original)
+++ libcxx/trunk/test/libcxx/test/config.py Fri Dec 2 18:27:13 2016
@@ -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
Modified: libcxx/trunk/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp?rev=288557&r1=288556&r2=288557&view=diff
==============================================================================
--- libcxx/trunk/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp (original)
+++ libcxx/trunk/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp Fri Dec 2 18:27:13 2016
@@ -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);
Modified: libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp?rev=288557&r1=288556&r2=288557&view=diff
==============================================================================
--- libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp (original)
+++ libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp Fri Dec 2 18:27:13 2016
@@ -28,7 +28,6 @@ namespace fs = std::experimental::filesy
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();
Modified: libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp?rev=288557&r1=288556&r2=288557&view=diff
==============================================================================
--- libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp (original)
+++ libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp Fri Dec 2 18:27:13 2016
@@ -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());
}
Modified: libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp?rev=288557&r1=288556&r2=288557&view=diff
==============================================================================
--- libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp (original)
+++ libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp Fri Dec 2 18:27:13 2016
@@ -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());
}
Modified: libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp?rev=288557&r1=288556&r2=288557&view=diff
==============================================================================
--- libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp (original)
+++ libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp Fri Dec 2 18:27:13 2016
@@ -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()));
Modified: libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp?rev=288557&r1=288556&r2=288557&view=diff
==============================================================================
--- libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp (original)
+++ libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp Fri Dec 2 18:27:13 2016
@@ -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);
Modified: libcxx/trunk/test/std/experimental/memory/memory.resource/memory.resource.public/allocate.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/memory/memory.resource/memory.resource.public/allocate.pass.cpp?rev=288557&r1=288556&r2=288557&view=diff
==============================================================================
--- libcxx/trunk/test/std/experimental/memory/memory.resource/memory.resource.public/allocate.pass.cpp (original)
+++ libcxx/trunk/test/std/experimental/memory/memory.resource/memory.resource.public/allocate.pass.cpp Fri Dec 2 18:27:13 2016
@@ -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);
Modified: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.index/difference_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.index/difference_type.pass.cpp?rev=288557&r1=288556&r2=288557&view=diff
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.index/difference_type.pass.cpp (original)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.index/difference_type.pass.cpp Fri Dec 2 18:27:13 2016
@@ -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
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";
Modified: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp?rev=288557&r1=288556&r2=288557&view=diff
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp (original)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp Fri Dec 2 18:27:13 2016
@@ -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
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";
More information about the cfe-commits
mailing list