mlot / nanopb

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

const for default values should contain "U" for unsigned types #102

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Suppose I have this in my protofile:

"optional uint32 bar = 5 [default=0xffffffff];"

nanopb generates:

"const uint32_t Foo_bar_default = 4294967295;"

which emits the following GCC warning:

"warning: this decimal constant is unsigned only in ISO C90 [enabled by 
default]"

I suggest adding "u" for such cases, so the generated line reads:

"const uint32_t Foo_bar_default = 4294967295u;"

Original issue reported on code.google.com by rusn...@gmail.com on 2 Feb 2014 at 4:56

GoogleCodeExporter commented 9 years ago
Yeah, makes sense.

Original comment by Petteri.Aimonen on 2 Feb 2014 at 5:03

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

Original comment by Petteri.Aimonen on 4 Feb 2014 at 6:35

GoogleCodeExporter commented 9 years ago
Fix released in nanopb-0.2.6

Original comment by Petteri.Aimonen on 15 Feb 2014 at 3:00