[PATCH] D116503: [clang] Add arguments for silencing unused argument warnings for some but not all arguments

Martin Storsjö via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 5 01:26:15 PST 2022


mstorsjo added a comment.

In D116503#3221083 <https://reviews.llvm.org/D116503#3221083>, @MaskRay wrote:

> A more searchable subject (mentioning the new option in the subject is useful for archaeology) may be `Add --start-no-unused-arguments/--end-no-unused-arguments to silence some unused argument warnings`

Thanks, that's indeed a better summary (although the subject line ends up even longer than now). Will change it to that form.



================
Comment at: clang/docs/ClangCommandLineReference.rst:1342
+
+Don't warn for unused arguments between these arguments.
+
----------------
MaskRay wrote:
> The sentence will be scrubbed.
> 
> Use `path/to/clang-tblgen -gen-opt-docs -I llvm/include -I clang/include/clang/Driver clang/include/clang/Driver/ClangOptionDocs.td > clang/docs/ClangCommandLineReference.rst` to regenerate this rst.
Ok, will do. There's lots of other changes in the file though, from other options that haven't been added here, but I'm just including the changes for the options I'm adding in this commit.


================
Comment at: clang/include/clang/Driver/Options.td:3918
 def specs : Separate<["-", "--"], "specs">, Flags<[Unsupported]>;
+def start_no_unused_arguments : Flag<["--"], "start-no-unused-arguments">, Flags<[NoXarchOption, CoreOption]>,
+  HelpText<"Don't emit warnings about unused arguments for the following arguments">;
----------------
MaskRay wrote:
> Drop `NoXarchOption`. The option can be used with Darwin -Xarch (`test/Driver/Xarch.c`) though it is unnecessary to test it.
Ok, will do.


================
Comment at: clang/test/Driver/diagnostics.c:21
+// RUN:   -fsyntax-only -lfoo -Werror %s 2>&1 | FileCheck %s
 
+// With a specific -Wno-..., no diagnostic should be printed.
----------------
MaskRay wrote:
> Looks like no command has an output. In case there is one, make sure `-o /dev/null`
As all commands use `-fsyntax-only`, I presume there should be no output. So do I read your comment correctly that we should have `-o /dev/null` specifically _if_ we'd have a test that lack `-fsyntax-only`, or do you want me to add it just in case? (The preexisting test doesn't have that and just use `-fsyntax-only`.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116503



More information about the cfe-commits mailing list