[llvm] [NFC][CodingStandard] Deprecate use of void casts to suppress warnings (PR #142850)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 4 15:21:45 PDT 2025


jurahul wrote:

> Just confirming that this means something like
> 
> ```
> void f(int x) {
> #ifdef XYZ
>   (void)x;
>   [...]
> #else
>   [do something with x]
> ```
> 
> becomes
> 
> ```
> void f([[maybe_unused]] int x) {
> #ifdef XYZ
>   [...]
> #else
>   [do something with x]
> ```

Yes. The attribute is needed only in function definition and not in the declaration.

https://github.com/llvm/llvm-project/pull/142850


More information about the llvm-commits mailing list