mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-05-01 06:46:41 -04:00
scanner: enforce frozen attribute
Signed-off-by: Isaac Freund <mail@isaacfreund.com>
This commit is contained in:
parent
a58bcd7481
commit
c0a6e73606
1 changed files with 17 additions and 0 deletions
|
|
@ -736,6 +736,7 @@ start_element(void *data, const char *element_name, const char **atts)
|
||||||
const char *allow_null = NULL;
|
const char *allow_null = NULL;
|
||||||
const char *enumeration_name = NULL;
|
const char *enumeration_name = NULL;
|
||||||
const char *bitfield = NULL;
|
const char *bitfield = NULL;
|
||||||
|
const char *frozen = NULL;
|
||||||
int i, version = 0;
|
int i, version = 0;
|
||||||
|
|
||||||
ctx->loc.line_number = XML_GetCurrentLineNumber(ctx->parser);
|
ctx->loc.line_number = XML_GetCurrentLineNumber(ctx->parser);
|
||||||
|
|
@ -765,6 +766,8 @@ start_element(void *data, const char *element_name, const char **atts)
|
||||||
enumeration_name = atts[i + 1];
|
enumeration_name = atts[i + 1];
|
||||||
if (strcmp(atts[i], "bitfield") == 0)
|
if (strcmp(atts[i], "bitfield") == 0)
|
||||||
bitfield = atts[i + 1];
|
bitfield = atts[i + 1];
|
||||||
|
if (strcmp(atts[i], "frozen") == 0)
|
||||||
|
frozen = atts[i + 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->character_data_length = 0;
|
ctx->character_data_length = 0;
|
||||||
|
|
@ -784,6 +787,20 @@ start_element(void *data, const char *element_name, const char **atts)
|
||||||
if (version == 0)
|
if (version == 0)
|
||||||
fail(&ctx->loc, "no interface version given");
|
fail(&ctx->loc, "no interface version given");
|
||||||
|
|
||||||
|
if (frozen) {
|
||||||
|
if (strcmp(frozen, "true") == 0) {
|
||||||
|
if (version != 1) {
|
||||||
|
fail(&ctx->loc,
|
||||||
|
"frozen interface must have version 1");
|
||||||
|
}
|
||||||
|
} else if (strcmp(frozen, "false") != 0) {
|
||||||
|
fail(&ctx->loc,
|
||||||
|
"invalid value (%s) frozen attribute "
|
||||||
|
"(only true/false are accepted)",
|
||||||
|
frozen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
validate_identifier(&ctx->loc, name, STANDALONE_IDENT);
|
validate_identifier(&ctx->loc, name, STANDALONE_IDENT);
|
||||||
interface = create_interface(ctx->loc, name, version);
|
interface = create_interface(ctx->loc, name, version);
|
||||||
ctx->interface = interface;
|
ctx->interface = interface;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue