Skip to content

Revert "[Clang][Driver] Warn about -c/-S with -fsyntax-only" #100052

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 23, 2024

Conversation

dyung
Copy link
Collaborator

@dyung dyung commented Jul 23, 2024

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' labels Jul 23, 2024
@dyung dyung merged commit b5f23e5 into main Jul 23, 2024
7 of 9 checks passed
@dyung dyung deleted the revert-98607-clang-fsyntax-only-S-c branch July 23, 2024 02:06
@llvmbot
Copy link
Member

llvmbot commented Jul 23, 2024

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clang-driver

Author: None (dyung)

Changes

Reverts llvm/llvm-project#98607

The test added was failing on some build bots:


Full diff: https://github.com/llvm/llvm-project/pull/100052.diff

2 Files Affected:

  • (modified) clang/lib/Driver/ToolChains/Clang.cpp (+4)
  • (removed) clang/test/Driver/warn-fsyntax-only.c (-7)
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index f881fe8c395f8..f240a47504ef6 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -794,6 +794,10 @@ 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.
diff --git a/clang/test/Driver/warn-fsyntax-only.c b/clang/test/Driver/warn-fsyntax-only.c
deleted file mode 100644
index b4cf74fc59855..0000000000000
--- a/clang/test/Driver/warn-fsyntax-only.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// RUN: %clang -fsyntax-only -E %s 2>&1 | FileCheck %s --check-prefix=CHECK-PP
-// RUN: %clang -fsyntax-only -S %s 2>&1 | FileCheck %s --check-prefix=CHECK-ASM
-// RUN: %clang -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]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants