From: Petteri Aimonen Date: Thu, 26 Feb 2015 15:33:36 +0000 (+0200) Subject: Fix generator error when long_names:false is combined with Oneofs. X-Git-Tag: 5.0.2~186^2~149 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=4a6580726ec2a0b71d8f01133d5c38a469eac497;p=apps%2Fagl-service-can-low-level.git Fix generator error when long_names:false is combined with Oneofs. Update issue 147 Status: FixedInGit --- diff --git a/generator/nanopb_generator.py b/generator/nanopb_generator.py index 4c01502c..7ee06523 100755 --- a/generator/nanopb_generator.py +++ b/generator/nanopb_generator.py @@ -587,6 +587,9 @@ class OneOf(Field): self.name = oneof_desc.name self.ctype = 'union' self.fields = [] + self.allocation = 'ONEOF' + self.default = None + self.rules = 'ONEOF' def add_field(self, field): if field.allocation == 'CALLBACK': diff --git a/tests/options/options.proto b/tests/options/options.proto index a8e557be..cdcffeb7 100644 --- a/tests/options/options.proto +++ b/tests/options/options.proto @@ -75,3 +75,12 @@ message SkippedMessage option (nanopb_msgopt).skip_message = true; required int32 foo = 1; } + +// Message with oneof field +message OneofMessage +{ + oneof foo { + int32 bar = 1; + } +} +