mlot / nanopb

Automatically exported from code.google.com/p/nanopb
zlib License
0 stars 0 forks source link

const value for default in extension is not generated correctly #111

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. protoc.exe extbug.proto -o extbug.pb
2. python nanopb_generator.py extbug.pb
3. observe extbug.pb.c

Orphan reference to  "foobar_struct_foobar_default" is generated without the 
actual const. This does not compile obviously.

Nanopb 0.2.6, windows 7, 64-bit

See attachments.

Original issue reported on code.google.com by jarmo.to...@gmail.com on 28 Mar 2014 at 7:03

Attachments:

GoogleCodeExporter commented 9 years ago
Please ignore the "lint-comments" on the generated .c-files, they are my own 
modifications.

Original comment by jarmo.to...@gmail.com on 28 Mar 2014 at 7:05

GoogleCodeExporter commented 9 years ago
Do you think it would be an acceptable fix to just remove the invalid 
reference, instead of actually supporting default values for extensions? That 
would require some additional initialization logic.

Once issue #79 is resolved, one can initialize the extension field easily to 
default value in user code.

Original comment by Petteri.Aimonen on 31 Mar 2014 at 5:39

GoogleCodeExporter commented 9 years ago
I think the removal for invalid reference is valid fix for this at the moment. 
I guess the default-value support is quite a corner case.

Original comment by jarmo.to...@gmail.com on 31 Mar 2014 at 7:26

GoogleCodeExporter commented 9 years ago
This issue was updated by revision 6c90e824c4e8.

Original comment by Petteri.Aimonen on 1 Apr 2014 at 1:48

GoogleCodeExporter commented 9 years ago
Fix released in nanopb-0.2.8

Original comment by Petteri.Aimonen on 7 Apr 2014 at 5:51