Skip to contentSkip to conversation

public: constify xsd_errors[]

PATCH In review Jan Beulich 2 participants 2 messages Jul 4, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 public: constify xsd_errors[]

While in principle this could break existing users, I think such users deserve to be put in trouble. After all the table should have been const from the very beginning.

---
Especially since the table definition lives in a header, the adding of "const" might render redundant the adding of the "unused" attribute. But I'm not sufficiently certain that all supported gcc versions as well as compilers claiming gcc compatibility behave consistently in this regard, so I'm leaving the attribute in place.

xen/include/public/io/xs_wire.h +1 -1
@@ -71,7 +71,7 @@ struct xsd_errors
 #ifdef EINVAL
 #define XSD_ERROR(x) { x, #x }
 /* LINTED: static unused */
-static struct xsd_errors xsd_errors[]
+static const struct xsd_errors xsd_errors[]
 #if defined(__GNUC__)
 __attribute__((unused))
 #endif