================
@@ -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)) {}
----------------
zwuis wrote:

Libc++ is applying `[[nodiscard]]` following [its coding 
guidelines](https://libcxx.llvm.org/CodingGuidelines.html#apply-nodiscard-where-relevant).
 Changing the default value make clang-tidy be same strict as compiler warning, 
which is not the way to go.

> * In fact allowing `(void)` seems better than only allowing a `NOLINT` or a 
> `[[maybe_unused]]`

1. There is another option to silence the warning by modifying code as 
`std::ignore = ...;`.
2. I don't think it's clear that which is better. I think it's personal 
preference/preference of the project.

> * 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.

I don't see "make this check realily applicable". I took a glance at the 
default values and explanation of other options of this check and they seem to 
be reasonable.

> * Once the codebases transition to C++26, they may transition to the `_` 
> placeholder, introduced for this purpose.

I don't see the relation between this purpose and the name of this checker. It 
would be better to disable this check and add another check to do it.

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