[libcxx-commits] [libcxx] b6c4b28 - [libcxx] [test] Add return values after assert(false) in some experimental tests
Martin Storsjö via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Mar 24 02:44:12 PDT 2021
Author: Martin Storsjö
Date: 2021-03-24T11:44:01+02:00
New Revision: b6c4b280a01f1a16b0b4258a1034bebc13f1f7e3
URL: https://github.com/llvm/llvm-project/commit/b6c4b280a01f1a16b0b4258a1034bebc13f1f7e3
DIFF: https://github.com/llvm/llvm-project/commit/b6c4b280a01f1a16b0b4258a1034bebc13f1f7e3.diff
LOG: [libcxx] [test] Add return values after assert(false) in some experimental tests
When building in MSVC mode (in release mode), the assert(false) don't
make the end of the function unreachable, so add return statements to
silence compiler warnings (treated as errors).
Also change 'virtual' into 'override', which was requested in review,
as these files require C++11.
Differential Revision: https://reviews.llvm.org/D99214
Added:
Modified:
libcxx/test/std/experimental/memory/memory.resource.global/new_delete_resource.pass.cpp
libcxx/test/std/experimental/memory/memory.resource.global/null_memory_resource.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/test/std/experimental/memory/memory.resource.global/new_delete_resource.pass.cpp b/libcxx/test/std/experimental/memory/memory.resource.global/new_delete_resource.pass.cpp
index 8c7af9dff376b..91bf1f5efd918 100644
--- a/libcxx/test/std/experimental/memory/memory.resource.global/new_delete_resource.pass.cpp
+++ b/libcxx/test/std/experimental/memory/memory.resource.global/new_delete_resource.pass.cpp
@@ -25,14 +25,14 @@ namespace ex = std::experimental::pmr;
struct assert_on_compare : public ex::memory_resource
{
protected:
- virtual void * do_allocate(size_t, size_t)
- { assert(false); }
+ void * do_allocate(size_t, size_t) override
+ { assert(false); return nullptr; }
- virtual void do_deallocate(void *, size_t, size_t)
+ void do_deallocate(void *, size_t, size_t) override
{ assert(false); }
- virtual bool do_is_equal(ex::memory_resource const &) const noexcept
- { assert(false); }
+ bool do_is_equal(ex::memory_resource const &) const noexcept override
+ { assert(false); return false; }
};
void test_return()
diff --git a/libcxx/test/std/experimental/memory/memory.resource.global/null_memory_resource.pass.cpp b/libcxx/test/std/experimental/memory/memory.resource.global/null_memory_resource.pass.cpp
index c7efeab186b0b..bdd62484d0759 100644
--- a/libcxx/test/std/experimental/memory/memory.resource.global/null_memory_resource.pass.cpp
+++ b/libcxx/test/std/experimental/memory/memory.resource.global/null_memory_resource.pass.cpp
@@ -25,14 +25,14 @@ namespace ex = std::experimental::pmr;
struct assert_on_compare : public ex::memory_resource
{
protected:
- virtual void * do_allocate(size_t, size_t)
- { assert(false); }
+ void * do_allocate(size_t, size_t) override
+ { assert(false); return nullptr; }
- virtual void do_deallocate(void *, size_t, size_t)
+ void do_deallocate(void *, size_t, size_t) override
{ assert(false); }
- virtual bool do_is_equal(ex::memory_resource const &) const noexcept
- { assert(false); }
+ bool do_is_equal(ex::memory_resource const &) const noexcept override
+ { assert(false); return false; }
};
void test_return()
More information about the libcxx-commits
mailing list