[PATCH] D121560: [clang][Opt] Add NoArgUnusedWith to not warn for unused redundant options

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 13 15:08:27 PDT 2022


MaskRay added a comment.

In D121560#3448733 <https://reviews.llvm.org/D121560#3448733>, @abrachet wrote:

> In D121560#3439570 <https://reviews.llvm.org/D121560#3439570>, @MaskRay wrote:
>
>> If you need a -static-libstdc++ not subject to unused argument warning, --start-no-unused-arguments and D53238 <https://reviews.llvm.org/D53238> (-static=c++stdlib) may be better choices.
>
> That patch might help for `-static-libstdc++` in particular and other -static-* flags, however there are other flags that this will help with in the future. What about `-nostdlib -noprofilelib`. I'm currently only interested with `-nostdlib` and haven't looked into other flags but I suspect this could help in other instances too. Could be helpful with sanitizers too, but all their flags get read into SanitizerArgs so there are never warnings there.
>
> I don't think --start-no-unused arguments is as good as a solution here. For a large project build, I think `--{start,end}-no-unused-arguments` is too heavy a hand. You would just end up putting it everywhere and lose any warnings that might be useful. This patch is specifically trying to reduce the need for those.

I have run into situation where I find the unused argument warning for `-nostdlib` is inconvenient (musl clang wrapper), but I can think of users who actually want to the diagnostic.
I am concerned that the decision suitable for your use case may not be desired by other groups.
This is why I'd like keep suggesting `--start-no-unused-arguments`: it encodes the intention clearly and cannot get in the way of others while achieving your goals.
It's just longer, less ergonomic.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121560/new/

https://reviews.llvm.org/D121560



More information about the cfe-commits mailing list