Update changelog
[apps/agl-service-can-low-level.git] / generator / nanopb_generator.py
index 5010814..5d2a360 100755 (executable)
@@ -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)