mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-31 22:25:25 -04:00
scanner: use separate guards for validator functions
Generated XXX_is_valid() functions for enums are guarded behind the
same #define as the enum itself. This worked fine until recently,
but since fbd7460737 ("scanner: add new enum-header mode") we're
also generating enum-only headers.
When including the enum-only header first, and then the server
header, the validator functions are missing.
Define a separate guard to fix this.
Signed-off-by: Simon Ser <contact@emersion.fr>
This commit is contained in:
parent
1ab6b693b1
commit
dbfa8d784e
4 changed files with 151 additions and 31 deletions
|
|
@ -1383,6 +1383,11 @@ emit_validator(struct interface *interface, struct enumeration *e)
|
|||
{
|
||||
struct entry *entry;
|
||||
|
||||
printf("#ifndef %s_%s_ENUM_IS_VALID\n",
|
||||
interface->uppercase_name, e->uppercase_name);
|
||||
printf("#define %s_%s_ENUM_IS_VALID\n",
|
||||
interface->uppercase_name, e->uppercase_name);
|
||||
|
||||
printf("/**\n"
|
||||
" * @ingroup iface_%s\n"
|
||||
" * Validate a %s %s value.\n"
|
||||
|
|
@ -1420,6 +1425,9 @@ emit_validator(struct interface *interface, struct enumeration *e)
|
|||
" }\n");
|
||||
}
|
||||
printf("}\n");
|
||||
|
||||
printf("#endif /* %s_%s_ENUM_IS_VALID */\n\n",
|
||||
interface->uppercase_name, e->uppercase_name);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1483,11 +1491,11 @@ emit_enumerations(struct interface *interface, bool with_validators)
|
|||
|
||||
}
|
||||
|
||||
if (with_validators)
|
||||
emit_validator(interface, e);
|
||||
|
||||
printf("#endif /* %s_%s_ENUM */\n\n",
|
||||
interface->uppercase_name, e->uppercase_name);
|
||||
|
||||
if (with_validators)
|
||||
emit_validator(interface, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue