[libcxx-commits] [libcxx] 504bc07 - [runtimes] Use int main(int, char**) consistently in tests

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Oct 8 11:28:29 PDT 2020


Author: Louis Dionne
Date: 2020-10-08T14:28:13-04:00
New Revision: 504bc07d1afc7bad7b980a977141696ec8298e7e

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

LOG: [runtimes] Use int main(int, char**) consistently in tests

This is needed when running the tests in Freestanding mode, where main()
isn't treated specially. In Freestanding, main() doesn't get mangled as
extern "C", so whatever runtime we're using fails to find the entry point.

One way to solve this problem is to define a symbol alias from __Z4mainiPPc
to _main, however this requires all definitions of main() to have the same
mangling. Hence this commit.

Added: 
    libcxx/test/std/strings/string.view/string.view.io/stream_insert_decl_present.compile.pass.cpp
    libunwind/test/alignment.compile.pass.cpp

Modified: 
    libcxx/test/libcxx/depr/depr.c.headers/math_h.compile.pass.cpp
    libcxx/test/libcxx/depr/depr.c.headers/stdint_h.std_types_t.compile.pass.cpp
    libcxx/test/libcxx/depr/depr.c.headers/stdint_h.xopen_source.compile.pass.cpp
    libcxx/test/libcxx/language.support/support.rtti/type.info/type_info.comparison.merged.sh.cpp
    libcxx/test/libcxx/language.support/support.rtti/type.info/type_info.comparison.unmerged.sh.cpp
    libcxx/test/libcxx/min_max_macros.compile.pass.cpp
    libcxx/test/libcxx/no_assert_include.compile.pass.cpp
    libcxx/test/libcxx/numerics/clamp_to_integral.pass.cpp
    libcxx/test/libcxx/selftest/compile.fail.cpp/compile-error.compile.fail.cpp
    libcxx/test/libcxx/selftest/compile.fail.cpp/compile-success.compile.fail.cpp
    libcxx/test/libcxx/selftest/compile.pass.cpp/compile-error.compile.pass.cpp
    libcxx/test/libcxx/selftest/compile.pass.cpp/compile-success.compile.pass.cpp
    libcxx/test/libcxx/selftest/compile.pass.cpp/link-error.compile.pass.cpp
    libcxx/test/libcxx/selftest/compile.pass.cpp/run-error.compile.pass.cpp
    libcxx/test/libcxx/selftest/fail.cpp/compile-success.fail.cpp
    libcxx/test/libcxx/selftest/fail.cpp/no-diagnostics-unmarked.fail.cpp
    libcxx/test/libcxx/selftest/fail.cpp/right-diagnostic.fail.cpp
    libcxx/test/libcxx/selftest/fail.cpp/wrong-diagnostic.fail.cpp
    libcxx/test/libcxx/selftest/link.fail.cpp/compile-error.link.fail.cpp
    libcxx/test/libcxx/selftest/link.fail.cpp/link-error.link.fail.cpp
    libcxx/test/libcxx/selftest/link.fail.cpp/link-success.link.fail.cpp
    libcxx/test/libcxx/selftest/link.pass.cpp/compile-error.link.pass.cpp
    libcxx/test/libcxx/selftest/link.pass.cpp/link-error.link.pass.cpp
    libcxx/test/libcxx/selftest/link.pass.cpp/link-success.link.pass.cpp
    libcxx/test/libcxx/selftest/link.pass.cpp/run-error.link.pass.cpp
    libcxx/test/libcxx/selftest/pass.cpp/compile-error.pass.cpp
    libcxx/test/libcxx/selftest/pass.cpp/link-error.pass.cpp
    libcxx/test/libcxx/selftest/pass.cpp/run-error.pass.cpp
    libcxx/test/libcxx/selftest/pass.cpp/run-success.pass.cpp
    libcxx/test/libcxx/selftest/pass.cpp/werror.pass.cpp
    libcxx/test/libcxx/selftest/pass.mm/compile-error.pass.mm
    libcxx/test/libcxx/selftest/pass.mm/link-error.pass.mm
    libcxx/test/libcxx/selftest/pass.mm/no-arc.pass.mm
    libcxx/test/libcxx/selftest/pass.mm/run-error.pass.mm
    libcxx/test/libcxx/selftest/pass.mm/run-success.pass.mm
    libcxx/test/libcxx/selftest/pass.mm/use-objective-cxx.pass.mm
    libcxx/test/libcxx/selftest/run.fail.cpp/compile-error.run.fail.cpp
    libcxx/test/libcxx/selftest/run.fail.cpp/link-error.run.fail.cpp
    libcxx/test/libcxx/selftest/run.fail.cpp/run-error.run.fail.cpp
    libcxx/test/libcxx/selftest/run.fail.cpp/run-success.run.fail.cpp
    libcxx/test/libcxx/selftest/sh.cpp/werror.sh.cpp
    libcxx/test/libcxx/selftest/verify.cpp/no-diagnostics-unmarked.verify.cpp
    libcxx/test/libcxx/selftest/verify.cpp/no-werror.verify.cpp
    libcxx/test/libcxx/strings/basic.string/PR42676.sh.cpp
    libcxx/test/libcxx/utilities/function.objects/abi_bug_cxx03_cxx11_example.sh.cpp
    libcxx/test/libcxx/utilities/function.objects/func.wrap/depr_in_cxx03.verify.cpp
    libcxx/test/libcxx/utilities/meta/stress_tests/stress_test_variant_overloads_impl.sh.cpp
    libcxx/test/std/containers/sequences/vector/vector.modifiers/resize_not_move_insertable.fail.cpp
    libcxx/test/std/input.output/iostream.objects/init.pass.cpp
    libcxx/test/std/language.support/support.dynamic/destroying_delete_t.pass.cpp
    libcxx/test/std/language.support/support.dynamic/destroying_delete_t_declaration.pass.cpp
    libcxx/test/std/namespace/addressable_functions.sh.cpp
    libcxx/test/std/numerics/bit/bit.pow.two/ceil2.fail.cpp
    libcxx/test/std/numerics/bit/bit.pow.two/ceil2.pass.cpp
    libcxx/test/std/numerics/bit/bit.pow.two/floor2.pass.cpp
    libcxx/test/std/numerics/bit/bit.pow.two/ispow2.pass.cpp
    libcxx/test/std/numerics/bit/bit.pow.two/log2p1.pass.cpp
    libcxx/test/std/numerics/bit/bitops.count/countl_one.pass.cpp
    libcxx/test/std/numerics/bit/bitops.count/countl_zero.pass.cpp
    libcxx/test/std/numerics/bit/bitops.count/countr_one.pass.cpp
    libcxx/test/std/numerics/bit/bitops.count/countr_zero.pass.cpp
    libcxx/test/std/numerics/bit/bitops.count/popcount.pass.cpp
    libcxx/test/std/numerics/bit/bitops.rot/rotl.pass.cpp
    libcxx/test/std/numerics/bit/bitops.rot/rotr.pass.cpp
    libcxx/test/std/numerics/numbers/defined.pass.cpp
    libcxx/test/std/numerics/numbers/illformed.verify.cpp
    libcxx/test/std/numerics/numbers/specialize.pass.cpp
    libcxx/test/std/numerics/numbers/user_type.pass.cpp
    libcxx/test/std/numerics/numbers/value.pass.cpp
    libcxx/test/std/re/re.const/re.matchflag/match_prev_avail.pass.cpp
    libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/adopt_lock.pass.cpp
    libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.pass.cpp
    libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/deduct_F.fail.cpp
    libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/deduct_F.pass.cpp
    libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/deduct_ptr.pass.cpp
    libcxx/test/std/utilities/function.objects/refwrap/refwrap.const/ctor.incomplete.pass.cpp
    libcxx/test/std/utilities/function.objects/refwrap/refwrap.helpers/cref.incomplete.pass.cpp
    libcxx/test/std/utilities/function.objects/refwrap/refwrap.helpers/ref.incomplete.pass.cpp
    libcxx/test/std/utilities/function.objects/refwrap/refwrap.invoke/invoke.incomplete.compile.fail.cpp
    libcxxabi/test/backtrace_test.pass.cpp
    libcxxabi/test/catch_array_01.pass.cpp
    libcxxabi/test/catch_array_02.pass.cpp
    libcxxabi/test/catch_class_01.pass.cpp
    libcxxabi/test/catch_class_02.pass.cpp
    libcxxabi/test/catch_class_03.pass.cpp
    libcxxabi/test/catch_class_04.pass.cpp
    libcxxabi/test/catch_const_pointer_nullptr.pass.cpp
    libcxxabi/test/catch_function_01.pass.cpp
    libcxxabi/test/catch_function_02.pass.cpp
    libcxxabi/test/catch_function_03.pass.cpp
    libcxxabi/test/catch_in_noexcept.pass.cpp
    libcxxabi/test/catch_member_data_pointer_01.pass.cpp
    libcxxabi/test/catch_member_function_pointer_01.pass.cpp
    libcxxabi/test/catch_member_function_pointer_02.pass.cpp
    libcxxabi/test/catch_member_pointer_nullptr.pass.cpp
    libcxxabi/test/catch_multi_level_pointer.pass.cpp
    libcxxabi/test/catch_pointer_nullptr.pass.cpp
    libcxxabi/test/catch_pointer_reference.pass.cpp
    libcxxabi/test/catch_ptr.pass.cpp
    libcxxabi/test/catch_ptr_02.pass.cpp
    libcxxabi/test/catch_reference_nullptr.pass.cpp
    libcxxabi/test/cxa_thread_atexit_test.pass.cpp
    libcxxabi/test/dynamic_cast.pass.cpp
    libcxxabi/test/dynamic_cast14.pass.cpp
    libcxxabi/test/dynamic_cast3.pass.cpp
    libcxxabi/test/dynamic_cast5.pass.cpp
    libcxxabi/test/dynamic_cast_stress.pass.cpp
    libcxxabi/test/exception_object_alignment.2.pass.cpp
    libcxxabi/test/exception_object_alignment.pass.cpp
    libcxxabi/test/guard_test_basic.pass.cpp
    libcxxabi/test/guard_threaded_test.pass.cpp
    libcxxabi/test/incomplete_type.sh.cpp
    libcxxabi/test/inherited_exception.pass.cpp
    libcxxabi/test/test_aux_runtime_op_array_new.pass.cpp
    libcxxabi/test/test_demangle.pass.cpp
    libcxxabi/test/test_exception_address_alignment.pass.cpp
    libcxxabi/test/test_guard.pass.cpp
    libcxxabi/test/test_vector3.pass.cpp
    libcxxabi/test/thread_local_destruction_order.pass.cpp
    libcxxabi/test/unittest_demangle.pass.cpp
    libcxxabi/test/unwind_01.pass.cpp
    libcxxabi/test/unwind_02.pass.cpp
    libcxxabi/test/unwind_03.pass.cpp
    libcxxabi/test/unwind_04.pass.cpp
    libcxxabi/test/unwind_05.pass.cpp
    libcxxabi/test/unwind_06.pass.cpp
    libunwind/test/frameheadercache_test.pass.cpp
    libunwind/test/libunwind_01.pass.cpp
    libunwind/test/libunwind_02.pass.cpp
    libunwind/test/signal_frame.pass.cpp
    libunwind/test/signal_unwind.pass.cpp
    libunwind/test/unw_getcontext.pass.cpp
    libunwind/test/unwind_leaffunction.pass.cpp

Removed: 
    libcxx/test/std/strings/string.view/string.view.io/stream_insert_decl_present.pass.cpp
    libunwind/test/alignment.pass.cpp


################################################################################
diff  --git a/libcxx/test/libcxx/depr/depr.c.headers/math_h.compile.pass.cpp b/libcxx/test/libcxx/depr/depr.c.headers/math_h.compile.pass.cpp
index b878b6342800..045745b5ff95 100644
--- a/libcxx/test/libcxx/depr/depr.c.headers/math_h.compile.pass.cpp
+++ b/libcxx/test/libcxx/depr/depr.c.headers/math_h.compile.pass.cpp
@@ -24,5 +24,3 @@
 #       error M_PI not defined
 #   endif
 #endif
-
-int main() { }

diff  --git a/libcxx/test/libcxx/depr/depr.c.headers/stdint_h.std_types_t.compile.pass.cpp b/libcxx/test/libcxx/depr/depr.c.headers/stdint_h.std_types_t.compile.pass.cpp
index 813e3b351725..3485ce755f97 100644
--- a/libcxx/test/libcxx/depr/depr.c.headers/stdint_h.std_types_t.compile.pass.cpp
+++ b/libcxx/test/libcxx/depr/depr.c.headers/stdint_h.std_types_t.compile.pass.cpp
@@ -261,5 +261,3 @@
 #ifndef UINTMAX_C
 #error UINTMAX_C not defined
 #endif
-
-int main() { }

diff  --git a/libcxx/test/libcxx/depr/depr.c.headers/stdint_h.xopen_source.compile.pass.cpp b/libcxx/test/libcxx/depr/depr.c.headers/stdint_h.xopen_source.compile.pass.cpp
index 2cfd8661c953..688bab4e8c80 100644
--- a/libcxx/test/libcxx/depr/depr.c.headers/stdint_h.xopen_source.compile.pass.cpp
+++ b/libcxx/test/libcxx/depr/depr.c.headers/stdint_h.xopen_source.compile.pass.cpp
@@ -258,5 +258,3 @@
 #ifndef UINTMAX_C
 #error UINTMAX_C not defined
 #endif
-
-int main() { }

diff  --git a/libcxx/test/libcxx/language.support/support.rtti/type.info/type_info.comparison.merged.sh.cpp b/libcxx/test/libcxx/language.support/support.rtti/type.info/type_info.comparison.merged.sh.cpp
index e4cf05ac72c0..da80337f90bd 100644
--- a/libcxx/test/libcxx/language.support/support.rtti/type.info/type_info.comparison.merged.sh.cpp
+++ b/libcxx/test/libcxx/language.support/support.rtti/type.info/type_info.comparison.merged.sh.cpp
@@ -32,12 +32,13 @@ void register2();
 #elif defined(MAIN)
   std::vector<std::type_index> registry;
 
-  int main() {
+  int main(int, char**) {
     register1();
     register2();
 
     assert(registry.size() == 2);
     assert(registry[0] != registry[1]);
+    return 0;
   }
 #else
 # error

diff  --git a/libcxx/test/libcxx/language.support/support.rtti/type.info/type_info.comparison.unmerged.sh.cpp b/libcxx/test/libcxx/language.support/support.rtti/type.info/type_info.comparison.unmerged.sh.cpp
index 3ce47dbb0296..9b94fcbc1c92 100644
--- a/libcxx/test/libcxx/language.support/support.rtti/type.info/type_info.comparison.unmerged.sh.cpp
+++ b/libcxx/test/libcxx/language.support/support.rtti/type.info/type_info.comparison.unmerged.sh.cpp
@@ -32,12 +32,13 @@ void register2();
 #elif defined(MAIN)
   std::vector<std::type_index> registry;
 
-  int main() {
+  int main(int, char**) {
     register1();
     register2();
 
     assert(registry.size() == 2);
     assert(registry[0] == registry[1]);
+    return 0;
   }
 #else
 # error

diff  --git a/libcxx/test/libcxx/min_max_macros.compile.pass.cpp b/libcxx/test/libcxx/min_max_macros.compile.pass.cpp
index 461fe9e5964b..9e9edb86e791 100644
--- a/libcxx/test/libcxx/min_max_macros.compile.pass.cpp
+++ b/libcxx/test/libcxx/min_max_macros.compile.pass.cpp
@@ -285,5 +285,3 @@ TEST_MACROS();
 TEST_MACROS();
 #include <ext/hash_set>
 TEST_MACROS();
-
-int main() { }

diff  --git a/libcxx/test/libcxx/no_assert_include.compile.pass.cpp b/libcxx/test/libcxx/no_assert_include.compile.pass.cpp
index fc83df6b4faf..3cb58cd5ca56 100644
--- a/libcxx/test/libcxx/no_assert_include.compile.pass.cpp
+++ b/libcxx/test/libcxx/no_assert_include.compile.pass.cpp
@@ -170,5 +170,3 @@
 #ifdef assert
 #error "Do not include cassert or assert.h in standard header files"
 #endif
-
-int main() { }

diff  --git a/libcxx/test/libcxx/numerics/clamp_to_integral.pass.cpp b/libcxx/test/libcxx/numerics/clamp_to_integral.pass.cpp
index cb3336f52ba2..cbaf4b761033 100644
--- a/libcxx/test/libcxx/numerics/clamp_to_integral.pass.cpp
+++ b/libcxx/test/libcxx/numerics/clamp_to_integral.pass.cpp
@@ -77,7 +77,7 @@ void test_float() {
   }
 }
 
-int main() {
+int main(int, char**) {
   test<short>();
   test<unsigned short>();
   test<int>();
@@ -87,4 +87,5 @@ int main() {
   test_float<short>();
   test_float<int>();
   test_float<long long>();
+  return 0;
 }

diff  --git a/libcxx/test/libcxx/selftest/compile.fail.cpp/compile-error.compile.fail.cpp b/libcxx/test/libcxx/selftest/compile.fail.cpp/compile-error.compile.fail.cpp
index bd1e0af8d639..9390f7c8eae3 100644
--- a/libcxx/test/libcxx/selftest/compile.fail.cpp/compile-error.compile.fail.cpp
+++ b/libcxx/test/libcxx/selftest/compile.fail.cpp/compile-error.compile.fail.cpp
@@ -11,4 +11,4 @@
 struct Foo { };
 typedef Foo::x x;
 
-int main() { }
+int main(int, char**) { return 0; }

diff  --git a/libcxx/test/libcxx/selftest/compile.fail.cpp/compile-success.compile.fail.cpp b/libcxx/test/libcxx/selftest/compile.fail.cpp/compile-success.compile.fail.cpp
index 1cec8a3632c1..1bc6bcd49a5c 100644
--- a/libcxx/test/libcxx/selftest/compile.fail.cpp/compile-success.compile.fail.cpp
+++ b/libcxx/test/libcxx/selftest/compile.fail.cpp/compile-success.compile.fail.cpp
@@ -10,4 +10,4 @@
 
 // Make sure the test DOES NOT pass if it succeeds at compile-time
 
-int main() { }
+int main(int, char**) { return 0; }

diff  --git a/libcxx/test/libcxx/selftest/compile.pass.cpp/compile-error.compile.pass.cpp b/libcxx/test/libcxx/selftest/compile.pass.cpp/compile-error.compile.pass.cpp
index 9ba8a5edbed9..6ff8850537f5 100644
--- a/libcxx/test/libcxx/selftest/compile.pass.cpp/compile-error.compile.pass.cpp
+++ b/libcxx/test/libcxx/selftest/compile.pass.cpp/compile-error.compile.pass.cpp
@@ -13,4 +13,4 @@
 struct Foo { };
 typedef Foo::x x;
 
-int main() { }
+int main(int, char**) { return 0; }

diff  --git a/libcxx/test/libcxx/selftest/compile.pass.cpp/compile-success.compile.pass.cpp b/libcxx/test/libcxx/selftest/compile.pass.cpp/compile-success.compile.pass.cpp
index 36d46904c8fc..16ca5f2d7166 100644
--- a/libcxx/test/libcxx/selftest/compile.pass.cpp/compile-success.compile.pass.cpp
+++ b/libcxx/test/libcxx/selftest/compile.pass.cpp/compile-success.compile.pass.cpp
@@ -8,4 +8,4 @@
 
 // Make sure the test passes if it succeeds to compile
 
-int main() { }
+int main(int, char**) { return 0; }

diff  --git a/libcxx/test/libcxx/selftest/compile.pass.cpp/link-error.compile.pass.cpp b/libcxx/test/libcxx/selftest/compile.pass.cpp/link-error.compile.pass.cpp
index 8dd6a5968828..b5f6e5df1090 100644
--- a/libcxx/test/libcxx/selftest/compile.pass.cpp/link-error.compile.pass.cpp
+++ b/libcxx/test/libcxx/selftest/compile.pass.cpp/link-error.compile.pass.cpp
@@ -10,6 +10,7 @@
 
 extern void this_is_an_undefined_symbol();
 
-int main() {
+int main(int, char**) {
     this_is_an_undefined_symbol();
+    return 0;
 }

diff  --git a/libcxx/test/libcxx/selftest/compile.pass.cpp/run-error.compile.pass.cpp b/libcxx/test/libcxx/selftest/compile.pass.cpp/run-error.compile.pass.cpp
index f3fbc64a38dd..dd1f084f6c1b 100644
--- a/libcxx/test/libcxx/selftest/compile.pass.cpp/run-error.compile.pass.cpp
+++ b/libcxx/test/libcxx/selftest/compile.pass.cpp/run-error.compile.pass.cpp
@@ -8,6 +8,6 @@
 
 // Make sure the test passes even if there's a runtime error, i.e. it isn't run.
 
-int main() {
+int main(int, char**) {
     return 1;
 }

diff  --git a/libcxx/test/libcxx/selftest/fail.cpp/compile-success.fail.cpp b/libcxx/test/libcxx/selftest/fail.cpp/compile-success.fail.cpp
index 3613dae3b9c2..e47efc6d01df 100644
--- a/libcxx/test/libcxx/selftest/fail.cpp/compile-success.fail.cpp
+++ b/libcxx/test/libcxx/selftest/fail.cpp/compile-success.fail.cpp
@@ -13,4 +13,4 @@
 
 // UNSUPPORTED: verify-support
 
-int main() { }
+int main(int, char**) { return 0; }

diff  --git a/libcxx/test/libcxx/selftest/fail.cpp/no-diagnostics-unmarked.fail.cpp b/libcxx/test/libcxx/selftest/fail.cpp/no-diagnostics-unmarked.fail.cpp
index e0ca921f3438..683a9c7fa7db 100644
--- a/libcxx/test/libcxx/selftest/fail.cpp/no-diagnostics-unmarked.fail.cpp
+++ b/libcxx/test/libcxx/selftest/fail.cpp/no-diagnostics-unmarked.fail.cpp
@@ -16,4 +16,4 @@
 // Note: For the purpose of this test, make sure the file would otherwise
 //       compile to make sure we really fail due to a lack of markup.
 
-int main() { }
+int main(int, char**) { return 0; }

diff  --git a/libcxx/test/libcxx/selftest/fail.cpp/right-diagnostic.fail.cpp b/libcxx/test/libcxx/selftest/fail.cpp/right-diagnostic.fail.cpp
index 95c36681590d..4d428813a118 100644
--- a/libcxx/test/libcxx/selftest/fail.cpp/right-diagnostic.fail.cpp
+++ b/libcxx/test/libcxx/selftest/fail.cpp/right-diagnostic.fail.cpp
@@ -14,4 +14,4 @@
 struct Foo { };
 typedef Foo::x x; // expected-error{{no type named 'x' in 'Foo'}}
 
-int main() { }
+int main(int, char**) { return 0; }

diff  --git a/libcxx/test/libcxx/selftest/fail.cpp/wrong-diagnostic.fail.cpp b/libcxx/test/libcxx/selftest/fail.cpp/wrong-diagnostic.fail.cpp
index 2072b8a8337e..f10623054a93 100644
--- a/libcxx/test/libcxx/selftest/fail.cpp/wrong-diagnostic.fail.cpp
+++ b/libcxx/test/libcxx/selftest/fail.cpp/wrong-diagnostic.fail.cpp
@@ -15,4 +15,4 @@
 struct Foo { };
 typedef Foo::x x; // expected-error{{this is not found in the errors}}
 
-int main() { }
+int main(int, char**) { return 0; }

diff  --git a/libcxx/test/libcxx/selftest/link.fail.cpp/compile-error.link.fail.cpp b/libcxx/test/libcxx/selftest/link.fail.cpp/compile-error.link.fail.cpp
index b0d709a082d2..607be79b8c08 100644
--- a/libcxx/test/libcxx/selftest/link.fail.cpp/compile-error.link.fail.cpp
+++ b/libcxx/test/libcxx/selftest/link.fail.cpp/compile-error.link.fail.cpp
@@ -13,4 +13,4 @@
 struct Foo { };
 typedef Foo::x x;
 
-int main() { }
+int main(int, char**) { return 0; }

diff  --git a/libcxx/test/libcxx/selftest/link.fail.cpp/link-error.link.fail.cpp b/libcxx/test/libcxx/selftest/link.fail.cpp/link-error.link.fail.cpp
index e40b6bf8f0ee..7289406723ef 100644
--- a/libcxx/test/libcxx/selftest/link.fail.cpp/link-error.link.fail.cpp
+++ b/libcxx/test/libcxx/selftest/link.fail.cpp/link-error.link.fail.cpp
@@ -10,6 +10,7 @@
 
 extern void this_is_an_undefined_symbol();
 
-int main() {
+int main(int, char**) {
     this_is_an_undefined_symbol();
+    return 0;
 }

diff  --git a/libcxx/test/libcxx/selftest/link.fail.cpp/link-success.link.fail.cpp b/libcxx/test/libcxx/selftest/link.fail.cpp/link-success.link.fail.cpp
index 43d3cc3ee714..95d812abc09e 100644
--- a/libcxx/test/libcxx/selftest/link.fail.cpp/link-success.link.fail.cpp
+++ b/libcxx/test/libcxx/selftest/link.fail.cpp/link-success.link.fail.cpp
@@ -10,4 +10,4 @@
 
 // Make sure the test DOES NOT pass if it succeeds to link.
 
-int main() { }
+int main(int, char**) { return 0; }

diff  --git a/libcxx/test/libcxx/selftest/link.pass.cpp/compile-error.link.pass.cpp b/libcxx/test/libcxx/selftest/link.pass.cpp/compile-error.link.pass.cpp
index b0d709a082d2..607be79b8c08 100644
--- a/libcxx/test/libcxx/selftest/link.pass.cpp/compile-error.link.pass.cpp
+++ b/libcxx/test/libcxx/selftest/link.pass.cpp/compile-error.link.pass.cpp
@@ -13,4 +13,4 @@
 struct Foo { };
 typedef Foo::x x;
 
-int main() { }
+int main(int, char**) { return 0; }

diff  --git a/libcxx/test/libcxx/selftest/link.pass.cpp/link-error.link.pass.cpp b/libcxx/test/libcxx/selftest/link.pass.cpp/link-error.link.pass.cpp
index ed766675af01..422c9a16afc0 100644
--- a/libcxx/test/libcxx/selftest/link.pass.cpp/link-error.link.pass.cpp
+++ b/libcxx/test/libcxx/selftest/link.pass.cpp/link-error.link.pass.cpp
@@ -12,6 +12,7 @@
 
 extern void this_is_an_undefined_symbol();
 
-int main() {
+int main(int, char**) {
     this_is_an_undefined_symbol();
+    return 0;
 }

diff  --git a/libcxx/test/libcxx/selftest/link.pass.cpp/link-success.link.pass.cpp b/libcxx/test/libcxx/selftest/link.pass.cpp/link-success.link.pass.cpp
index 2187fbdeb98c..f25da55d42a3 100644
--- a/libcxx/test/libcxx/selftest/link.pass.cpp/link-success.link.pass.cpp
+++ b/libcxx/test/libcxx/selftest/link.pass.cpp/link-success.link.pass.cpp
@@ -8,4 +8,4 @@
 
 // Make sure the test passes if it succeeds to link.
 
-int main() { }
+int main(int, char**) { return 0; }

diff  --git a/libcxx/test/libcxx/selftest/link.pass.cpp/run-error.link.pass.cpp b/libcxx/test/libcxx/selftest/link.pass.cpp/run-error.link.pass.cpp
index 04460a4994e0..ee44d1798d48 100644
--- a/libcxx/test/libcxx/selftest/link.pass.cpp/run-error.link.pass.cpp
+++ b/libcxx/test/libcxx/selftest/link.pass.cpp/run-error.link.pass.cpp
@@ -9,6 +9,6 @@
 // Make sure the test passes if it succeeds to link, even though it would have
 // failed at runtime.
 
-int main() {
+int main(int, char**) {
     return 1;
 }

diff  --git a/libcxx/test/libcxx/selftest/pass.cpp/compile-error.pass.cpp b/libcxx/test/libcxx/selftest/pass.cpp/compile-error.pass.cpp
index 9ba8a5edbed9..6ff8850537f5 100644
--- a/libcxx/test/libcxx/selftest/pass.cpp/compile-error.pass.cpp
+++ b/libcxx/test/libcxx/selftest/pass.cpp/compile-error.pass.cpp
@@ -13,4 +13,4 @@
 struct Foo { };
 typedef Foo::x x;
 
-int main() { }
+int main(int, char**) { return 0; }

diff  --git a/libcxx/test/libcxx/selftest/pass.cpp/link-error.pass.cpp b/libcxx/test/libcxx/selftest/pass.cpp/link-error.pass.cpp
index f62e23493331..70e2ab66e8be 100644
--- a/libcxx/test/libcxx/selftest/pass.cpp/link-error.pass.cpp
+++ b/libcxx/test/libcxx/selftest/pass.cpp/link-error.pass.cpp
@@ -12,6 +12,7 @@
 
 extern void this_is_an_undefined_symbol();
 
-int main() {
+int main(int, char**) {
     this_is_an_undefined_symbol();
+    return 0;
 }

diff  --git a/libcxx/test/libcxx/selftest/pass.cpp/run-error.pass.cpp b/libcxx/test/libcxx/selftest/pass.cpp/run-error.pass.cpp
index 999ee65e1e1e..eac7d8846e23 100644
--- a/libcxx/test/libcxx/selftest/pass.cpp/run-error.pass.cpp
+++ b/libcxx/test/libcxx/selftest/pass.cpp/run-error.pass.cpp
@@ -10,6 +10,6 @@
 
 // Make sure the test DOES NOT pass if it fails at runtime.
 
-int main() {
+int main(int, char**) {
     return 1;
 }

diff  --git a/libcxx/test/libcxx/selftest/pass.cpp/run-success.pass.cpp b/libcxx/test/libcxx/selftest/pass.cpp/run-success.pass.cpp
index 85cf334bfaef..c37b79a99612 100644
--- a/libcxx/test/libcxx/selftest/pass.cpp/run-success.pass.cpp
+++ b/libcxx/test/libcxx/selftest/pass.cpp/run-success.pass.cpp
@@ -8,6 +8,6 @@
 
 // Make sure the test passes pass if it succeeds at runtime.
 
-int main() {
+int main(int, char**) {
     return 0;
 }

diff  --git a/libcxx/test/libcxx/selftest/pass.cpp/werror.pass.cpp b/libcxx/test/libcxx/selftest/pass.cpp/werror.pass.cpp
index 31b7453164ea..590785fc1774 100644
--- a/libcxx/test/libcxx/selftest/pass.cpp/werror.pass.cpp
+++ b/libcxx/test/libcxx/selftest/pass.cpp/werror.pass.cpp
@@ -17,6 +17,6 @@
 // TODO: We don't enable -Werror on GCC right now, because too many tests fail.
 // UNSUPPORTED: gcc
 
-int main() {
+int main(int, char**) {
     int foo;
 }

diff  --git a/libcxx/test/libcxx/selftest/pass.mm/compile-error.pass.mm b/libcxx/test/libcxx/selftest/pass.mm/compile-error.pass.mm
index 95c661887cad..04bb4cc44526 100644
--- a/libcxx/test/libcxx/selftest/pass.mm/compile-error.pass.mm
+++ b/libcxx/test/libcxx/selftest/pass.mm/compile-error.pass.mm
@@ -15,4 +15,4 @@
 struct Foo { };
 typedef Foo::x x;
 
-int main() { }
+int main(int, char**) { return 0; }

diff  --git a/libcxx/test/libcxx/selftest/pass.mm/link-error.pass.mm b/libcxx/test/libcxx/selftest/pass.mm/link-error.pass.mm
index 5a33a2c5b5d1..abc34d679351 100644
--- a/libcxx/test/libcxx/selftest/pass.mm/link-error.pass.mm
+++ b/libcxx/test/libcxx/selftest/pass.mm/link-error.pass.mm
@@ -14,6 +14,7 @@
 
 extern void this_is_an_undefined_symbol();
 
-int main() {
+int main(int, char**) {
     this_is_an_undefined_symbol();
+    return 0;
 }

diff  --git a/libcxx/test/libcxx/selftest/pass.mm/no-arc.pass.mm b/libcxx/test/libcxx/selftest/pass.mm/no-arc.pass.mm
index cc1bc96469ba..dd33d1b2f7d5 100644
--- a/libcxx/test/libcxx/selftest/pass.mm/no-arc.pass.mm
+++ b/libcxx/test/libcxx/selftest/pass.mm/no-arc.pass.mm
@@ -14,6 +14,6 @@
 #   error "arc should not be enabled by default"
 #endif
 
-int main() {
+int main(int, char**) {
     return 0;
 }

diff  --git a/libcxx/test/libcxx/selftest/pass.mm/run-error.pass.mm b/libcxx/test/libcxx/selftest/pass.mm/run-error.pass.mm
index 03e640d332e1..22e17666eab0 100644
--- a/libcxx/test/libcxx/selftest/pass.mm/run-error.pass.mm
+++ b/libcxx/test/libcxx/selftest/pass.mm/run-error.pass.mm
@@ -12,6 +12,6 @@
 
 // Make sure the test DOES NOT pass if it fails at runtime.
 
-int main() {
+int main(int, char**) {
     return 1;
 }

diff  --git a/libcxx/test/libcxx/selftest/pass.mm/run-success.pass.mm b/libcxx/test/libcxx/selftest/pass.mm/run-success.pass.mm
index 471af21c2dc2..4021b24b75ec 100644
--- a/libcxx/test/libcxx/selftest/pass.mm/run-success.pass.mm
+++ b/libcxx/test/libcxx/selftest/pass.mm/run-success.pass.mm
@@ -10,6 +10,6 @@
 
 // Make sure the test passes pass if it succeeds at runtime.
 
-int main() {
+int main(int, char**) {
     return 0;
 }

diff  --git a/libcxx/test/libcxx/selftest/pass.mm/use-objective-cxx.pass.mm b/libcxx/test/libcxx/selftest/pass.mm/use-objective-cxx.pass.mm
index f45d3c1186b5..ddd2304ef727 100644
--- a/libcxx/test/libcxx/selftest/pass.mm/use-objective-cxx.pass.mm
+++ b/libcxx/test/libcxx/selftest/pass.mm/use-objective-cxx.pass.mm
@@ -13,6 +13,6 @@
 @interface Foo
 @end
 
-int main() {
+int main(int, char**) {
     return 0;
 }

diff  --git a/libcxx/test/libcxx/selftest/run.fail.cpp/compile-error.run.fail.cpp b/libcxx/test/libcxx/selftest/run.fail.cpp/compile-error.run.fail.cpp
index 94cff9c9854f..167676d6629d 100644
--- a/libcxx/test/libcxx/selftest/run.fail.cpp/compile-error.run.fail.cpp
+++ b/libcxx/test/libcxx/selftest/run.fail.cpp/compile-error.run.fail.cpp
@@ -13,6 +13,6 @@
 struct Foo { };
 typedef Foo::x x;
 
-int main() {
+int main(int, char**) {
     return 1;
 }

diff  --git a/libcxx/test/libcxx/selftest/run.fail.cpp/link-error.run.fail.cpp b/libcxx/test/libcxx/selftest/run.fail.cpp/link-error.run.fail.cpp
index 31a054272d15..604d74fbe774 100644
--- a/libcxx/test/libcxx/selftest/run.fail.cpp/link-error.run.fail.cpp
+++ b/libcxx/test/libcxx/selftest/run.fail.cpp/link-error.run.fail.cpp
@@ -12,7 +12,7 @@
 
 extern void this_is_an_undefined_symbol();
 
-int main() {
+int main(int, char**) {
     this_is_an_undefined_symbol();
     return 1;
 }

diff  --git a/libcxx/test/libcxx/selftest/run.fail.cpp/run-error.run.fail.cpp b/libcxx/test/libcxx/selftest/run.fail.cpp/run-error.run.fail.cpp
index 29c0ce9ad44b..ed8ed9bfe2b7 100644
--- a/libcxx/test/libcxx/selftest/run.fail.cpp/run-error.run.fail.cpp
+++ b/libcxx/test/libcxx/selftest/run.fail.cpp/run-error.run.fail.cpp
@@ -8,6 +8,6 @@
 
 // Make sure the test passes if it fails at runtime.
 
-int main() {
+int main(int, char**) {
     return 1;
 }

diff  --git a/libcxx/test/libcxx/selftest/run.fail.cpp/run-success.run.fail.cpp b/libcxx/test/libcxx/selftest/run.fail.cpp/run-success.run.fail.cpp
index ebc53227e2d8..f414bc84b682 100644
--- a/libcxx/test/libcxx/selftest/run.fail.cpp/run-success.run.fail.cpp
+++ b/libcxx/test/libcxx/selftest/run.fail.cpp/run-success.run.fail.cpp
@@ -10,6 +10,6 @@
 
 // Make sure the test DOES NOT pass if it succeeds at runtime.
 
-int main() {
+int main(int, char**) {
     return 0;
 }

diff  --git a/libcxx/test/libcxx/selftest/sh.cpp/werror.sh.cpp b/libcxx/test/libcxx/selftest/sh.cpp/werror.sh.cpp
index b66179810692..3188f57ec8fd 100644
--- a/libcxx/test/libcxx/selftest/sh.cpp/werror.sh.cpp
+++ b/libcxx/test/libcxx/selftest/sh.cpp/werror.sh.cpp
@@ -17,6 +17,7 @@
 // RUN: %{build} -Wunused-variable
 // RUN: %{run}
 
-int main() {
+int main(int, char**) {
     int foo;
+    return 0;
 }

diff  --git a/libcxx/test/libcxx/selftest/verify.cpp/no-diagnostics-unmarked.verify.cpp b/libcxx/test/libcxx/selftest/verify.cpp/no-diagnostics-unmarked.verify.cpp
index 18ff67065382..d59d42b98fc0 100644
--- a/libcxx/test/libcxx/selftest/verify.cpp/no-diagnostics-unmarked.verify.cpp
+++ b/libcxx/test/libcxx/selftest/verify.cpp/no-diagnostics-unmarked.verify.cpp
@@ -14,4 +14,4 @@
 // Note: For the purpose of this test, make sure the file would otherwise
 //       compile to make sure we really fail due to a lack of markup.
 
-int main() { }
+int main(int, char**) { return 0; }

diff  --git a/libcxx/test/libcxx/selftest/verify.cpp/no-werror.verify.cpp b/libcxx/test/libcxx/selftest/verify.cpp/no-werror.verify.cpp
index 4b89be558525..b1234ae62674 100644
--- a/libcxx/test/libcxx/selftest/verify.cpp/no-werror.verify.cpp
+++ b/libcxx/test/libcxx/selftest/verify.cpp/no-werror.verify.cpp
@@ -10,6 +10,7 @@
 
 // ADDITIONAL_COMPILE_FLAGS: -Wunused-variable
 
-int main() {
+int main(int, char**) {
     int foo; // expected-warning {{unused variable}}
+    return 0;
 }

diff  --git a/libcxx/test/libcxx/strings/basic.string/PR42676.sh.cpp b/libcxx/test/libcxx/strings/basic.string/PR42676.sh.cpp
index 31bf81efa004..217091562b46 100644
--- a/libcxx/test/libcxx/strings/basic.string/PR42676.sh.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/PR42676.sh.cpp
@@ -14,8 +14,9 @@
 #include <memory>
 #include <string>
 
-int main() {
+int main(int, char**) {
     std::string s1(10u, '-', std::allocator<char>()); (void)s1;
     std::string s2("hello", std::allocator<char>()); (void)s2;
     std::string s3("hello"); (void)s3;
+    return 0;
 }

diff  --git a/libcxx/test/libcxx/utilities/function.objects/abi_bug_cxx03_cxx11_example.sh.cpp b/libcxx/test/libcxx/utilities/function.objects/abi_bug_cxx03_cxx11_example.sh.cpp
index e367074cd4fe..7644a994635f 100644
--- a/libcxx/test/libcxx/utilities/function.objects/abi_bug_cxx03_cxx11_example.sh.cpp
+++ b/libcxx/test/libcxx/utilities/function.objects/abi_bug_cxx03_cxx11_example.sh.cpp
@@ -38,8 +38,9 @@ Func CreateFunc() {
   return f;
 }
 #else
-int main() {
+int main(int, char**) {
   Func f = CreateFunc();
   f(42);
+  return 0;
 }
 #endif

diff  --git a/libcxx/test/libcxx/utilities/function.objects/func.wrap/depr_in_cxx03.verify.cpp b/libcxx/test/libcxx/utilities/function.objects/func.wrap/depr_in_cxx03.verify.cpp
index c1f3cc6d8413..5c97827519b4 100644
--- a/libcxx/test/libcxx/utilities/function.objects/func.wrap/depr_in_cxx03.verify.cpp
+++ b/libcxx/test/libcxx/utilities/function.objects/func.wrap/depr_in_cxx03.verify.cpp
@@ -16,7 +16,7 @@
 #include <functional>
 #include "test_macros.h"
 
-int main() {
+int main(int, char**) {
     // Note:
     // We use sizeof() to require it to be a complete type. We don't create a
     // variable because otherwise we get two warnings for each variable (the
@@ -25,4 +25,5 @@ int main() {
     (void)sizeof(std::function<void (int)>); // expected-warning {{'function<void (int)>' is deprecated}}
     (void)sizeof(std::function<void (int, int)>); // expected-warning {{'function<void (int, int)>' is deprecated}}
     (void)sizeof(std::function<void (int, int, int)>); // expected-warning {{'function<void (int, int, int)>' is deprecated}}
+    return 0;
 }

diff  --git a/libcxx/test/libcxx/utilities/meta/stress_tests/stress_test_variant_overloads_impl.sh.cpp b/libcxx/test/libcxx/utilities/meta/stress_tests/stress_test_variant_overloads_impl.sh.cpp
index 212d915c6970..6fdd02362386 100644
--- a/libcxx/test/libcxx/utilities/meta/stress_tests/stress_test_variant_overloads_impl.sh.cpp
+++ b/libcxx/test/libcxx/utilities/meta/stress_tests/stress_test_variant_overloads_impl.sh.cpp
@@ -112,7 +112,8 @@ static_assert(__COUNTER__ >= 1000, "");
 void fn1(T1 x) { DoNotOptimize(&x); }
 void fn2(typename std::invoke_result_t<T1, int, int>::type x) { DoNotOptimize(&x); }
 
-int main() {
+int main(int, char**) {
   DoNotOptimize(&fn1);
   DoNotOptimize(&fn2);
+  return 0;
 }

diff  --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/resize_not_move_insertable.fail.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/resize_not_move_insertable.fail.cpp
index 7964cc6ee772..fb10a3c9b5d5 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/resize_not_move_insertable.fail.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/resize_not_move_insertable.fail.cpp
@@ -31,7 +31,7 @@ class BadUserNoCookie {
   BadUserNoCookie& operator=(const BadUserNoCookie&) = default;
 };
 
-int main() {
+int main(int, char**) {
   // expected-error at memory:* 2 {{"The specified type does not meet the requirements of Cpp17MoveInsertable"}}
 
   // Other diagnostics that might be seen as Clang tries to continue compiling:
@@ -47,5 +47,5 @@ int main() {
     BadUserNoCookie<2> c;
     x.push_back(c);
   }
-    return 0;
+  return 0;
 }

diff  --git a/libcxx/test/std/input.output/iostream.objects/init.pass.cpp b/libcxx/test/std/input.output/iostream.objects/init.pass.cpp
index 62a9ffbca3ea..d06334d1e85c 100644
--- a/libcxx/test/std/input.output/iostream.objects/init.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.objects/init.pass.cpp
@@ -75,7 +75,7 @@ struct Checker {
 
 static Checker check;
 
-int main() {
+int main(int, char**) {
     assert(std::memcmp(check.cerr_mem_dump, (char const*)&std::cerr, sizeof(std::cerr)) == 0);
     assert(std::memcmp(check.cin_mem_dump, (char const*)&std::cin, sizeof(std::cin)) == 0);
     assert(std::memcmp(check.cout_mem_dump, (char const*)&std::cout, sizeof(std::cout)) == 0);
@@ -85,4 +85,5 @@ int main() {
     assert(std::memcmp(check.wcin_mem_dump, (char const*)&std::wcin, sizeof(std::wcin)) == 0);
     assert(std::memcmp(check.wcout_mem_dump, (char const*)&std::wcout, sizeof(std::wcout)) == 0);
     assert(std::memcmp(check.wclog_mem_dump, (char const*)&std::wclog, sizeof(std::wclog)) == 0);
+    return 0;
 }

diff  --git a/libcxx/test/std/language.support/support.dynamic/destroying_delete_t.pass.cpp b/libcxx/test/std/language.support/support.dynamic/destroying_delete_t.pass.cpp
index 7546378742b4..ae9feca42d09 100644
--- a/libcxx/test/std/language.support/support.dynamic/destroying_delete_t.pass.cpp
+++ b/libcxx/test/std/language.support/support.dynamic/destroying_delete_t.pass.cpp
@@ -67,11 +67,12 @@ void A::operator delete(A* a, std::destroying_delete_t) {
 #  endif
 #endif
 
-int main() {
+int main(int, char**) {
   // Ensure that we call the destroying delete and not the destructor.
   A* ap = A::New();
   assert(A_constructed);
   delete ap;
   assert(!A_destroyed);
   assert(A_destroying_deleted);
+  return 0;
 }

diff  --git a/libcxx/test/std/language.support/support.dynamic/destroying_delete_t_declaration.pass.cpp b/libcxx/test/std/language.support/support.dynamic/destroying_delete_t_declaration.pass.cpp
index 68c62c67d419..6dcfbe8cd97a 100644
--- a/libcxx/test/std/language.support/support.dynamic/destroying_delete_t_declaration.pass.cpp
+++ b/libcxx/test/std/language.support/support.dynamic/destroying_delete_t_declaration.pass.cpp
@@ -42,11 +42,12 @@ constexpr bool test_constexpr(std::destroying_delete_t) {
   return true;
 }
 
-int main() {
+int main(int, char**) {
   static_assert(std::is_default_constructible<std::destroying_delete_t>::value, "");
   static_assert(!test_convertible<std::destroying_delete_t>(), "");
   constexpr std::destroying_delete_t dd{};
   static_assert((dd, true), "");
   static_assert(&dd != &std::destroying_delete, "");
   static_assert(test_constexpr(std::destroying_delete), "");
+  return 0;
 }

diff  --git a/libcxx/test/std/namespace/addressable_functions.sh.cpp b/libcxx/test/std/namespace/addressable_functions.sh.cpp
index 72db27ffaf20..3d5fe1121481 100644
--- a/libcxx/test/std/namespace/addressable_functions.sh.cpp
+++ b/libcxx/test/std/namespace/addressable_functions.sh.cpp
@@ -144,7 +144,7 @@ WIstreamManipFunction* get_wistreammanip_tu2(std::string func)
 
 
 #ifdef TU2
-    int main() {
+    int main(int, char**) {
         assert(get_formatflag_tu1("boolalpha") == get_formatflag_tu2("boolalpha"));
         assert(get_formatflag_tu1("noboolalpha") == get_formatflag_tu2("noboolalpha"));
         assert(get_formatflag_tu1("showbase") == get_formatflag_tu2("showbase"));
@@ -181,5 +181,7 @@ WIstreamManipFunction* get_wistreammanip_tu2(std::string func)
         assert(get_istreammanip_tu1("ws") == get_istreammanip_tu2("ws"));
 
         assert(get_wistreammanip_tu1("ws") == get_wistreammanip_tu2("ws"));
+
+        return 0;
     }
 #endif

diff  --git a/libcxx/test/std/numerics/bit/bit.pow.two/ceil2.fail.cpp b/libcxx/test/std/numerics/bit/bit.pow.two/ceil2.fail.cpp
index 90c9479814dc..d1257672f126 100644
--- a/libcxx/test/std/numerics/bit/bit.pow.two/ceil2.fail.cpp
+++ b/libcxx/test/std/numerics/bit/bit.pow.two/ceil2.fail.cpp
@@ -31,7 +31,7 @@ constexpr bool toobig()
 	return 0 == std::ceil2(std::numeric_limits<T>::max());
 }
 
-int main()
+int main(int, char**)
 {
 //	Make sure we generate a compile-time error for UB
 	static_assert(toobig<unsigned char>(),      ""); // expected-error {{static_assert expression is not an integral constant expression}}
@@ -47,4 +47,6 @@ int main()
 	static_assert(toobig<size_t>(), ""); 	// expected-error {{static_assert expression is not an integral constant expression}}
 	static_assert(toobig<uintmax_t>(), "");	// expected-error {{static_assert expression is not an integral constant expression}}
 	static_assert(toobig<uintptr_t>(), "");	// expected-error {{static_assert expression is not an integral constant expression}}
+
+	return 0;
 }

diff  --git a/libcxx/test/std/numerics/bit/bit.pow.two/ceil2.pass.cpp b/libcxx/test/std/numerics/bit/bit.pow.two/ceil2.pass.cpp
index de0491daea6f..1959eb05580c 100644
--- a/libcxx/test/std/numerics/bit/bit.pow.two/ceil2.pass.cpp
+++ b/libcxx/test/std/numerics/bit/bit.pow.two/ceil2.pass.cpp
@@ -62,7 +62,7 @@ void runtime_test()
     assert( std::ceil2(T(69)) == T(128));
 }
 
-int main()
+int main(int, char**)
 {
 
     {
@@ -145,4 +145,6 @@ int main()
 #ifndef _LIBCPP_HAS_NO_INT128
     runtime_test<__uint128_t>();
 #endif
+
+    return 0;
 }

diff  --git a/libcxx/test/std/numerics/bit/bit.pow.two/floor2.pass.cpp b/libcxx/test/std/numerics/bit/bit.pow.two/floor2.pass.cpp
index 6c3177faa46d..83afdf92f066 100644
--- a/libcxx/test/std/numerics/bit/bit.pow.two/floor2.pass.cpp
+++ b/libcxx/test/std/numerics/bit/bit.pow.two/floor2.pass.cpp
@@ -61,7 +61,7 @@ void runtime_test()
 	assert( std::floor2(T(130)) == T(128));
 }
 
-int main()
+int main(int, char**)
 {
 
     {
@@ -161,4 +161,5 @@ int main()
 	}
 #endif
 
+    return 0;
 }

diff  --git a/libcxx/test/std/numerics/bit/bit.pow.two/ispow2.pass.cpp b/libcxx/test/std/numerics/bit/bit.pow.two/ispow2.pass.cpp
index 553eb51ffb66..52e3e5f299ee 100644
--- a/libcxx/test/std/numerics/bit/bit.pow.two/ispow2.pass.cpp
+++ b/libcxx/test/std/numerics/bit/bit.pow.two/ispow2.pass.cpp
@@ -59,7 +59,7 @@ void runtime_test()
 	assert(!std::ispow2(T(130)));
 }
 
-int main()
+int main(int, char**)
 {
 
     {
@@ -159,4 +159,5 @@ int main()
 	}
 #endif
 
+    return 0;
 }

diff  --git a/libcxx/test/std/numerics/bit/bit.pow.two/log2p1.pass.cpp b/libcxx/test/std/numerics/bit/bit.pow.two/log2p1.pass.cpp
index de6ec3b24ecd..ffa57196fd6a 100644
--- a/libcxx/test/std/numerics/bit/bit.pow.two/log2p1.pass.cpp
+++ b/libcxx/test/std/numerics/bit/bit.pow.two/log2p1.pass.cpp
@@ -73,7 +73,7 @@ void runtime_test()
 	assert( std::log2p1(T(130)) == T(8));
 }
 
-int main()
+int main(int, char**)
 {
 
     {
@@ -174,4 +174,5 @@ int main()
 	}
 #endif
 
+    return 0;
 }

diff  --git a/libcxx/test/std/numerics/bit/bitops.count/countl_one.pass.cpp b/libcxx/test/std/numerics/bit/bitops.count/countl_one.pass.cpp
index 5961180f8940..5e00c91f670d 100644
--- a/libcxx/test/std/numerics/bit/bitops.count/countl_one.pass.cpp
+++ b/libcxx/test/std/numerics/bit/bitops.count/countl_one.pass.cpp
@@ -66,7 +66,7 @@ void runtime_test()
 	assert( std::countl_one(T(~130)) == dig - 8);
 }
 
-int main()
+int main(int, char**)
 {
 	{
     auto lambda = [](auto x) -> decltype(std::countl_one(x)) {};
@@ -162,4 +162,5 @@ int main()
 	}
 #endif
 
+    return 0;
 }

diff  --git a/libcxx/test/std/numerics/bit/bitops.count/countl_zero.pass.cpp b/libcxx/test/std/numerics/bit/bitops.count/countl_zero.pass.cpp
index 9c88cec80bd5..8fc20b17b778 100644
--- a/libcxx/test/std/numerics/bit/bitops.count/countl_zero.pass.cpp
+++ b/libcxx/test/std/numerics/bit/bitops.count/countl_zero.pass.cpp
@@ -66,7 +66,7 @@ void runtime_test()
 	assert( std::countl_zero(T(130)) == dig - 8);
 }
 
-int main()
+int main(int, char**)
 {
 
     {
@@ -169,4 +169,5 @@ int main()
 	}
 #endif
 
+    return 0;
 }

diff  --git a/libcxx/test/std/numerics/bit/bitops.count/countr_one.pass.cpp b/libcxx/test/std/numerics/bit/bitops.count/countr_one.pass.cpp
index ac2419787485..9038577f14f5 100644
--- a/libcxx/test/std/numerics/bit/bitops.count/countr_one.pass.cpp
+++ b/libcxx/test/std/numerics/bit/bitops.count/countr_one.pass.cpp
@@ -65,7 +65,7 @@ void runtime_test()
 	assert( std::countr_one(T(130)) == 0);
 }
 
-int main()
+int main(int, char**)
 {
 
     {
@@ -167,4 +167,5 @@ int main()
 	}
 #endif
 
+    return 0;
 }

diff  --git a/libcxx/test/std/numerics/bit/bitops.count/countr_zero.pass.cpp b/libcxx/test/std/numerics/bit/bitops.count/countr_zero.pass.cpp
index 2e29217db2d6..9dece69dbaaf 100644
--- a/libcxx/test/std/numerics/bit/bitops.count/countr_zero.pass.cpp
+++ b/libcxx/test/std/numerics/bit/bitops.count/countr_zero.pass.cpp
@@ -65,7 +65,7 @@ void runtime_test()
 	assert( std::countr_zero(T(130)) == 1);
 }
 
-int main()
+int main(int, char**)
 {
 
     {
@@ -166,4 +166,5 @@ int main()
 	}
 #endif
 
+    return 0;
 }

diff  --git a/libcxx/test/std/numerics/bit/bitops.count/popcount.pass.cpp b/libcxx/test/std/numerics/bit/bitops.count/popcount.pass.cpp
index 87aa1fdf51be..bffbf8addc1e 100644
--- a/libcxx/test/std/numerics/bit/bitops.count/popcount.pass.cpp
+++ b/libcxx/test/std/numerics/bit/bitops.count/popcount.pass.cpp
@@ -63,7 +63,7 @@ void runtime_test()
 	assert( std::popcount(T(130)) == 2);
 }
 
-int main()
+int main(int, char**)
 {
 
     {
@@ -164,4 +164,6 @@ int main()
 	assert( std::popcount(val+1) ==  2);
 	}
 #endif
+
+    return 0;
 }

diff  --git a/libcxx/test/std/numerics/bit/bitops.rot/rotl.pass.cpp b/libcxx/test/std/numerics/bit/bitops.rot/rotl.pass.cpp
index 2cfc2fd6d1ca..ace2a4c7d126 100644
--- a/libcxx/test/std/numerics/bit/bitops.rot/rotl.pass.cpp
+++ b/libcxx/test/std/numerics/bit/bitops.rot/rotl.pass.cpp
@@ -66,7 +66,7 @@ void runtime_test()
     assert( std::rotl(val, 7) == T((val << 7) + 127));
 }
 
-int main()
+int main(int, char**)
 {
 
     {
@@ -164,4 +164,5 @@ int main()
     }
 #endif
 
+    return 0;
 }

diff  --git a/libcxx/test/std/numerics/bit/bitops.rot/rotr.pass.cpp b/libcxx/test/std/numerics/bit/bitops.rot/rotr.pass.cpp
index ab8df9de844d..2b016126a388 100644
--- a/libcxx/test/std/numerics/bit/bitops.rot/rotr.pass.cpp
+++ b/libcxx/test/std/numerics/bit/bitops.rot/rotr.pass.cpp
@@ -80,7 +80,7 @@ void runtime_test()
     assert( std::rotr(val, 7) == T((val >> 7) +  uppers[7]));
 }
 
-int main()
+int main(int, char**)
 {
 
     {
@@ -178,4 +178,6 @@ int main()
     assert( std::rotr(val, 166) ==  84);
     }
 #endif
+
+    return 0;
 }

diff  --git a/libcxx/test/std/numerics/numbers/defined.pass.cpp b/libcxx/test/std/numerics/numbers/defined.pass.cpp
index ef432b8585e4..5b91c19cb0a1 100644
--- a/libcxx/test/std/numerics/numbers/defined.pass.cpp
+++ b/libcxx/test/std/numerics/numbers/defined.pass.cpp
@@ -78,4 +78,7 @@ constexpr bool tests() {
 
 static_assert(tests());
 
-int main() { tests(); }
+int main(int, char**) {
+  tests();
+  return 0;
+}

diff  --git a/libcxx/test/std/numerics/numbers/illformed.verify.cpp b/libcxx/test/std/numerics/numbers/illformed.verify.cpp
index d0b21bfa79a5..705595189d55 100644
--- a/libcxx/test/std/numerics/numbers/illformed.verify.cpp
+++ b/libcxx/test/std/numerics/numbers/illformed.verify.cpp
@@ -26,4 +26,4 @@ int inv_sqrt3{std::numbers::inv_sqrt3_v<int>};
 int egamma{std::numbers::egamma_v<int>};
 int phi{std::numbers::phi_v<int>};
 
-int main() { return 0; }
+int main(int, char**) { return 0; }

diff  --git a/libcxx/test/std/numerics/numbers/specialize.pass.cpp b/libcxx/test/std/numerics/numbers/specialize.pass.cpp
index df31c8afb4ba..8c956b6cbf5a 100644
--- a/libcxx/test/std/numerics/numbers/specialize.pass.cpp
+++ b/libcxx/test/std/numerics/numbers/specialize.pass.cpp
@@ -79,4 +79,7 @@ constexpr bool tests() {
 
 static_assert(tests());
 
-int main() { tests(); }
+int main(int, char**) {
+  tests();
+  return 0;
+}

diff  --git a/libcxx/test/std/numerics/numbers/user_type.pass.cpp b/libcxx/test/std/numerics/numbers/user_type.pass.cpp
index fa547cf05957..1ad6a1c9db96 100644
--- a/libcxx/test/std/numerics/numbers/user_type.pass.cpp
+++ b/libcxx/test/std/numerics/numbers/user_type.pass.cpp
@@ -54,4 +54,4 @@ user std::numbers::egamma_v<user>{};
 template <>
 user std::numbers::phi_v<user>{};
 
-int main() { return 0; }
+int main(int, char**) { return 0; }

diff  --git a/libcxx/test/std/numerics/numbers/value.pass.cpp b/libcxx/test/std/numerics/numbers/value.pass.cpp
index 9f623e55abaa..fa32e7da048b 100644
--- a/libcxx/test/std/numerics/numbers/value.pass.cpp
+++ b/libcxx/test/std/numerics/numbers/value.pass.cpp
@@ -83,4 +83,7 @@ constexpr bool tests() {
 
 static_assert(tests());
 
-int main() { tests(); }
+int main(int, char**) {
+  tests();
+  return 0;
+}

diff  --git a/libcxx/test/std/re/re.const/re.matchflag/match_prev_avail.pass.cpp b/libcxx/test/std/re/re.const/re.matchflag/match_prev_avail.pass.cpp
index 5decf933d965..00aebe0265db 100644
--- a/libcxx/test/std/re/re.const/re.matchflag/match_prev_avail.pass.cpp
+++ b/libcxx/test/std/re/re.const/re.matchflag/match_prev_avail.pass.cpp
@@ -17,7 +17,7 @@
 #include <regex>
 using namespace std;
 
-int main() {
+int main(int, char**) {
   char str1[] = "\na";
   auto str1_scnd = str1 + 1;
   // Assert that match_prev_avail disables match_not_bol and this matches

diff  --git a/libcxx/test/std/strings/string.view/string.view.io/stream_insert_decl_present.pass.cpp b/libcxx/test/std/strings/string.view/string.view.io/stream_insert_decl_present.compile.pass.cpp
similarity index 88%
rename from libcxx/test/std/strings/string.view/string.view.io/stream_insert_decl_present.pass.cpp
rename to libcxx/test/std/strings/string.view/string.view.io/stream_insert_decl_present.compile.pass.cpp
index be0567a73723..444f262fcaa7 100644
--- a/libcxx/test/std/strings/string.view/string.view.io/stream_insert_decl_present.pass.cpp
+++ b/libcxx/test/std/strings/string.view/string.view.io/stream_insert_decl_present.compile.pass.cpp
@@ -21,6 +21,4 @@ struct HasDecl : std::false_type {};
 template <class SV>
 struct HasDecl<SV, decltype(static_cast<void>(std::declval<std::ostream&>() << std::declval<SV&>()))> : std::true_type {};
 
-int main() {
-  static_assert(HasDecl<std::string_view>::value, "streaming operator declaration not present");
-}
+static_assert(HasDecl<std::string_view>::value, "streaming operator declaration not present");

diff  --git a/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/adopt_lock.pass.cpp b/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/adopt_lock.pass.cpp
index fcd883743eba..5135dbcef816 100644
--- a/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/adopt_lock.pass.cpp
+++ b/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/adopt_lock.pass.cpp
@@ -22,8 +22,7 @@
 
 std::mutex m;
 
-int main()
-{
+int main(int, char**) {
   {
     m.lock();
     std::lock_guard<std::mutex> lg(m, std::adopt_lock);

diff  --git a/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.pass.cpp b/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.pass.cpp
index 71a72ffd050e..0e096eabe4b6 100644
--- a/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.pass.cpp
+++ b/libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.pass.cpp
@@ -25,8 +25,7 @@
 
 std::mutex m;
 
-int main()
-{
+int main(int, char**) {
   {
     std::lock_guard<std::mutex> lg(m);
     assert(m.try_lock() == false);

diff  --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/deduct_F.fail.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/deduct_F.fail.cpp
index 9a5564295ba9..7c806629be5f 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/deduct_F.fail.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/deduct_F.fail.cpp
@@ -27,8 +27,9 @@ struct R { };
 struct f0 { R operator()() && { return {}; } };
 struct f1 { R operator()(int, ...) { return {}; } };
 
-int main() {
+int main(int, char**) {
     std::function f = f0{}; // expected-error{{no viable constructor or deduction guide for deduction of template arguments of 'function'}}
     std::function g = f1{}; // expected-error{{no viable constructor or deduction guide for deduction of template arguments of 'function'}}
     std::function h = nullptr; // expected-error{{no viable constructor or deduction guide for deduction of template arguments of 'function'}}
+    return 0;
 }

diff  --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/deduct_F.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/deduct_F.pass.cpp
index 8ec9a204e364..793673de130c 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/deduct_F.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/deduct_F.pass.cpp
@@ -51,7 +51,7 @@ DECLARE_FUNCTIONS_WITH_QUALS(13, const & noexcept);
 DECLARE_FUNCTIONS_WITH_QUALS(14, volatile & noexcept);
 DECLARE_FUNCTIONS_WITH_QUALS(15, const volatile & noexcept);
 
-int main() {
+int main(int, char**) {
 #define CHECK_FUNCTIONS(N)                                                    \
   do {                                                                        \
     /* implicit */                                                            \
@@ -114,6 +114,8 @@ int main() {
   CHECK_FUNCTIONS(13);
   CHECK_FUNCTIONS(14);
   CHECK_FUNCTIONS(15);
+
+  return 0;
 }
 
 // Make sure we fail in a SFINAE-friendly manner when we try to deduce

diff  --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/deduct_ptr.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/deduct_ptr.pass.cpp
index 4cc90d2efbb2..edd4322dfc47 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/deduct_ptr.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/deduct_ptr.pass.cpp
@@ -32,7 +32,7 @@ R f2(A1, A2) { return {}; }
 R f3(A1, A2, A3) { return {}; }
 R f4(A1 = {}) { return {}; }
 
-int main() {
+int main(int, char**) {
   {
     // implicit
     std::function a = f0;
@@ -109,4 +109,6 @@ int main() {
     std::function d{&f4};
     ASSERT_SAME_TYPE(decltype(d), std::function<R(A1)>);
   }
+
+  return 0;
 }

diff  --git a/libcxx/test/std/utilities/function.objects/refwrap/refwrap.const/ctor.incomplete.pass.cpp b/libcxx/test/std/utilities/function.objects/refwrap/refwrap.const/ctor.incomplete.pass.cpp
index e594e167d85a..757a0d707493 100644
--- a/libcxx/test/std/utilities/function.objects/refwrap/refwrap.const/ctor.incomplete.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/refwrap/refwrap.const/ctor.incomplete.pass.cpp
@@ -38,6 +38,7 @@ Foo& get_foo() {
     return foo;
 }
 
-int main() {
+int main(int, char**) {
     test();
+    return 0;
 }

diff  --git a/libcxx/test/std/utilities/function.objects/refwrap/refwrap.helpers/cref.incomplete.pass.cpp b/libcxx/test/std/utilities/function.objects/refwrap/refwrap.helpers/cref.incomplete.pass.cpp
index c26f35ed393d..8ca3651a15e8 100644
--- a/libcxx/test/std/utilities/function.objects/refwrap/refwrap.helpers/cref.incomplete.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/refwrap/refwrap.helpers/cref.incomplete.pass.cpp
@@ -39,6 +39,7 @@ Foo& get_foo() {
     return foo;
 }
 
-int main() {
+int main(int, char**) {
     test();
+    return 0;
 }

diff  --git a/libcxx/test/std/utilities/function.objects/refwrap/refwrap.helpers/ref.incomplete.pass.cpp b/libcxx/test/std/utilities/function.objects/refwrap/refwrap.helpers/ref.incomplete.pass.cpp
index 1e55b300d30d..1b41563c60e8 100644
--- a/libcxx/test/std/utilities/function.objects/refwrap/refwrap.helpers/ref.incomplete.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/refwrap/refwrap.helpers/ref.incomplete.pass.cpp
@@ -39,6 +39,7 @@ Foo& get_foo() {
     return foo;
 }
 
-int main() {
+int main(int, char**) {
     test();
+    return 0;
 }

diff  --git a/libcxx/test/std/utilities/function.objects/refwrap/refwrap.invoke/invoke.incomplete.compile.fail.cpp b/libcxx/test/std/utilities/function.objects/refwrap/refwrap.invoke/invoke.incomplete.compile.fail.cpp
index ceab2293bdfb..d0438a9160d3 100644
--- a/libcxx/test/std/utilities/function.objects/refwrap/refwrap.invoke/invoke.incomplete.compile.fail.cpp
+++ b/libcxx/test/std/utilities/function.objects/refwrap/refwrap.invoke/invoke.incomplete.compile.fail.cpp
@@ -32,6 +32,7 @@ void test() {
 struct Foo { void operator()(int) const { } };
 Foo& get_foo() { static Foo foo; return foo; }
 
-int main() {
+int main(int, char**) {
     test();
+    return 0;
 }

diff  --git a/libcxxabi/test/backtrace_test.pass.cpp b/libcxxabi/test/backtrace_test.pass.cpp
index 38125f8cf6e9..77c447c607f4 100644
--- a/libcxxabi/test/backtrace_test.pass.cpp
+++ b/libcxxabi/test/backtrace_test.pass.cpp
@@ -48,7 +48,7 @@ void call1(size_t* ntraced, bool do_throw) {
   call2(ntraced, do_throw);
 }
 
-int main() {
+int main(int, char**) {
   size_t throw_ntraced = 0;
   size_t nothrow_ntraced = 0;
 

diff  --git a/libcxxabi/test/catch_array_01.pass.cpp b/libcxxabi/test/catch_array_01.pass.cpp
index f8bd4b1ae18b..74b4872371e8 100644
--- a/libcxxabi/test/catch_array_01.pass.cpp
+++ b/libcxxabi/test/catch_array_01.pass.cpp
@@ -15,7 +15,7 @@
 
 #include <cassert>
 
-int main()
+int main(int, char**)
 {
     typedef char Array[4];
     Array a = {'H', 'i', '!', 0};
@@ -31,4 +31,6 @@ int main()
     catch (...)
     {
     }
+
+    return 0;
 }

diff  --git a/libcxxabi/test/catch_array_02.pass.cpp b/libcxxabi/test/catch_array_02.pass.cpp
index 69cd8d50df54..ebdd0d94c6f4 100644
--- a/libcxxabi/test/catch_array_02.pass.cpp
+++ b/libcxxabi/test/catch_array_02.pass.cpp
@@ -11,7 +11,7 @@
 
 #include <cassert>
 
-int main()
+int main(int, char**)
 {
     typedef char Array[4];
     Array a = {'H', 'i', '!', 0};
@@ -27,4 +27,6 @@ int main()
     {
         assert(false);
     }
+
+    return 0;
 }

diff  --git a/libcxxabi/test/catch_class_01.pass.cpp b/libcxxabi/test/catch_class_01.pass.cpp
index 274584083d68..56b84d6ba9cd 100644
--- a/libcxxabi/test/catch_class_01.pass.cpp
+++ b/libcxxabi/test/catch_class_01.pass.cpp
@@ -43,7 +43,7 @@ void f2()
     }
 }
 
-int main()
+int main(int, char**)
 {
     try
     {
@@ -56,4 +56,6 @@ int main()
         assert(a.id_ == 3);
     }
     assert(A::count == 0);
+
+    return 0;
 }

diff  --git a/libcxxabi/test/catch_class_02.pass.cpp b/libcxxabi/test/catch_class_02.pass.cpp
index f78b581581a0..9281102c95fe 100644
--- a/libcxxabi/test/catch_class_02.pass.cpp
+++ b/libcxxabi/test/catch_class_02.pass.cpp
@@ -67,7 +67,7 @@ void f2()
     }
 }
 
-int main()
+int main(int, char**)
 {
     try
     {
@@ -81,4 +81,6 @@ int main()
     }
     assert(A::count == 0);
     assert(B::count == 0);
+
+    return 0;
 }

diff  --git a/libcxxabi/test/catch_class_03.pass.cpp b/libcxxabi/test/catch_class_03.pass.cpp
index 450c13c688a0..d7e1e765de16 100644
--- a/libcxxabi/test/catch_class_03.pass.cpp
+++ b/libcxxabi/test/catch_class_03.pass.cpp
@@ -181,7 +181,7 @@ void f4()
     }
 }
 
-int main()
+int main(int, char**)
 {
     try
     {
@@ -195,4 +195,6 @@ int main()
     assert(C1::count == 0);
     assert(C2::count == 0);
     assert(B::count == 0);
+
+    return 0;
 }

diff  --git a/libcxxabi/test/catch_class_04.pass.cpp b/libcxxabi/test/catch_class_04.pass.cpp
index a9656ec35fb6..174f07fb597c 100644
--- a/libcxxabi/test/catch_class_04.pass.cpp
+++ b/libcxxabi/test/catch_class_04.pass.cpp
@@ -204,7 +204,7 @@ void f5()
     }
 }
 
-int main()
+int main(int, char**)
 {
     try
     {
@@ -218,4 +218,6 @@ int main()
     assert(C1::count == 0);
     assert(C2::count == 0);
     assert(B::count == 0);
+
+    return 0;
 }

diff  --git a/libcxxabi/test/catch_const_pointer_nullptr.pass.cpp b/libcxxabi/test/catch_const_pointer_nullptr.pass.cpp
index b910545c909f..2389ba920f89 100644
--- a/libcxxabi/test/catch_const_pointer_nullptr.pass.cpp
+++ b/libcxxabi/test/catch_const_pointer_nullptr.pass.cpp
@@ -136,12 +136,13 @@ void test6() {}
 
 #endif
 
-int main()
-{
+int main(int, char**) {
     test1();
     test2();
     test3();
     test4();
     test5();
     test6();
+
+    return 0;
 }

diff  --git a/libcxxabi/test/catch_function_01.pass.cpp b/libcxxabi/test/catch_function_01.pass.cpp
index ca52c9e7b1ef..bbc94ad84d05 100644
--- a/libcxxabi/test/catch_function_01.pass.cpp
+++ b/libcxxabi/test/catch_function_01.pass.cpp
@@ -23,7 +23,7 @@ bool can_convert(...) { return false; }
 
 void f() {}
 
-int main()
+int main(int, char**)
 {
     typedef void Function();
     assert(!can_convert<Function&>(&f));
@@ -48,4 +48,6 @@ int main()
     {
         assert(false);
     }
+
+    return 0;
 }

diff  --git a/libcxxabi/test/catch_function_02.pass.cpp b/libcxxabi/test/catch_function_02.pass.cpp
index 195771121883..c90b29c8c9ea 100644
--- a/libcxxabi/test/catch_function_02.pass.cpp
+++ b/libcxxabi/test/catch_function_02.pass.cpp
@@ -13,7 +13,7 @@
 
 void f() {}
 
-int main()
+int main(int, char**)
 {
     typedef void Function();
     try
@@ -28,4 +28,6 @@ int main()
     {
         assert(false);
     }
+
+    return 0;
 }

diff  --git a/libcxxabi/test/catch_function_03.pass.cpp b/libcxxabi/test/catch_function_03.pass.cpp
index 217500e700ec..b321ecf6ed6f 100644
--- a/libcxxabi/test/catch_function_03.pass.cpp
+++ b/libcxxabi/test/catch_function_03.pass.cpp
@@ -53,11 +53,13 @@ void check_deep() {
     }
 }
 
-int main()
+int main(int, char**)
 {
     check<false, false>();
     check<false, true>();
     check<true, false>();
     check<true, true>();
     check_deep();
+
+    return 0;
 }

diff  --git a/libcxxabi/test/catch_in_noexcept.pass.cpp b/libcxxabi/test/catch_in_noexcept.pass.cpp
index fe3fc7d27358..6955f1019f4b 100644
--- a/libcxxabi/test/catch_in_noexcept.pass.cpp
+++ b/libcxxabi/test/catch_in_noexcept.pass.cpp
@@ -30,7 +30,9 @@ void f1() noexcept
     assert(false);
 }
 
-int main()
+int main(int, char**)
 {
     f1();
+
+    return 0;
 }

diff  --git a/libcxxabi/test/catch_member_data_pointer_01.pass.cpp b/libcxxabi/test/catch_member_data_pointer_01.pass.cpp
index 765395968373..5fe9d59edcb3 100644
--- a/libcxxabi/test/catch_member_data_pointer_01.pass.cpp
+++ b/libcxxabi/test/catch_member_data_pointer_01.pass.cpp
@@ -164,11 +164,13 @@ void test5()
     }
 }
 
-int main()
+int main(int, char**)
 {
     test1();
     test2();
     test3();
     test4();
     test5();
+
+    return 0;
 }

diff  --git a/libcxxabi/test/catch_member_function_pointer_01.pass.cpp b/libcxxabi/test/catch_member_function_pointer_01.pass.cpp
index f1d4e8d795b1..44ee925cc38d 100644
--- a/libcxxabi/test/catch_member_function_pointer_01.pass.cpp
+++ b/libcxxabi/test/catch_member_function_pointer_01.pass.cpp
@@ -161,10 +161,12 @@ void test_void()
     }
 }
 
-int main()
+int main(int, char**)
 {
     test1();
     test2();
     test_derived();
     test_void();
+
+    return 0;
 }

diff  --git a/libcxxabi/test/catch_member_function_pointer_02.pass.cpp b/libcxxabi/test/catch_member_function_pointer_02.pass.cpp
index c38a9306c41c..d203fe320f33 100644
--- a/libcxxabi/test/catch_member_function_pointer_02.pass.cpp
+++ b/libcxxabi/test/catch_member_function_pointer_02.pass.cpp
@@ -60,11 +60,13 @@ void check_deep() {
     }
 }
 
-int main()
+int main(int, char**)
 {
     check<false, false>();
     check<false, true>();
     check<true, false>();
     check<true, true>();
     check_deep();
+
+    return 0;
 }

diff  --git a/libcxxabi/test/catch_member_pointer_nullptr.pass.cpp b/libcxxabi/test/catch_member_pointer_nullptr.pass.cpp
index 54d4fd2af7da..bbf1ecf4657b 100644
--- a/libcxxabi/test/catch_member_pointer_nullptr.pass.cpp
+++ b/libcxxabi/test/catch_member_pointer_nullptr.pass.cpp
@@ -67,8 +67,10 @@ void test2()
 
 #endif
 
-int main()
+int main(int, char**)
 {
     test1();
     test2();
+
+    return 0;
 }

diff  --git a/libcxxabi/test/catch_multi_level_pointer.pass.cpp b/libcxxabi/test/catch_multi_level_pointer.pass.cpp
index be5a1105d5f5..5aa0915ff94e 100644
--- a/libcxxabi/test/catch_multi_level_pointer.pass.cpp
+++ b/libcxxabi/test/catch_multi_level_pointer.pass.cpp
@@ -130,7 +130,7 @@ struct generate_tests_imp<Throw, Catch, 0, first> {
 template <class Throw, class Catch, int level>
 struct generate_tests : generate_tests_imp<Throw, Catch, level, true> {};
 
-int main()
+int main(int, char**)
 {
   generate_tests<int, int, 3>()();
   generate_tests<Base, Derived, 2>()();
@@ -141,4 +141,6 @@ int main()
   generate_tests<int A::*, int A::*, 3>()();
   generate_tests<int A::*, void, 2>()();
   generate_tests<void, int A::*, 2>()();
+
+  return 0;
 }

diff  --git a/libcxxabi/test/catch_pointer_nullptr.pass.cpp b/libcxxabi/test/catch_pointer_nullptr.pass.cpp
index 3067e3ca2b3b..6a8ed377caa7 100644
--- a/libcxxabi/test/catch_pointer_nullptr.pass.cpp
+++ b/libcxxabi/test/catch_pointer_nullptr.pass.cpp
@@ -61,7 +61,7 @@ void catch_nullptr_test() {
 }
 
 
-int main()
+int main(int, char**)
 {
   // catch naked nullptrs
   test1();
@@ -72,4 +72,6 @@ int main()
   catch_nullptr_test<int A::*>();
   catch_nullptr_test<const int A::*>();
   catch_nullptr_test<int A::**>();
+
+  return 0;
 }

diff  --git a/libcxxabi/test/catch_pointer_reference.pass.cpp b/libcxxabi/test/catch_pointer_reference.pass.cpp
index 6ea0cae5d669..5ebcc122bc3f 100644
--- a/libcxxabi/test/catch_pointer_reference.pass.cpp
+++ b/libcxxabi/test/catch_pointer_reference.pass.cpp
@@ -427,7 +427,7 @@ void f13()
     assert_cannot_catch<const volatile Base * const volatile &, Protected *, Protected>();
 }
 
-int main()
+int main(int, char**)
 {
     f1();
     f2();
@@ -442,4 +442,6 @@ int main()
     f11();
     f12();
     f13();
+
+    return 0;
 }

diff  --git a/libcxxabi/test/catch_ptr.pass.cpp b/libcxxabi/test/catch_ptr.pass.cpp
index b2d8999120a6..5a409db9af0f 100644
--- a/libcxxabi/test/catch_ptr.pass.cpp
+++ b/libcxxabi/test/catch_ptr.pass.cpp
@@ -176,7 +176,7 @@ void f5()
     }
 }
 
-int main()
+int main(int, char**)
 {
     try
     {
@@ -186,4 +186,6 @@ int main()
     catch (...)
     {
     }
+
+    return 0;
 }

diff  --git a/libcxxabi/test/catch_ptr_02.pass.cpp b/libcxxabi/test/catch_ptr_02.pass.cpp
index d20076d22a6e..1908a499b07e 100644
--- a/libcxxabi/test/catch_ptr_02.pass.cpp
+++ b/libcxxabi/test/catch_ptr_02.pass.cpp
@@ -198,7 +198,7 @@ void test10 ()
     }
 }
 
-int main()
+int main(int, char**)
 {
     test1();
     test2();
@@ -210,4 +210,6 @@ int main()
     test8();
     test9();
     test10();
+
+    return 0;
 }

diff  --git a/libcxxabi/test/catch_reference_nullptr.pass.cpp b/libcxxabi/test/catch_reference_nullptr.pass.cpp
index 5718bff8f7fb..18bf2356c233 100644
--- a/libcxxabi/test/catch_reference_nullptr.pass.cpp
+++ b/libcxxabi/test/catch_reference_nullptr.pass.cpp
@@ -25,7 +25,7 @@ static void catch_nullptr_test() {
   }
 }
 
-int main()
+int main(int, char**)
 {
   using nullptr_t = decltype(nullptr);
 
@@ -46,4 +46,6 @@ int main()
   catch_nullptr_test<int A::*, false>();
   catch_nullptr_test<int (A::*)(), false>();
 #endif
+
+  return 0;
 }

diff  --git a/libcxxabi/test/cxa_thread_atexit_test.pass.cpp b/libcxxabi/test/cxa_thread_atexit_test.pass.cpp
index f167e3d96966..57783bedee0a 100644
--- a/libcxxabi/test/cxa_thread_atexit_test.pass.cpp
+++ b/libcxxabi/test/cxa_thread_atexit_test.pass.cpp
@@ -23,7 +23,7 @@ extern "C" int __cxa_thread_atexit_impl(void (*dtor)(void *), void *obj,
   return 4;
 }
 
-int main() {
+int main(int, char**) {
   int RV = __cxxabiv1::__cxa_thread_atexit(
       reinterpret_cast<void (*)(void *)>(1), reinterpret_cast<void *>(2),
       reinterpret_cast<void *>(3));

diff  --git a/libcxxabi/test/dynamic_cast.pass.cpp b/libcxxabi/test/dynamic_cast.pass.cpp
index 429f3da29a0b..669814b04226 100644
--- a/libcxxabi/test/dynamic_cast.pass.cpp
+++ b/libcxxabi/test/dynamic_cast.pass.cpp
@@ -143,11 +143,13 @@ void test()
 
 }  // t5
 
-int main()
+int main(int, char**)
 {
     t1::test();
     t2::test();
     t3::test();
     t4::test();
     t5::test();
+
+    return 0;
 }

diff  --git a/libcxxabi/test/dynamic_cast14.pass.cpp b/libcxxabi/test/dynamic_cast14.pass.cpp
index 57a4f26ed3b3..1ca6b576b22e 100644
--- a/libcxxabi/test/dynamic_cast14.pass.cpp
+++ b/libcxxabi/test/dynamic_cast14.pass.cpp
@@ -2172,10 +2172,12 @@ void test()
 
 }  // t3
 
-int main()
+int main(int, char**)
 {
     timer t;
     t1::test();
     t2::test();
     t3::test();
+
+    return 0;
 }

diff  --git a/libcxxabi/test/dynamic_cast3.pass.cpp b/libcxxabi/test/dynamic_cast3.pass.cpp
index d569d5a54024..2aa8b03fe4c7 100644
--- a/libcxxabi/test/dynamic_cast3.pass.cpp
+++ b/libcxxabi/test/dynamic_cast3.pass.cpp
@@ -1443,7 +1443,7 @@ void test()
 A1 A1
 |  |
 A2 |
- \ |  
+ \ |
   A3
 
 */
@@ -1926,7 +1926,7 @@ void test()
 A1
 | \
 A2 \
- \ |  
+ \ |
   A3
 
 */
@@ -2412,7 +2412,7 @@ void test()
 
 }  // t41
 
-int main()
+int main(int, char**)
 {
     timer t;
     t1::test();
@@ -2456,4 +2456,6 @@ int main()
     t39::test();
     t40::test();
     t41::test();
+
+    return 0;
 }

diff  --git a/libcxxabi/test/dynamic_cast5.pass.cpp b/libcxxabi/test/dynamic_cast5.pass.cpp
index a8e6d968bbcc..4d6c94c4141d 100644
--- a/libcxxabi/test/dynamic_cast5.pass.cpp
+++ b/libcxxabi/test/dynamic_cast5.pass.cpp
@@ -1305,7 +1305,7 @@ void test()
 }  // t9
 
 
-int main()
+int main(int, char**)
 {
     timer t;
     t1::test();
@@ -1317,4 +1317,6 @@ int main()
     t7::test();
     t8::test();
     t9::test();
+
+    return 0;
 }

diff  --git a/libcxxabi/test/dynamic_cast_stress.pass.cpp b/libcxxabi/test/dynamic_cast_stress.pass.cpp
index b20cc85e5929..1129fa1aae40 100644
--- a/libcxxabi/test/dynamic_cast_stress.pass.cpp
+++ b/libcxxabi/test/dynamic_cast_stress.pass.cpp
@@ -63,9 +63,11 @@ void test()
     assert(b != 0);
 }
 
-int main()
+int main(int, char**)
 {
     test();
+
+    return 0;
 }
 
 /*

diff  --git a/libcxxabi/test/exception_object_alignment.2.pass.cpp b/libcxxabi/test/exception_object_alignment.2.pass.cpp
index b35e72862991..1afa36e9109b 100644
--- a/libcxxabi/test/exception_object_alignment.2.pass.cpp
+++ b/libcxxabi/test/exception_object_alignment.2.pass.cpp
@@ -24,7 +24,7 @@ struct exception {
 
 struct foo : exception { };
 
-int main() {
+int main(int, char**) {
     try {
       throw foo();
     } catch (...) {

diff  --git a/libcxxabi/test/exception_object_alignment.pass.cpp b/libcxxabi/test/exception_object_alignment.pass.cpp
index df9f37b2e133..011ba5280a2e 100644
--- a/libcxxabi/test/exception_object_alignment.pass.cpp
+++ b/libcxxabi/test/exception_object_alignment.pass.cpp
@@ -21,7 +21,7 @@ struct S {
   int a[4];
 } __attribute__((aligned));
 
-int main() {
+int main(int, char**) {
 #if !defined(_LIBCXXABI_ARM_EHABI)
   void *p = __cxxabiv1::__cxa_allocate_exception(16);
   auto i = reinterpret_cast<uintptr_t>(p);

diff  --git a/libcxxabi/test/guard_test_basic.pass.cpp b/libcxxabi/test/guard_test_basic.pass.cpp
index 0c10a656bc98..e03dd183c3da 100644
--- a/libcxxabi/test/guard_test_basic.pass.cpp
+++ b/libcxxabi/test/guard_test_basic.pass.cpp
@@ -109,7 +109,7 @@ void NopFutexWait(int*, int) { assert(false); }
 void NopFutexWake(int*) { assert(false); }
 uint32_t MockGetThreadID() { return 0; }
 
-int main() {
+int main(int, char**) {
   {
 #if defined(_LIBCXXABI_HAS_NO_THREADS)
     static_assert(CurrentImplementation == Implementation::NoThreads, "");
@@ -152,4 +152,6 @@ int main() {
     Tests<uint32_t, FutexImpl>::test();
     Tests<uint64_t, FutexImpl>::test();
   }
+
+  return 0;
 }

diff  --git a/libcxxabi/test/guard_threaded_test.pass.cpp b/libcxxabi/test/guard_threaded_test.pass.cpp
index d562b4851afe..7e5e0de8c790 100644
--- a/libcxxabi/test/guard_threaded_test.pass.cpp
+++ b/libcxxabi/test/guard_threaded_test.pass.cpp
@@ -375,9 +375,11 @@ void test_futex_syscall() {
   waker.join();
 }
 
-int main() {
+int main(int, char**) {
   // Test each multi-threaded implementation with real threads.
   test_all_impls();
   // Test the basic sanity of the futex syscall wrappers.
   test_futex_syscall();
+
+  return 0;
 }

diff  --git a/libcxxabi/test/incomplete_type.sh.cpp b/libcxxabi/test/incomplete_type.sh.cpp
index 5521a1092863..cbcf7536ee31 100644
--- a/libcxxabi/test/incomplete_type.sh.cpp
+++ b/libcxxabi/test/incomplete_type.sh.cpp
@@ -83,7 +83,7 @@ void ThrowNullptr() { throw nullptr; }
 
 struct IncompleteAtThrow {};
 
-int main() {
+int main(int, char**) {
   AssertIncompleteTypeInfoEquals(ReturnTypeInfoNeverDefinedMP(), typeid(int NeverDefined::*));
   try {
     ThrowNeverDefinedMP();
@@ -205,7 +205,8 @@ int main() {
     assert(!p);
   }
   catch(...) { assert(!"FAIL: Didn't catch nullptr as NeverDefined::*" ); }
-
 #endif
+
+  return 0;
 }
 #endif

diff  --git a/libcxxabi/test/inherited_exception.pass.cpp b/libcxxabi/test/inherited_exception.pass.cpp
index ac92ab4dc6c2..1e3089c7da55 100644
--- a/libcxxabi/test/inherited_exception.pass.cpp
+++ b/libcxxabi/test/inherited_exception.pass.cpp
@@ -71,7 +71,7 @@ void f3() {
   throw static_cast<Base2*>(&child);
 }
 
-int main()
+int main(int, char**)
 {
     try
     {
@@ -170,4 +170,6 @@ int main()
     {
         assert(false);
     }
+
+    return 0;
 }

diff  --git a/libcxxabi/test/test_aux_runtime_op_array_new.pass.cpp b/libcxxabi/test/test_aux_runtime_op_array_new.pass.cpp
index 928e32459223..cc73c3c758b9 100644
--- a/libcxxabi/test/test_aux_runtime_op_array_new.pass.cpp
+++ b/libcxxabi/test/test_aux_runtime_op_array_new.pass.cpp
@@ -27,7 +27,7 @@ bool bad_array_new_length_test() {
     return false;
 }
 
-int main() {
+int main(int, char**) {
     int ret_val = 0;
 
     if ( !bad_array_new_length_test ()) {

diff  --git a/libcxxabi/test/test_demangle.pass.cpp b/libcxxabi/test/test_demangle.pass.cpp
index fd84d3bca1a1..f72b2eadf619 100644
--- a/libcxxabi/test/test_demangle.pass.cpp
+++ b/libcxxabi/test/test_demangle.pass.cpp
@@ -30006,7 +30006,7 @@ void testFPLiterals()
     free(buf);
 }
 
-int main()
+int main(int, char**)
 {
     std::cout << "Testing " << N << " symbols." << std::endl;
     {
@@ -30050,4 +30050,6 @@ int main()
         std::cout << '\n';
     }
 #endif
+
+    return 0;
 }

diff  --git a/libcxxabi/test/test_exception_address_alignment.pass.cpp b/libcxxabi/test/test_exception_address_alignment.pass.cpp
index 92652f464b8b..1b7316b2f32b 100644
--- a/libcxxabi/test/test_exception_address_alignment.pass.cpp
+++ b/libcxxabi/test/test_exception_address_alignment.pass.cpp
@@ -41,7 +41,7 @@ static_assert(alignof(_Unwind_Exception) == EXPECTED_ALIGNMENT,
 struct MinAligned {  };
 static_assert(alignof(MinAligned) == 1 && sizeof(MinAligned) == 1, "");
 
-int main() {
+int main(int, char**) {
   for (int i=0; i < 10; ++i) {
     try {
       throw MinAligned{};
@@ -49,4 +49,6 @@ int main() {
       assert(reinterpret_cast<uintptr_t>(&ref) % EXPECTED_ALIGNMENT == 0);
     }
   }
+
+  return 0;
 }

diff  --git a/libcxxabi/test/test_guard.pass.cpp b/libcxxabi/test/test_guard.pass.cpp
index 8c96ae891d22..2168986c455e 100644
--- a/libcxxabi/test/test_guard.pass.cpp
+++ b/libcxxabi/test/test_guard.pass.cpp
@@ -136,7 +136,7 @@ namespace test5 {
 }
 #endif /* _LIBCXXABI_HAS_NO_THREADS */
 
-int main()
+int main(int, char**)
 {
     test1::test();
     test2::test();
@@ -145,4 +145,6 @@ int main()
     test4::test();
     test5::test();
 #endif
+
+    return 0;
 }

diff  --git a/libcxxabi/test/test_vector3.pass.cpp b/libcxxabi/test/test_vector3.pass.cpp
index 9b7e671d26c0..928788f98679 100644
--- a/libcxxabi/test/test_vector3.pass.cpp
+++ b/libcxxabi/test/test_vector3.pass.cpp
@@ -47,7 +47,7 @@ void destroy(void* v)
   t->~T();
 }
 
-int main()
+int main(int, char**)
 {
   std::set_terminate(my_terminate);
   {
@@ -56,4 +56,6 @@ int main()
   __cxxabiv1::__cxa_vec_dtor(a, 10, sizeof(test1::A), destroy<test1::A>);
   assert(false);
   }
+
+  return 0;
 }

diff  --git a/libcxxabi/test/thread_local_destruction_order.pass.cpp b/libcxxabi/test/thread_local_destruction_order.pass.cpp
index 9bf1aa7d3a01..eeb90b820b87 100644
--- a/libcxxabi/test/thread_local_destruction_order.pass.cpp
+++ b/libcxxabi/test/thread_local_destruction_order.pass.cpp
@@ -56,7 +56,7 @@ void thread_fn() {
   thread_local CreatesThreadLocalInDestructor<0> creates_tl0;
 }
 
-int main() {
+int main(int, char**) {
   static OrderChecker fn_static{6};
 
   std::thread{thread_fn}.join();

diff  --git a/libcxxabi/test/unittest_demangle.pass.cpp b/libcxxabi/test/unittest_demangle.pass.cpp
index 5c0895682053..376725609a3d 100644
--- a/libcxxabi/test/unittest_demangle.pass.cpp
+++ b/libcxxabi/test/unittest_demangle.pass.cpp
@@ -81,6 +81,7 @@ void testPODSmallVector() {
   }
 }
 
-int main() {
+int main(int, char**) {
   testPODSmallVector();
+  return 0;
 }

diff  --git a/libcxxabi/test/unwind_01.pass.cpp b/libcxxabi/test/unwind_01.pass.cpp
index f71596127bf2..5a1abc6c6b4d 100644
--- a/libcxxabi/test/unwind_01.pass.cpp
+++ b/libcxxabi/test/unwind_01.pass.cpp
@@ -72,7 +72,7 @@ void f1()
     C c;
 }
 
-int main()
+int main(int, char**)
 {
     try
     {
@@ -98,4 +98,6 @@ int main()
     assert(A::count == 0);
     assert(B::count == 0);
     assert(C::count == 0);
+
+    return 0;
 }

diff  --git a/libcxxabi/test/unwind_02.pass.cpp b/libcxxabi/test/unwind_02.pass.cpp
index 3442bb5a638c..050e4afed446 100644
--- a/libcxxabi/test/unwind_02.pass.cpp
+++ b/libcxxabi/test/unwind_02.pass.cpp
@@ -73,7 +73,7 @@ void f1() throw (long, char, int, double)
     C c;
 }
 
-int main()
+int main(int, char**)
 {
     try
     {
@@ -99,4 +99,6 @@ int main()
     assert(A::count == 0);
     assert(B::count == 0);
     assert(C::count == 0);
+
+    return 0;
 }

diff  --git a/libcxxabi/test/unwind_03.pass.cpp b/libcxxabi/test/unwind_03.pass.cpp
index 482791d96219..154fb6e8ff7e 100644
--- a/libcxxabi/test/unwind_03.pass.cpp
+++ b/libcxxabi/test/unwind_03.pass.cpp
@@ -80,7 +80,7 @@ void u_handler()
     exit(0);
 }
 
-int main()
+int main(int, char**)
 {
     std::set_unexpected(u_handler);
     try
@@ -105,4 +105,6 @@ int main()
         assert(false);
     }
     assert(false);
+
+    return 0;
 }

diff  --git a/libcxxabi/test/unwind_04.pass.cpp b/libcxxabi/test/unwind_04.pass.cpp
index 069ca3798628..d85434dc8551 100644
--- a/libcxxabi/test/unwind_04.pass.cpp
+++ b/libcxxabi/test/unwind_04.pass.cpp
@@ -80,7 +80,7 @@ void u_handler()
     throw 'a';
 }
 
-int main()
+int main(int, char**)
 {
     std::set_unexpected(u_handler);
     try
@@ -111,4 +111,6 @@ int main()
     assert(A::count == 0);
     assert(B::count == 0);
     assert(C::count == 0);
+
+    return 0;
 }

diff  --git a/libcxxabi/test/unwind_05.pass.cpp b/libcxxabi/test/unwind_05.pass.cpp
index 9172a02a03f5..2f9f8da60325 100644
--- a/libcxxabi/test/unwind_05.pass.cpp
+++ b/libcxxabi/test/unwind_05.pass.cpp
@@ -80,7 +80,7 @@ void u_handler()
     throw;
 }
 
-int main()
+int main(int, char**)
 {
     std::set_unexpected(u_handler);
     try
@@ -115,4 +115,6 @@ int main()
     assert(A::count == 0);
     assert(B::count == 0);
     assert(C::count == 0);
+
+    return 0;
 }

diff  --git a/libcxxabi/test/unwind_06.pass.cpp b/libcxxabi/test/unwind_06.pass.cpp
index 1bcb89c1cab0..c4f23d85e9df 100644
--- a/libcxxabi/test/unwind_06.pass.cpp
+++ b/libcxxabi/test/unwind_06.pass.cpp
@@ -252,7 +252,7 @@ double foo()
 
 
 
-int main()
-{
+int main(int, char**) {
   foo();
+  return 0;
 }

diff  --git a/libunwind/test/alignment.pass.cpp b/libunwind/test/alignment.compile.pass.cpp
similarity index 98%
rename from libunwind/test/alignment.pass.cpp
rename to libunwind/test/alignment.compile.pass.cpp
index b0da7f155134..4606dc5e5385 100644
--- a/libunwind/test/alignment.pass.cpp
+++ b/libunwind/test/alignment.compile.pass.cpp
@@ -22,7 +22,3 @@ struct MaxAligned {} __attribute__((__aligned__));
 static_assert(alignof(_Unwind_Exception) == alignof(MaxAligned),
               "_Unwind_Exception must be maximally aligned");
 #endif
-
-int main()
-{
-}

diff  --git a/libunwind/test/frameheadercache_test.pass.cpp b/libunwind/test/frameheadercache_test.pass.cpp
index 7f14830fa30d..9abff5e8cda9 100644
--- a/libunwind/test/frameheadercache_test.pass.cpp
+++ b/libunwind/test/frameheadercache_test.pass.cpp
@@ -19,7 +19,7 @@
 
 using namespace libunwind;
 
-int main() {
+int main(int, char**) {
   FrameHeaderCache FHC;
   struct dl_phdr_info PInfo;
   memset(&PInfo, 0, sizeof(PInfo));
@@ -68,5 +68,5 @@ int main() {
 }
 
 #else
-int main() { return 0;}
+int main(int, char**) { return 0;}
 #endif

diff  --git a/libunwind/test/libunwind_01.pass.cpp b/libunwind/test/libunwind_01.pass.cpp
index db5d53d184d1..191684d56fe9 100644
--- a/libunwind/test/libunwind_01.pass.cpp
+++ b/libunwind/test/libunwind_01.pass.cpp
@@ -55,9 +55,10 @@ void test_no_info() {
     abort();
 }
 
-int main() {
+int main(int, char**) {
   test1(1);
   test2(1, 2);
   test3(1, 2, 3);
   test_no_info();
+  return 0;
 }

diff  --git a/libunwind/test/libunwind_02.pass.cpp b/libunwind/test/libunwind_02.pass.cpp
index a0efd1df79fa..b188fad8ee5b 100644
--- a/libunwind/test/libunwind_02.pass.cpp
+++ b/libunwind/test/libunwind_02.pass.cpp
@@ -32,7 +32,8 @@ int test(int i) {
   }
 }
 
-int main() {
+int main(int, char**) {
   int total = test(50);
   assert(total == 1275);
+  return 0;
 }

diff  --git a/libunwind/test/signal_frame.pass.cpp b/libunwind/test/signal_frame.pass.cpp
index a899461fafb4..28f8d99a6a65 100644
--- a/libunwind/test/signal_frame.pass.cpp
+++ b/libunwind/test/signal_frame.pass.cpp
@@ -25,7 +25,7 @@ void test() {
   assert(unw_is_signal_frame(&cursor));
 }
 
-int main() {
+int main(int, char**) {
   test();
   return 0;
 }

diff  --git a/libunwind/test/signal_unwind.pass.cpp b/libunwind/test/signal_unwind.pass.cpp
index 5955c1b14055..25ff0bbfc509 100644
--- a/libunwind/test/signal_unwind.pass.cpp
+++ b/libunwind/test/signal_unwind.pass.cpp
@@ -38,7 +38,7 @@ void signal_handler(int signum) {
   _Exit(-1);
 }
 
-int main() {
+int main(int, char**) {
   signal(SIGUSR1, signal_handler);
   kill(getpid(), SIGUSR1);
   return -2;

diff  --git a/libunwind/test/unw_getcontext.pass.cpp b/libunwind/test/unw_getcontext.pass.cpp
index b012706a0bf9..a1f2baee12b4 100644
--- a/libunwind/test/unw_getcontext.pass.cpp
+++ b/libunwind/test/unw_getcontext.pass.cpp
@@ -1,8 +1,9 @@
 #include <assert.h>
 #include <libunwind.h>
 
-int main() {
+int main(int, char**) {
   unw_context_t context;
   int ret = unw_getcontext(&context);
   assert(ret == UNW_ESUCCESS);
+  return 0;
 }

diff  --git a/libunwind/test/unwind_leaffunction.pass.cpp b/libunwind/test/unwind_leaffunction.pass.cpp
index 8e4fcbe9312d..2b08a16e5fef 100644
--- a/libunwind/test/unwind_leaffunction.pass.cpp
+++ b/libunwind/test/unwind_leaffunction.pass.cpp
@@ -44,7 +44,7 @@ __attribute__((noinline)) void crashing_leaf_func(void) {
   *faultyPointer = 0;
 }
 
-int main() {
+int main(int, char**) {
   signal(SIGSEGV, signal_handler);
   crashing_leaf_func();
   return -2;


        


More information about the libcxx-commits mailing list