[libcxx-commits] [libcxx] [libc++][ios] Applied `[[nodiscard]]` (PR #173520)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Dec 25 05:15:34 PST 2025
================
@@ -305,25 +305,25 @@ public:
class _LIBCPP_EXPORTED_FROM_ABI Init;
// 27.5.2.2 fmtflags state:
- _LIBCPP_HIDE_FROM_ABI fmtflags flags() const;
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI fmtflags flags() const;
_LIBCPP_HIDE_FROM_ABI fmtflags flags(fmtflags __fmtfl);
_LIBCPP_HIDE_FROM_ABI fmtflags setf(fmtflags __fmtfl);
_LIBCPP_HIDE_FROM_ABI fmtflags setf(fmtflags __fmtfl, fmtflags __mask);
_LIBCPP_HIDE_FROM_ABI void unsetf(fmtflags __mask);
- _LIBCPP_HIDE_FROM_ABI streamsize precision() const;
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI streamsize precision() const;
_LIBCPP_HIDE_FROM_ABI streamsize precision(streamsize __prec);
- _LIBCPP_HIDE_FROM_ABI streamsize width() const;
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI streamsize width() const;
_LIBCPP_HIDE_FROM_ABI streamsize width(streamsize __wide);
// 27.5.2.3 locales:
locale imbue(const locale& __loc);
- locale getloc() const;
+ [[__nodiscard__]] locale getloc() const;
// 27.5.2.5 storage:
- static int xalloc();
- long& iword(int __index);
- void*& pword(int __index);
+ [[__nodiscard__]] static int xalloc();
+ [[__nodiscard__]] long& iword(int __index);
+ [[__nodiscard__]] void*& pword(int __index);
----------------
philnik777 wrote:
If you're unsure, please wait for review from @llvm/reviewers-libcxx or not annotate them. We should be conservative about `[[nodiscard]]` applications, since people will turn them off if they're too chatty.
https://github.com/llvm/llvm-project/pull/173520
More information about the libcxx-commits
mailing list