================
@@ -145,7 +146,9 @@ 
UnusedReturnValueCheck::UnusedReturnValueCheck(llvm::StringRef Name,
                                             "^::std::errc$;"
                                             "^::std::expected$;"
                                             "^::boost::system::error_code$"))),
-      AllowCastToVoid(Options.get("AllowCastToVoid", false)) {}
+      AllowCastToVoid(
+          Options.get("AllowCastToVoid", Context->getLangOpts().LangStd <
+                                             LangStandard::lang_cxx26)) {}
----------------
maflcko wrote:

yes, I understand that this makes it a bit more permissive for 23-or-less. 
However, I think this is desirable, because:

* There is no risk or downside to allow casting to void to silence the warning 
in normal code, compared to the other methods of silencing the warning.
* In fact allowing `(void)` seems better than only allowing a `NOLINT` or a 
`[[maybe_unused]]`
* This makes this bugprone check readily applicable to more codebases without 
extra steps of having to rewrite `(void)` casts to something else, or having to 
toggle options.
* Once the codebases transition to C++26, they may transition to the `_` 
placeholder, introduced for this purpose.

This all seem like benefits to me, and I don't see any downside or risk. But 
maybe I am missing something obvious?

https://github.com/llvm/llvm-project/pull/171618
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to