Skip to content

Commit

Permalink
[Driver] Don't claim -c/-S
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
MaskRay committed Jul 24, 2024
1 parent 6942f1d commit 6461e53
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 0 additions & 4 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -794,10 +794,6 @@ static void addPGOAndCoverageFlags(const ToolChain &TC, Compilation &C,
Args.hasArg(options::OPT_coverage))
FProfileDir = Args.getLastArg(options::OPT_fprofile_dir);

// TODO: Don't claim -c/-S to warn about -fsyntax-only -c/-S, -E -c/-S,
// like we warn about -fsyntax-only -E.
(void)(Args.hasArg(options::OPT_c) || Args.hasArg(options::OPT_S));

// Put the .gcno and .gcda files (if needed) next to the primary output file,
// or fall back to a file in the current directory for `clang -c --coverage
// d/a.c` in the absence of -o.
Expand Down
7 changes: 7 additions & 0 deletions clang/test/Driver/warn-fsyntax-only.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// RUN: %clang --target=x86_64 -fsyntax-only -E %s 2>&1 | FileCheck %s --check-prefix=CHECK-PP
// RUN: %clang --target=x86_64 -fsyntax-only -S %s 2>&1 | FileCheck %s --check-prefix=CHECK-ASM
// RUN: %clang --target=x86_64 -fsyntax-only -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-OBJ

// CHECK-PP: warning: argument unused during compilation: '-fsyntax-only' [-Wunused-command-line-argument]
// CHECK-ASM: warning: argument unused during compilation: '-S' [-Wunused-command-line-argument]
// CHECK-OBJ: warning: argument unused during compilation: '-c' [-Wunused-command-line-argument]

0 comments on commit 6461e53

Please sign in to comment.