llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-infrastructure

Author: Aditya Medhane (flash1729)

<details>
<summary>Changes</summary>

Throwaway enumeration run for #<!-- -->206123. The premerge runtimes ninja 
stops at the first -Werror failure, so remaining -Wunused-template occurrences 
surface one per CI run. This stacks the enable commit with -k 0 on the runtimes 
ninja so a single run reports all of them. Will be closed after harvesting the 
log.

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


6 Files Affected:

- (modified) .ci/monolithic-linux.sh (+3-3) 
- (modified) clang/docs/ReleaseNotes.md (+5) 
- (modified) clang/include/clang/Basic/DiagnosticGroups.td (+1-1) 
- (modified) clang/test/Misc/warning-wall.c (+2) 
- (modified) clang/test/SemaCXX/warn-func-not-needed.cpp (+1-1) 
- (modified) clang/test/SemaCXX/warn-variable-not-needed.cpp (+1-1) 


``````````diff
diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh
index 29b0bdbd0e37b..a4cba987caf59 100755
--- a/.ci/monolithic-linux.sh
+++ b/.ci/monolithic-linux.sh
@@ -84,7 +84,7 @@ fi
 if [[ -n "${runtime_targets}" ]]; then
   start-group "ninja Runtimes"
 
-  ninja -C "${BUILD_DIR}" ${runtime_targets} |& tee ninja_runtimes.log
+  ninja -C "${BUILD_DIR}" -k 0 ${runtime_targets} |& tee ninja_runtimes.log
   cp ${BUILD_DIR}/.ninja_log ninja_runtimes.ninja_log
 fi
 
@@ -100,7 +100,7 @@ if [[ -n "${runtime_targets_needs_reconfig}" ]]; then
 
   start-group "ninja Runtimes C++26"
 
-  ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig} \
+  ninja -C "${BUILD_DIR}" -k 0 ${runtime_targets_needs_reconfig} \
     |& tee ninja_runtimes_needs_reconfig1.log
   cp ${BUILD_DIR}/.ninja_log ninja_runtimes_needs_reconig.ninja_log
 
@@ -113,7 +113,7 @@ if [[ -n "${runtime_targets_needs_reconfig}" ]]; then
 
   start-group "ninja Runtimes Clang Modules"
 
-  ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig} \
+  ninja -C "${BUILD_DIR}" -k 0 ${runtime_targets_needs_reconfig} \
     |& tee ninja_runtimes_needs_reconfig2.log
   cp ${BUILD_DIR}/.ninja_log ninja_runtimes_needs_reconfig2.ninja_log
 fi
diff --git a/clang/docs/ReleaseNotes.md b/clang/docs/ReleaseNotes.md
index b7142ecb072ff..540c11e72fd1c 100644
--- a/clang/docs/ReleaseNotes.md
+++ b/clang/docs/ReleaseNotes.md
@@ -545,6 +545,11 @@ latest release, please see the [Clang Web 
Site](https://clang.llvm.org) or the
   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 73fb97aeeb302..79583534b9bbd 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/include/clang/Basic/DiagnosticGroups.td
@@ -1369,7 +1369,7 @@ def Conversion
 def Unused : DiagGroup<"unused",
                        [UnusedArgument, UnusedFunction, UnusedLabel,
                         // UnusedParameter, (matches GCC's behavior)
-                        // UnusedTemplate, (clean-up libc++ before enabling)
+                        UnusedTemplate,
                         // 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 6d6c4e562400f..ade9cbaace77e 100644
--- a/clang/test/Misc/warning-wall.c
+++ b/clang/test/Misc/warning-wall.c
@@ -73,6 +73,8 @@ 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 cb3cae4cd6c76..74438543c43b7 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() {}
+template <typename T> static void f() {} // expected-warning {{unused function 
template}}
 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 272c8998d15c0..d234e9140e3fd 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;
+  template <typename T> int abc_template = 0; // expected-warning {{unused 
variable template}}
   template <> int abc_template<int> = 0; // expected-warning {{variable 
'abc_template<int>' is not needed and will not be emitted}}
   }                                      // namespace
   template <typename T>

``````````

</details>


https://github.com/llvm/llvm-project/pull/207490
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to