From: Petteri Aimonen Date: Tue, 2 Apr 2013 17:01:31 +0000 (+0300) Subject: Do not generate has_ fields for callback fields. X-Git-Tag: 3.99.1~14^2~383 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=384e686fe6d7b7088cdbc4b44bc988eba3a21945;p=apps%2Flow-level-can-service.git Do not generate has_ fields for callback fields. The arg field can be used to store the field presence from inside the callback. Furthermore, having the has_ field for encoding callbacks would be more annoying than useful. Update issue 70 Status: FixedInGit --- diff --git a/generator/nanopb_generator.py b/generator/nanopb_generator.py index 5ef4ab7..5366f1b 100644 --- a/generator/nanopb_generator.py +++ b/generator/nanopb_generator.py @@ -186,7 +186,7 @@ class Field: return cmp(self.tag, other.tag) def __str__(self): - if self.rules == 'OPTIONAL': + if self.rules == 'OPTIONAL' and self.allocation == 'STATIC': result = ' bool has_' + self.name + ';\n' elif self.rules == 'REPEATED' and self.allocation == 'STATIC': result = ' size_t ' + self.name + '_count;\n'