google / emboss

Emboss is a tool for generating code that reads and writes binary data structures.
Apache License 2.0
71 stars 21 forks source link

Split out enum trait generation #134

Closed EricRahm closed 5 months ago

EricRahm commented 5 months ago

This change makes the generation of EnumTraits configurable. With this change we can see reductions in code size by over 1MB. Example file size changes:

File src (KB) .h (KB) before .h (KB) after
hci_events.emb 76 5356 3884
hci_commands.emb 108 5612 4268
hci_vendor.emb 32 1748 1304
hci_common.emb 32 644 368
hci_data.emb 4 152 104
l2cap_frames.emb 4 48 40
hci_h4.emb 4 8 4

This is also helpful for embedded users who couldn't use emboss due to dependencies on string libraries and functions like sscanf.

This change is split out into a series of patches to make it easier to review:

This is part of #128

Tests: bazel test //...

EricRahm commented 5 months ago

Note: this builds on top of PR #133, the relevant changes start at the Add forward declarations for text helpers patch. FYI @robrussell