[libc++][test] cleanup in formatter.h
authorCasey Carter <Casey@Carter.net>
Wed, 11 Jan 2023 01:49:53 +0000 (17:49 -0800)
committerCasey Carter <Casey@Carter.net>
Wed, 11 Jan 2023 20:57:02 +0000 (12:57 -0800)
* Silence warnings for unused parameters / variables
* There's no reason to output unexpected exceptions only for libc++

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

libcxx/test/std/time/time.syn/formatter_tests.h

index b66b2a856abeaff372ac17efef1e3aa855f62065..115d6cc7b93d82851ee60f319ca97440d33edc26 100644 (file)
@@ -70,6 +70,9 @@ void check_exception([[maybe_unused]] std::string_view what,
         std::cerr << "\nFormat string   " << fmt << "\nExpected exception " << what << "\nActual exception   "
                   << e.what() << '\n';
     assert(e.what() == what);
+#  else
+    (void)what;
+    (void)e;
 #  endif
     return;
   }
@@ -92,10 +95,9 @@ void check_invalid_type(const std::set<std::basic_string_view<CharT>>& valid_typ
           std::basic_string_view<CharT>{fmt}, std::make_format_args<format_context<CharT>>(arg));
 #ifndef TEST_HAS_NO_EXCEPTIONS
     } catch (const std::format_error& e) {
-#  if defined(_LIBCPP_VERSION)
+      (void)e;
       if constexpr (std::same_as<CharT, char>)
         std::cerr << "\nFormat string        " << fmt << "\nUnexpected exception " << e.what() << '\n';
-#  endif
       assert(false);
     }
 #endif