NordicSemiconductor / zcbor

Low footprint C/C++ CBOR library and Python tool providing code generation from CDDL descriptions.
Apache License 2.0
105 stars 34 forks source link

`-s` option can generate invalid code due to reserved names #346

Closed maxd-nordic closed 2 months ago

maxd-nordic commented 11 months ago

With version 0.7.0, and using the -s option, the following was generated:

struct cloudToDevice_message {
    struct cloudToDevice_message_union_ union[10];
    size_t union_count;
};

This does not compile because a field cannot be named "union".

oyvindronningstad commented 11 months ago

Thanks for the report, I will fix this. Can you post the CDDL used to generate it?

maxd-nordic commented 11 months ago

Hi Øyvind! Thanks for looking into this! You can find the CDDL file here: https://github.com/hello-nrfcloud/proto/blob/update-proto/hello/firmware/cloudToDevice.cddl