From dbfa8d784eed0949f3dd50c19a58873b5deb32c6 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sun, 23 Feb 2025 23:38:15 +0100 Subject: 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 fbd7460737c9 ("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 --- tests/data/small-server.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'tests/data/small-server.h') diff --git a/tests/data/small-server.h b/tests/data/small-server.h index 9cafcd9..743fc8d 100644 --- a/tests/data/small-server.h +++ b/tests/data/small-server.h @@ -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 -- cgit v1.2.3-70-g09d2