[all-commits] [llvm/llvm-project] 50ec13: [clang] Add --start-no-unused-arguments/--end-no-u...

Martin Storsjö via All-commits all-commits at lists.llvm.org
Mon Jan 10 23:22:34 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 50ec1306d060e46e0d53c9f5d8a052e1b0d10d3b
      https://github.com/llvm/llvm-project/commit/50ec1306d060e46e0d53c9f5d8a052e1b0d10d3b
  Author: Martin Storsjö <martin at martin.st>
  Date:   2022-01-11 (Tue, 11 Jan 2022)

  Changed paths:
    M clang/docs/ClangCommandLineReference.rst
    M clang/include/clang/Driver/Options.td
    M clang/lib/Driver/Driver.cpp
    M clang/test/Driver/diagnostics.c

  Log Message:
  -----------
  [clang] Add --start-no-unused-arguments/--end-no-unused-arguments to silence some unused argument warnings

When passing a set of flags to configure defaults for a specific
target (similar to the cmake settings `CLANG_DEFAULT_RTLIB`,
`CLANG_DEFAULT_UNWINDLIB`, `CLANG_DEFAULT_CXX_STDLIB` and
`CLANG_DEFAULT_LINKER`, but without hardcoding them in the binary),
some of the flags may cause warnings (e.g. `-stdlib=` when compiling C
code). Allow requesting selectively ignoring unused arguments among
some of the arguments on the command line, without needing to resort
to `-Qunused-arguments` or `-Wno-unused-command-line-argument`.

Fix up the existing diagnostics.c testcase. It was added in
response to PR12181 to fix handling of
`-Werror=unused-command-line-argument`, but the command line option
in the test (`-fzyzzybalubah`) now triggers "error: unknown argument"
instead of the intended warning. Change it into a linker input
(`-lfoo`) which triggers the intended diagnostic. Extend the
existing test case to check more cases and make sure that it keeps
testing the intended case.

Add testing of the new option to this existing test.

Differential Revision: https://reviews.llvm.org/D116503




More information about the All-commits mailing list