[libcxx-commits] [PATCH] D152097: [libc++][format] Make public functions nodiscard.

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jun 12 08:04:12 PDT 2023


philnik accepted this revision.
philnik added inline comments.
This revision is now accepted and ready to land.


================
Comment at: libcxx/test/std/utilities/format/format.arguments/format.arg.store/make_format_args.sh.cpp:27
 void test() {
-  std::make_format_args<std::basic_format_context<
-      std::back_insert_iterator<std::basic_string<wchar_t>>, wchar_t>>('c');
+  TEST_IGNORE_NODISCARD
+  std::make_format_args<std::basic_format_context<std::back_insert_iterator<std::basic_string<wchar_t>>, wchar_t>>('c');
----------------
Mordante wrote:
> philnik wrote:
> > Why not simply cast to void?
> I prefer name instead of a magic invocation, @BillyONeal spend the effort to change them in D40065.
IMO it's kind-of pointless to have a macro that just casts to void, since its people know what casting to void means, but not what a given macro actually does. It looks to me like the macro does something magical to check that it's actually ignoring nodiscard.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152097/new/

https://reviews.llvm.org/D152097



More information about the libcxx-commits mailing list