Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 95f144d

Browse files
TSC21LorenzMeier
authored andcommitted
msg.idl.template: do not generate typdefs for builtin types (not required)
1 parent 110a793 commit 95f144d

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

msg/templates/urtps/msg.idl.template

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ def add_msg_field(field):
7373
if field.is_array:
7474
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))
7575
else:
76-
print(' {0} {1}_;'.format(str(get_idl_type_name(field.type)), field.name))
76+
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)
77+
print(' {0} {1}_;'.format(base_type, field.name))
7778

7879

7980
def add_msg_fields():
@@ -86,7 +87,7 @@ def add_array_typedefs():
8687
if not field.is_header and field.is_array:
8788
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)
8889
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)
89-
if type not in array_types:
90+
if array_type not in array_types:
9091
array_types.add(array_type)
9192
for atype in array_types:
9293
print(atype)
@@ -110,10 +111,6 @@ def add_msg_constants():
110111
@[end for]
111112
@# Constants
112113
@add_msg_constants()
113-
@# Built-in types
114-
@[for type in builtin_types]
115-
typedef @(type + '_') @(type);
116-
@[end for]
117114
@# Array types
118115
@add_array_typedefs()
119116
struct @(spec.short_name)_

0 commit comments

Comments
 (0)