aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2016-10-23 14:43:24 +0300
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2016-10-23 14:43:24 +0300
commitf866af7db7af0c42e5394a714a61513d189f2ba3 (patch)
treeac4d30e3c6a2b85ba2f3d44fc932b43275c99b4b
parent6e22ecdebefa40d87723e46298a2d71329ab75da (diff)
Set the proto3 option by default if file specifies proto3 syntax
-rwxr-xr-xgenerator/nanopb_generator.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/generator/nanopb_generator.py b/generator/nanopb_generator.py
index 5c53a633..3e543942 100755
--- a/generator/nanopb_generator.py
+++ b/generator/nanopb_generator.py
@@ -1356,6 +1356,9 @@ def get_nanopb_suboptions(subdesc, options, name):
Globals.matched_namemasks.add(namemask)
new_options.MergeFrom(options)
+ if hasattr(subdesc, 'syntax') and subdesc.syntax == "proto3":
+ new_options.proto3 = True
+
# Handle options defined in .proto
if isinstance(subdesc.options, descriptor.FieldOptions):
ext_type = nanopb_pb2.nanopb