[clang] 18b2385 - [clang] [test] Fix clang-cl unused argument tests on paths that start with /U

Martin Storsjö via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 11 02:28:29 PST 2022


Author: Martin Storsjö
Date: 2022-01-11T12:28:23+02:00
New Revision: 18b2385f2b09453b5e9d26459ec9e806f5ee7f86

URL: https://github.com/llvm/llvm-project/commit/18b2385f2b09453b5e9d26459ec9e806f5ee7f86
DIFF: https://github.com/llvm/llvm-project/commit/18b2385f2b09453b5e9d26459ec9e806f5ee7f86.diff

LOG: [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.

Added: 
    

Modified: 
    clang/test/Driver/diagnostics.c

Removed: 
    


################################################################################
diff  --git a/clang/test/Driver/diagnostics.c b/clang/test/Driver/diagnostics.c
index 73f427c02dcce..b9455b0a91f57 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'


        


More information about the cfe-commits mailing list