[libcxx-commits] [libcxxabi] f3ee669 - [libcxxabi] [test] Avoid mingw warnings about missing a return statement

Martin Storsjö via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 19 03:37:03 PDT 2023


Author: Martin Storsjö
Date: 2023-04-19T13:35:37+03:00
New Revision: f3ee6695e0f6232fee96e2e6ccd96e85ed682998

URL: https://github.com/llvm/llvm-project/commit/f3ee6695e0f6232fee96e2e6ccd96e85ed682998
DIFF: https://github.com/llvm/llvm-project/commit/f3ee6695e0f6232fee96e2e6ccd96e85ed682998.diff

LOG: [libcxxabi] [test] Avoid mingw warnings about missing a return statement

With current versions of mingw-w64 headers, code following
assert(false) isn't considered unreachable - thus add a dummy
"return nullptr;", to avoid warnings (treated as errors) for a
missing return statement.

The root cause does get fixed further upstream in mingw-w64 in
https://github.com/mingw-w64/mingw-w64/commit/1690994f515910a31b9fb7c7bd3a52d4ba987abe
though.

Differential Revision: https://reviews.llvm.org/D147860

Added: 
    

Modified: 
    libcxxabi/test/cxa_vec_new_overflow_PR41395.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxxabi/test/cxa_vec_new_overflow_PR41395.pass.cpp b/libcxxabi/test/cxa_vec_new_overflow_PR41395.pass.cpp
index 16239e75f559..a4a2bbd99e6e 100644
--- a/libcxxabi/test/cxa_vec_new_overflow_PR41395.pass.cpp
+++ b/libcxxabi/test/cxa_vec_new_overflow_PR41395.pass.cpp
@@ -18,7 +18,7 @@
 void dummy_ctor(void*) { assert(false && "should not be called"); }
 void dummy_dtor(void*) { assert(false && "should not be called"); }
 
-void *dummy_alloc(size_t) { assert(false && "should not be called"); }
+void *dummy_alloc(size_t) { assert(false && "should not be called"); return nullptr; }
 void dummy_dealloc(void*) { assert(false && "should not be called"); }
 void dummy_dealloc_sized(void*, size_t) { assert(false && "should not be called"); }
 


        


More information about the libcxx-commits mailing list