diff options
author | Martin Storsjö <martin@martin.st> | 2022-01-11 12:22:42 +0200 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2022-01-11 12:28:23 +0200 |
commit | 18b2385f2b09453b5e9d26459ec9e806f5ee7f86 (patch) | |
tree | f661677c8da7d8660347880a7c3291c20107843d | |
parent | aff9f2dc0160125569593965e44885b61ec9b67a (diff) | |
download | llvm-18b2385f2b09453b5e9d26459ec9e806f5ee7f86.tar.gz |
[clang] [test] Fix clang-cl unused argument tests on paths that start with /U
This reinstates a test that was temporarily removed in
e26bbae30218a35d76a79fe90b0e41dd0f71b779, in a form that works on
Darwin.
Use -LD instead of -link as a linker argument that is unused when
compiling, that produces warnings normally. -LD can be placed anywhere
in the command line, so that the command line ends with "-- %s", making
paths starting with /U correctly interpreted as paths, not options.
-rw-r--r-- | clang/test/Driver/diagnostics.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/Driver/diagnostics.c b/clang/test/Driver/diagnostics.c index 73f427c02dcc..b9455b0a91f5 100644 --- a/clang/test/Driver/diagnostics.c +++ b/clang/test/Driver/diagnostics.c @@ -40,4 +40,14 @@ // RUN: --start-no-unused-arguments -fsyntax-only --end-no-unused-arguments \ // RUN: -lfoo -Werror %s 2>&1 | FileCheck %s +// Test clang-cl warning about unused linker options. +// RUN: not %clang_cl -fsyntax-only /WX \ +// RUN: -LD -- %s 2>&1 | FileCheck %s --check-prefix=CL-WARNING + +// Test clang-cl ignoring the warning with --start-no-unused-arguments. +// RUN: %clang_cl -fsyntax-only /WX \ +// RUN: --start-no-unused-arguments /LD --end-no-unused-arguments -- %s 2>&1 | count 0 + // CHECK: -lfoo: 'linker' input unused + +// CL-WARNING: argument unused during compilation: '-LD' |