From 79623033c1b938ec21e405130ee66832ef6a9657 Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Thu, 12 Mar 2015 00:36:25 +0300 Subject: [PATCH] Abandoning pragma once --- libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py | 1 + .../libuavcan_dsdl_compiler/data_type_template.tmpl | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py b/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py index 88b4def241..0de8fea8a9 100644 --- a/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py +++ b/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py @@ -165,6 +165,7 @@ def generate_one_type(template_expander, t): t.short_name = t.full_name.split('.')[-1] t.cpp_type_name = t.short_name + '_' t.cpp_full_type_name = '::' + t.full_name.replace('.', '::') + t.include_guard = t.full_name.replace('.', '_').upper() + '_HPP_INCLUDED' # Dependencies (no duplicates) def fields_includes(fields): diff --git a/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/data_type_template.tmpl b/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/data_type_template.tmpl index 144bd58850..8b3ba7855e 100644 --- a/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/data_type_template.tmpl +++ b/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/data_type_template.tmpl @@ -6,7 +6,8 @@ * Source file: ${t.source_file} */ -#pragma once +#ifndef ${t.include_guard} +#define ${t.include_guard} #include #include @@ -385,3 +386,5 @@ ${define_streaming_operator(type_name=t.cpp_full_type_name)} % for nsc in t.cpp_namespace_components: } % endfor + +#endif // ${t.include_guard}