summaryrefslogtreecommitdiffstats
path: root/generator/nanopb_generator.py
diff options
context:
space:
mode:
Diffstat (limited to 'generator/nanopb_generator.py')
-rwxr-xr-xgenerator/nanopb_generator.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/generator/nanopb_generator.py b/generator/nanopb_generator.py
index 50108148..5d2a360d 100755
--- a/generator/nanopb_generator.py
+++ b/generator/nanopb_generator.py
@@ -361,7 +361,7 @@ class Field:
'''Return the pb_field_t initializer to use in the constant array.
prev_field_name is the name of the previous field or None.
'''
- result = ' PB_FIELD2(%3d, ' % self.tag
+ result = ' PB_FIELD(%3d, ' % self.tag
result += '%-8s, ' % self.pbtype
result += '%s, ' % self.rules
result += '%-8s, ' % self.allocation
@@ -782,6 +782,11 @@ def generate_header(dependencies, headername, enums, messages, extensions, optio
yield options.genformat % (noext + options.extension + '.h')
yield '\n'
+ yield '#if PB_PROTO_HEADER_VERSION != 30\n'
+ yield '#error Regenerate this file with the current version of nanopb generator.\n'
+ yield '#endif\n'
+ yield '\n'
+
yield '#ifdef __cplusplus\n'
yield 'extern "C" {\n'
yield '#endif\n\n'
@@ -854,6 +859,11 @@ def generate_source(headername, enums, messages, extensions, options):
yield options.genformat % (headername)
yield '\n'
+ yield '#if PB_PROTO_HEADER_VERSION != 30\n'
+ yield '#error Regenerate this file with the current version of nanopb generator.\n'
+ yield '#endif\n'
+ yield '\n'
+
for msg in messages:
yield msg.default_decl(False)