Repository navigation
Revert "Reland "[Clang] Enable -Wunused-template under -Wall" (#208001)" - #218638
Conversation
…08001)" This reverts commit 1529d35. There are two issues: - The change appear fairly disruptive so close to release (see comments on llvm#208001) - there are false positives (see llvm#218429)
|
@llvm/pr-subscribers-clang Author: Corentin Jabot (cor3ntin) ChangesThis reverts commit 1529d35. There are two issues:
5 Files Affected:
diff --git a/clang/docs/ReleaseNotes.md b/clang/docs/ReleaseNotes.md
index 64979e07021dc..ef99667d817e3 100644
--- a/clang/docs/ReleaseNotes.md
+++ b/clang/docs/ReleaseNotes.md
@@ -237,11 +237,6 @@ features cannot lower the translation-unit ABI level;
allowing it to be disabled independently with `-Wno-unused-but-set-global`.
(#GH148361)
-- `-Wunused-template` is now part of `-Wunused` (which is enabled by `-Wall`).
- It diagnoses unused function and variable templates with internal linkage,
- which in a header is a latent ODR hazard. It can be disabled with
- `-Wno-unused-template`. (#GH202945)
-
- Added `-Wlifetime-safety` to enable lifetime safety analysis,
a CFG-based intra-procedural analysis that detects use-after-free and related
temporal safety bugs. See the
diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td
index 9ee0b61a96a32..5403fadccd5d2 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/include/clang/Basic/DiagnosticGroups.td
@@ -1376,7 +1376,7 @@ def Conversion
def Unused : DiagGroup<"unused",
[UnusedArgument, UnusedFunction, UnusedLabel,
// UnusedParameter, (matches GCC's behavior)
- UnusedTemplate,
+ // UnusedTemplate, (clean-up libc++ before enabling)
// UnusedMemberFunction, (clean-up llvm before enabling)
UnusedPrivateField, UnusedLambdaCapture,
UnusedLocalTypedef, UnusedValue, UnusedVariable,
diff --git a/clang/test/Misc/warning-wall.c b/clang/test/Misc/warning-wall.c
index ade9cbaace77e..6d6c4e562400f 100644
--- a/clang/test/Misc/warning-wall.c
+++ b/clang/test/Misc/warning-wall.c
@@ -73,8 +73,6 @@ CHECK-NEXT: -Wunused-argument
CHECK-NEXT: -Wunused-function
CHECK-NEXT: -Wunneeded-internal-declaration
CHECK-NEXT: -Wunused-label
-CHECK-NEXT: -Wunused-template
-CHECK-NEXT: -Wunneeded-internal-declaration
CHECK-NEXT: -Wunused-private-field
CHECK-NEXT: -Wunused-lambda-capture
CHECK-NEXT: -Wunused-local-typedef
diff --git a/clang/test/SemaCXX/warn-func-not-needed.cpp b/clang/test/SemaCXX/warn-func-not-needed.cpp
index 74438543c43b7..cb3cae4cd6c76 100644
--- a/clang/test/SemaCXX/warn-func-not-needed.cpp
+++ b/clang/test/SemaCXX/warn-func-not-needed.cpp
@@ -10,7 +10,7 @@ void foo() {
}
namespace test1_template {
-template <typename T> static void f() {} // expected-warning {{unused function template}}
+template <typename T> static void f() {}
template <> void f<int>() {} // expected-warning {{function 'f<int>' is not needed and will not be emitted}}
template <typename T>
void foo() {
diff --git a/clang/test/SemaCXX/warn-variable-not-needed.cpp b/clang/test/SemaCXX/warn-variable-not-needed.cpp
index d234e9140e3fd..272c8998d15c0 100644
--- a/clang/test/SemaCXX/warn-variable-not-needed.cpp
+++ b/clang/test/SemaCXX/warn-variable-not-needed.cpp
@@ -4,7 +4,7 @@ namespace test1 {
static int abc = 42; // expected-warning {{variable 'abc' is not needed and will not be emitted}}
namespace {
- template <typename T> int abc_template = 0; // expected-warning {{unused variable template}}
+ template <typename T> int abc_template = 0;
template <> int abc_template<int> = 0; // expected-warning {{variable 'abc_template<int>' is not needed and will not be emitted}}
} // namespace
template <typename T>
|
🪟 Windows x64 Test Results
Failed Tests(click on a test name to see its output) ClangClang.CodeGen/AArch64/abi-classify-arg-types.cClang.CodeGen/AArch64/abi-classify-arg-types.cppIf these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the |
🐧 Linux x64 Test Results
Failed Tests(click on a test name to see its output) ClangClang.Analysis/Scalable/source-edit-generation/coexistence.cpp (Likely Already Failing)This test is already failing at the base commit.Clang.Analysis/Scalable/source-edit-generation/happy-path.cpp (Likely Already Failing)This test is already failing at the base commit.Clang.Analysis/Scalable/source-edit-generation/write-failure.cpp (Likely Already Failing)This test is already failing at the base commit.Clang.CodeGen/AArch64/abi-classify-arg-types.cClang.CodeGen/AArch64/abi-classify-arg-types.cppIf these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the |
Fznamznon
left a comment
There was a problem hiding this comment.
I think most of problems reported in the PR are actually fixed though, however if there are false positives, I agree that it makes sense to revert due to release.
AFAIK CI fails are unrelated
| @@ -238,11 +225,6 @@ features cannot lower the translation-unit ABI level; | |||
|
|
|||
| - More consistent rendering of Unicode characters in diagnostic messages. | |||
|
|
|||
There was a problem hiding this comment.
I'm confused, the patch went to 23, but the release note is still in main? Did we not clear release notes yet?
There was a problem hiding this comment.
I don't think we actually tagged the release yet? We might have a few more hours. Time to land reflection
|
/cherry-pick 8710728 |
|
Failed to create pull request for issue218638 https://github.com/llvm/llvm-project/actions/runs/32848117186 |
|
/cherry-pick 8710728 |
|
/pull-request #218678 |
…08001)" (llvm#218638) This reverts commit 1529d35. There are two issues: - The change appear fairly disruptive so close to release (see comments on llvm#208001) - there are false positives (see llvm#218429)
This is firing on some of our _used_ templates in eval.cpp in clang-tidy 24 It was coming to `-Wall` for clang as well (llvm/llvm-project#202945) but was reverted due to issues like false positives (llvm/llvm-project#218638). Some fixes were applied to try enable in `-Wall` in clang 23 (llvm/llvm-project#222336) but it still remains disabled by default for clang.
This reverts commit 1529d35.
There are two issues:
-Wunused-templatefalse positive from requires clause #218429)