[PATCH] D45179: [libc++] Add _LIBCPP_FORCE_NODISCARD define to force-enable nodiscard in pre-C++17

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 4 04:26:57 PDT 2018


lebedev.ri updated this revision to Diff 140934.
lebedev.ri added a comment.

Based on IRC disscussion, try to update the patch.

The main problem is that gcc does not silence the warning produced by
these attributes via `(void)` cast, unless it's `[[nodiscard]]` attribute :/
https://godbolt.org/g/m3gPKQ

So until they fix that (they will fix that right? :)),
we can only support `_LIBCPP_FORCE_NODISCARD` for clang compilers.


Repository:
  rCXX libc++

https://reviews.llvm.org/D45179

Files:
  include/__config
  test/libcxx/diagnostics/force_nodiscard.fail.cpp
  test/libcxx/diagnostics/force_nodiscard.pass.cpp
  test/libcxx/diagnostics/nodiscard.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45179.140934.patch
Type: text/x-patch
Size: 4020 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180404/ac38345e/attachment.bin>


More information about the cfe-commits mailing list