Commit 99a72777 authored by Jonas Ådahl's avatar Jonas Ådahl Committed by Kristian Høgsberg
Browse files

scanner: Also fail when an implicitly versioned message is out of order



Fail if a message with version implicitly set to 1 (i.e. not specified)
comes after a message with since-version > 1.
Signed-off-by: Jonas Ådahl's avatarJonas Ådahl <jadahl@gmail.com>
parent 3ed76204
......@@ -404,12 +404,14 @@ start_element(void *data, const char *element_name, const char **atts)
if (errno == EINVAL || end == since || *end != '\0')
fail(&ctx->loc,
"invalid integer (%s)\n", since);
if (version < ctx->interface->since)
fail(&ctx->loc, "since version not increasing\n");
ctx->interface->since = version;
} else {
version = 1;
}
message->since = ctx->interface->since;
if (version < ctx->interface->since)
fail(&ctx->loc, "since version not increasing\n");
ctx->interface->since = version;
message->since = version;
if (strcmp(name, "destroy") == 0 && !message->destructor)
fail(&ctx->loc, "destroy request should be destructor type");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment