Code Review
/
apps
/
low-level-can-service.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
review
|
tree
raw
|
patch
| inline |
side by side
(parent:
64bf72d
)
Add a dummy field if struct would otherwise be empty.
author
Petteri Aimonen
<jpa@git.mail.kapsi.fi>
Wed, 6 Mar 2013 16:02:57 +0000
(18:02 +0200)
committer
Petteri Aimonen
<jpa@git.mail.kapsi.fi>
Wed, 6 Mar 2013 16:02:57 +0000
(18:02 +0200)
Update issue 64
Status: FixedInGit
generator/nanopb_generator.py
patch
|
blob
|
history
diff --git
a/generator/nanopb_generator.py
b/generator/nanopb_generator.py
index
c3b5fbe
..
663745a
100644
(file)
--- a/
generator/nanopb_generator.py
+++ b/
generator/nanopb_generator.py
@@
-300,6
+300,12
@@
class Message:
def __str__(self):
result = 'typedef struct _%s {\n' % self.name
+
+ if not self.ordered_fields:
+ # Empty structs are not allowed in C standard.
+ # Therefore add a dummy field if an empty message occurs.
+ result += ' uint8_t dummy_field;'
+
result += '\n'.join([str(f) for f in self.ordered_fields])
result += '\n}'