mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-08 13:29:47 -05: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
|
|
@ -107,6 +107,10 @@ enum intf_A_foo {
|
|||
* @ingroup iface_intf_A
|
||||
*/
|
||||
#define INTF_A_FOO_DEPRECATED_SINCE_VERSION 2
|
||||
#endif /* INTF_A_FOO_ENUM */
|
||||
|
||||
#ifndef INTF_A_FOO_ENUM_IS_VALID
|
||||
#define INTF_A_FOO_ENUM_IS_VALID
|
||||
/**
|
||||
* @ingroup iface_intf_A
|
||||
* Validate a intf_A foo value.
|
||||
|
|
@ -131,7 +135,7 @@ intf_A_foo_is_valid(uint32_t value, uint32_t version) {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
#endif /* INTF_A_FOO_ENUM */
|
||||
#endif /* INTF_A_FOO_ENUM_IS_VALID */
|
||||
|
||||
#ifndef INTF_A_BAR_ENUM
|
||||
#define INTF_A_BAR_ENUM
|
||||
|
|
@ -154,6 +158,10 @@ enum intf_A_bar {
|
|||
* @ingroup iface_intf_A
|
||||
*/
|
||||
#define INTF_A_BAR_THIRD_SINCE_VERSION 2
|
||||
#endif /* INTF_A_BAR_ENUM */
|
||||
|
||||
#ifndef INTF_A_BAR_ENUM_IS_VALID
|
||||
#define INTF_A_BAR_ENUM_IS_VALID
|
||||
/**
|
||||
* @ingroup iface_intf_A
|
||||
* Validate a intf_A bar value.
|
||||
|
|
@ -172,7 +180,7 @@ intf_A_bar_is_valid(uint32_t value, uint32_t version) {
|
|||
valid |= INTF_A_BAR_THIRD;
|
||||
return (value & ~valid) == 0;
|
||||
}
|
||||
#endif /* INTF_A_BAR_ENUM */
|
||||
#endif /* INTF_A_BAR_ENUM_IS_VALID */
|
||||
|
||||
/**
|
||||
* @ingroup iface_intf_A
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue