mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-03-23 05:35:51 -04:00
Merge branch 'work/validate-bitfield' into 'main'
scanner: warn on value 0 in bitfields See merge request wayland/wayland!484
This commit is contained in:
commit
5ccb6c7d77
3 changed files with 15 additions and 2 deletions
|
|
@ -25,6 +25,7 @@
|
||||||
<!ATTLIST entry summary CDATA #IMPLIED>
|
<!ATTLIST entry summary CDATA #IMPLIED>
|
||||||
<!ATTLIST entry since CDATA #IMPLIED>
|
<!ATTLIST entry since CDATA #IMPLIED>
|
||||||
<!ATTLIST entry deprecated-since CDATA #IMPLIED>
|
<!ATTLIST entry deprecated-since CDATA #IMPLIED>
|
||||||
|
<!ATTLIST entry valid-zero CDATA #IMPLIED>
|
||||||
<!ELEMENT arg (description?)>
|
<!ELEMENT arg (description?)>
|
||||||
<!ATTLIST arg name CDATA #REQUIRED>
|
<!ATTLIST arg name CDATA #REQUIRED>
|
||||||
<!ATTLIST arg type CDATA #REQUIRED>
|
<!ATTLIST arg type CDATA #REQUIRED>
|
||||||
|
|
|
||||||
|
|
@ -1117,7 +1117,7 @@
|
||||||
or drags initiated with other buttons than BTN_LEFT to specific
|
or drags initiated with other buttons than BTN_LEFT to specific
|
||||||
actions (e.g. "ask").
|
actions (e.g. "ask").
|
||||||
</description>
|
</description>
|
||||||
<entry name="none" value="0" summary="no action"/>
|
<entry name="none" value="0" summary="no action" valid-zero="true"/>
|
||||||
<entry name="copy" value="1" summary="copy action"/>
|
<entry name="copy" value="1" summary="copy action"/>
|
||||||
<entry name="move" value="2" summary="move action"/>
|
<entry name="move" value="2" summary="move action"/>
|
||||||
<entry name="ask" value="4" summary="ask action"/>
|
<entry name="ask" value="4" summary="ask action"/>
|
||||||
|
|
@ -1205,7 +1205,7 @@
|
||||||
use this information to adapt its behavior, e.g. choose
|
use this information to adapt its behavior, e.g. choose
|
||||||
an appropriate cursor image.
|
an appropriate cursor image.
|
||||||
</description>
|
</description>
|
||||||
<entry name="none" value="0" summary="no edge"/>
|
<entry name="none" value="0" summary="no edge" valid-zero="true"/>
|
||||||
<entry name="top" value="1" summary="top edge"/>
|
<entry name="top" value="1" summary="top edge"/>
|
||||||
<entry name="bottom" value="2" summary="bottom edge"/>
|
<entry name="bottom" value="2" summary="bottom edge"/>
|
||||||
<entry name="left" value="4" summary="left edge"/>
|
<entry name="left" value="4" summary="left edge"/>
|
||||||
|
|
|
||||||
|
|
@ -738,6 +738,7 @@ start_element(void *data, const char *element_name, const char **atts)
|
||||||
const char *bitfield = NULL;
|
const char *bitfield = NULL;
|
||||||
const char *frozen = NULL;
|
const char *frozen = NULL;
|
||||||
int i, version = 0;
|
int i, version = 0;
|
||||||
|
bool valid_zero = false;
|
||||||
|
|
||||||
ctx->loc.line_number = XML_GetCurrentLineNumber(ctx->parser);
|
ctx->loc.line_number = XML_GetCurrentLineNumber(ctx->parser);
|
||||||
for (i = 0; atts[i]; i += 2) {
|
for (i = 0; atts[i]; i += 2) {
|
||||||
|
|
@ -762,6 +763,14 @@ start_element(void *data, const char *element_name, const char **atts)
|
||||||
deprecated_since = atts[i + 1];
|
deprecated_since = atts[i + 1];
|
||||||
if (strcmp(atts[i], "allow-null") == 0)
|
if (strcmp(atts[i], "allow-null") == 0)
|
||||||
allow_null = atts[i + 1];
|
allow_null = atts[i + 1];
|
||||||
|
if (strcmp(atts[i], "valid-zero") == 0) {
|
||||||
|
if (strcmp(atts[i + 1], "true") == 0)
|
||||||
|
valid_zero = true;
|
||||||
|
else
|
||||||
|
fail(&ctx->loc,
|
||||||
|
"Invalid value for valid-zero: %s",
|
||||||
|
atts[i + 1]);
|
||||||
|
}
|
||||||
if (strcmp(atts[i], "enum") == 0)
|
if (strcmp(atts[i], "enum") == 0)
|
||||||
enumeration_name = atts[i + 1];
|
enumeration_name = atts[i + 1];
|
||||||
if (strcmp(atts[i], "bitfield") == 0)
|
if (strcmp(atts[i], "bitfield") == 0)
|
||||||
|
|
@ -931,6 +940,9 @@ start_element(void *data, const char *element_name, const char **atts)
|
||||||
version, entry->since);
|
version, entry->since);
|
||||||
entry->deprecated_since = version;
|
entry->deprecated_since = version;
|
||||||
|
|
||||||
|
if (ctx->enumeration->bitfield && !valid_zero && strcmp(entry->value, "0") == 0)
|
||||||
|
warn(&ctx->loc, "value 0 used in a bitfield entry");
|
||||||
|
|
||||||
if (summary)
|
if (summary)
|
||||||
entry->summary = xstrdup(summary);
|
entry->summary = xstrdup(summary);
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue