In v5.0.0-rc1~94 we switched from one huge switch() to an array
for translating error numbers into error messages. However, the
array is declared to have VIR_ERR_NUMBER_LAST items which makes
it impossible to spot this place by compile checking when adding
new error number.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
token = ("name", "virloginit")
return token
+ elif token[0] == "name" and token[1] == "G_STATIC_ASSERT":
+ # skip whole line
+ while token is not None and not (token[0] == "sep" and
+ token[1] == ";"):
+ token = self.token()
+ return self.token()
+
elif token[0] == "name":
if self.type == "":
self.type = token[1]
} virErrorMsgTuple;
-const virErrorMsgTuple virErrorMsgStrings[VIR_ERR_NUMBER_LAST] = {
+static const virErrorMsgTuple virErrorMsgStrings[] = {
[VIR_ERR_OK] = { NULL, NULL },
[VIR_ERR_INTERNAL_ERROR] = {
N_("internal error"),
N_("network port not found: %s") },
};
+G_STATIC_ASSERT(G_N_ELEMENTS(virErrorMsgStrings) == VIR_ERR_NUMBER_LAST);
+
/**
* virErrorMsg: