From 24c28d6aafab25881a47c48eb987127ae6330748 Mon Sep 17 00:00:00 2001 From: "steve.mcnamara" Date: Fri, 7 Jun 2024 09:37:31 +0100 Subject: [PATCH] Fix code generation for unions inside topics by simplifying it. Code does not correctly handle complex unions that have hold values that resolve to different sizes. This can lead to failures to publish data if the first time the topic publishes it uses a value in the union is smaller than others. --- src/idlcxx/src/generator.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/idlcxx/src/generator.c b/src/idlcxx/src/generator.c index 1a7692b8..f8b34d14 100644 --- a/src/idlcxx/src/generator.c +++ b/src/idlcxx/src/generator.c @@ -533,7 +533,9 @@ bool is_nested(const void *node) static bool sc_union(const idl_union_t *_union) { - if (!is_selfcontained(_union->switch_type_spec->type_spec)) + return false; + +/* if (!is_selfcontained(_union->switch_type_spec->type_spec)) return false; const idl_case_t *_case = NULL; @@ -542,7 +544,7 @@ static bool sc_union(const idl_union_t *_union) return false; } - return true; + return true;*/ } static bool sc_struct(const idl_struct_t *str)