#undef in generated headers moved into the global scope

This commit is contained in:
Pavel Kirienko 2014-04-18 18:05:24 +04:00
parent d1d42e83a7
commit fe2b49b1ab
2 changed files with 6 additions and 3 deletions

View File

@ -155,11 +155,13 @@ def generate_one_type(t):
if t.kind == t.KIND_MESSAGE:
inject_cpp_types(t.fields)
inject_cpp_types(t.constants)
t.all_attributes = t.fields + t.constants
else:
inject_cpp_types(t.request_fields)
inject_cpp_types(t.request_constants)
inject_cpp_types(t.response_fields)
inject_cpp_types(t.response_constants)
t.all_attributes = t.request_fields + t.request_constants + t.response_fields + t.response_constants
# Constant properties
def inject_constant_info(constants):

View File

@ -32,6 +32,10 @@ ${line}
% endfor
******************************************************************************/
% for a in t.all_attributes:
#undef ${a.name}
% endfor
#ifndef UAVCAN_PACK_STRUCTS
# error UAVCAN_PACK_STRUCTS
#endif
@ -57,9 +61,6 @@ struct UAVCAN_EXPORT ${t.cpp_type_name}
<%def name="expand_attr_types(group_name, attrs)">
struct ${group_name}
{
% for a in attrs:
#undef ${a.name}
% endfor
% for a in attrs:
typedef ${a.cpp_type} ${a.name};
% endfor