Skip to contentSkip to conversation

tcg/perf: Placate clang-21's -Wdefault-const-init-field-unsafe

PATCH New Ilya Leoshkevich 1 participant 1 message May 20, 2025

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tcg/perf: Placate clang-21's -Wdefault-const-init-field-unsafe

The not-yet-released clang-21 complains about the const "name" field in struct debug_entry. While this warning may be too aggressive, there is not too much value in having const there, so just drop it.

Note: in addition to this fix, I had to turn off the following clang-21 warnings to make the build work:

* -Wno-parentheses-equality
* -Wno-unused-value
* -Wno-tautological-unsigned-enum-zero-compare
* -Wno-tautological-compare

---

v1: https://lore.kernel.org/qemu-devel/[email protected]/
v1 -> v2: Mention in the commit message that clang-21 is not released
yet. Add Peter's R-b.

 tcg/perf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tcg/perf.c +1 -1
index 4e8d2c1bee7..f30c5b489d1 100644
@@ -154,7 +154,7 @@ struct debug_entry {
     uint64_t addr;
     int lineno;
     int discrim;
-    const char name[];
+    char name[];
 };
 
 struct jr_code_debug_info {
Signature · 1 line
2.49.0