Skip to content

Commit 6461e53

Browse files
committed
[Driver] Don't claim -c/-S
Remove the TODO I left in commit a07b135. We will now warn about `-c/-S` with `-fsyntax-only`. This relands #98607 with a specific target triple.
1 parent 6942f1d commit 6461e53

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -794,10 +794,6 @@ static void addPGOAndCoverageFlags(const ToolChain &TC, Compilation &C,
794794
Args.hasArg(options::OPT_coverage))
795795
FProfileDir = Args.getLastArg(options::OPT_fprofile_dir);
796796

797-
// TODO: Don't claim -c/-S to warn about -fsyntax-only -c/-S, -E -c/-S,
798-
// like we warn about -fsyntax-only -E.
799-
(void)(Args.hasArg(options::OPT_c) || Args.hasArg(options::OPT_S));
800-
801797
// Put the .gcno and .gcda files (if needed) next to the primary output file,
802798
// or fall back to a file in the current directory for `clang -c --coverage
803799
// d/a.c` in the absence of -o.

clang/test/Driver/warn-fsyntax-only.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// RUN: %clang --target=x86_64 -fsyntax-only -E %s 2>&1 | FileCheck %s --check-prefix=CHECK-PP
2+
// RUN: %clang --target=x86_64 -fsyntax-only -S %s 2>&1 | FileCheck %s --check-prefix=CHECK-ASM
3+
// RUN: %clang --target=x86_64 -fsyntax-only -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-OBJ
4+
5+
// CHECK-PP: warning: argument unused during compilation: '-fsyntax-only' [-Wunused-command-line-argument]
6+
// CHECK-ASM: warning: argument unused during compilation: '-S' [-Wunused-command-line-argument]
7+
// CHECK-OBJ: warning: argument unused during compilation: '-c' [-Wunused-command-line-argument]

0 commit comments

Comments
 (0)