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

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 4 16:58:24 PST 2022


MaskRay added a comment.

I know some folks who dislike aggressive unused command line option diagnostics but also worry about -Qunused-arguments -Wno-unused-command-line-argument affecting the entire command line. start/end looks good to me.



================
Comment at: clang/docs/ClangCommandLineReference.rst:1342
+
+Don't warn for unused arguments between these arguments.
+
----------------
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.


================
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">;
----------------
Drop `NoXarchOption`. The option can be used with Darwin -Xarch (`test/Driver/Xarch.c`) though it is unnecessary to test it.


================
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.
----------------
Looks like no command has an output. In case there is one, make sure `-o /dev/null`


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