[libcxx-commits] [PATCH] D99214: [libcxx] [test] Add return values after assert(false) in some experimental tests

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 23 13:46:24 PDT 2021


mstorsjo created this revision.
mstorsjo requested review of this revision.
Herald added a project: libc++.
Herald added a reviewer: libc++.

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).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99214

Files:
  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


Index: libcxx/test/std/experimental/memory/memory.resource.global/null_memory_resource.pass.cpp
===================================================================
--- libcxx/test/std/experimental/memory/memory.resource.global/null_memory_resource.pass.cpp
+++ libcxx/test/std/experimental/memory/memory.resource.global/null_memory_resource.pass.cpp
@@ -26,13 +26,13 @@
 {
 protected:
     virtual void * do_allocate(size_t, size_t)
-    { assert(false); }
+    { assert(false); return nullptr; }
 
     virtual void do_deallocate(void *, size_t, size_t)
     { assert(false); }
 
     virtual bool do_is_equal(ex::memory_resource const &) const noexcept
-    { assert(false); }
+    { assert(false); return false; }
 };
 
 void test_return()
Index: libcxx/test/std/experimental/memory/memory.resource.global/new_delete_resource.pass.cpp
===================================================================
--- libcxx/test/std/experimental/memory/memory.resource.global/new_delete_resource.pass.cpp
+++ libcxx/test/std/experimental/memory/memory.resource.global/new_delete_resource.pass.cpp
@@ -26,13 +26,13 @@
 {
 protected:
     virtual void * do_allocate(size_t, size_t)
-    { assert(false); }
+    { assert(false); return nullptr; }
 
     virtual void do_deallocate(void *, size_t, size_t)
     { assert(false); }
 
     virtual bool do_is_equal(ex::memory_resource const &) const noexcept
-    { assert(false); }
+    { assert(false); return false; }
 };
 
 void test_return()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99214.332779.patch
Type: text/x-patch
Size: 1483 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210323/613c54b5/attachment.bin>


More information about the libcxx-commits mailing list