From 95f144dfb77cdcdead833c522d4f6fab2deac7cb Mon Sep 17 00:00:00 2001 From: TSC21 Date: Tue, 21 May 2019 12:12:21 +0100 Subject: [PATCH] msg.idl.template: do not generate typdefs for builtin types (not required) --- msg/templates/urtps/msg.idl.template | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/msg/templates/urtps/msg.idl.template b/msg/templates/urtps/msg.idl.template index df3833c336..8a43d3785a 100644 --- a/msg/templates/urtps/msg.idl.template +++ b/msg/templates/urtps/msg.idl.template @@ -73,7 +73,8 @@ def add_msg_field(field): if field.is_array: print(' {0}__{1}_array_{2} {3}_;'.format(spec.short_name, str(get_idl_type_name(field.base_type)).replace(" ", "_"), str(field.array_len), field.name)) else: - print(' {0} {1}_;'.format(str(get_idl_type_name(field.type)), field.name)) + base_type = get_idl_type_name(field.base_type) + "_" if get_idl_type_name(field.base_type) in builtin_types else get_idl_type_name(field.base_type) + print(' {0} {1}_;'.format(base_type, field.name)) def add_msg_fields(): @@ -86,7 +87,7 @@ def add_array_typedefs(): if not field.is_header and field.is_array: base_type = get_idl_type_name(field.base_type) + "_" if get_idl_type_name(field.base_type) in builtin_types else get_idl_type_name(field.base_type) array_type = 'typedef {0} {1}__{2}_array_{3}[{4}];'.format(base_type, spec.short_name, get_idl_type_name(field.base_type).replace(" ", "_"), field.array_len, field.array_len) - if type not in array_types: + if array_type not in array_types: array_types.add(array_type) for atype in array_types: print(atype) @@ -110,10 +111,6 @@ def add_msg_constants(): @[end for] @# Constants @add_msg_constants() -@# Built-in types -@[for type in builtin_types] -typedef @(type + '_') @(type); -@[end for] @# Array types @add_array_typedefs() struct @(spec.short_name)_