[PATCH] D121560: [clang][Opt] Add NoArgUnusedWith to not warn for unused redundant options
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 13 15:51:52 PDT 2022
MaskRay added a comment.
> This patch adds an example for -static-libcxx and -nostdlib.
We have -static-libstdc++ but not -static-libc++. (D53238 <https://reviews.llvm.org/D53238> attempts to add `-static` and name it `-static=c++stdlib`)
> NoArgUnusedWith can be used for options which together are redundant or not meaningful.
I agree that `-Wunused-command-line-argument` sometimes gets in the way and removing the warnings is sometimes inconvenient.
You can currently avoid the warning with: `--start-no-unused-arguments -static-libstdc++ --end-no-unused-arguments`.
For `NoArgUnusedWith`, intuitively I am unsure whether it is sufficient for many options. For example, you probably want to remove the diagnostic with `-nostdlib++` and `-nodefaultlibs` as well.
There are just so many similar options.
================
Comment at: clang/lib/Driver/Driver.cpp:4426
+ std::function<bool(llvm::opt::DerivedArgList &, Arg *)> ConsideredUsed =
+ [&ConsideredUsed](llvm::opt::DerivedArgList &Args, Arg *A) {
----------------
Unless you want to capture it somewhere.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D121560/new/
https://reviews.llvm.org/D121560
More information about the llvm-commits
mailing list