nasa / fpp

F Prime Prime: A modeling language for F Prime
https://fprime.jpl.nasa.gov
Apache License 2.0
46 stars 31 forks source link

Increase size of temporary buffer in C++ code gen #383

Closed bocchino closed 7 months ago

bocchino commented 7 months ago

This change fixes a warning that can occur with -Wpedantic enabled. See the comments in #367.

bocchino commented 7 months ago

I chatted with @timcanham about this. He agrees with this solution in the near term. In the longer term, he would like to avoid compiler warnings about truncating object names, even in cases where the names don't fit. He envisions that small systems may want a small object name size, and may want to tolerate the truncation.

We think a good way to implement that behavior is to create an Fw::ObjectName implementation of Fw::StringBase, sized to FW_OBJ_NAME_MAX_SIZE. Then instead of using snprintf into a char array we can use the format method of Fw::StringBase. This is better practice anyway.

This solution requires integrated changes to F Prime and FPP, so I'll open separate issues for these proposed changes.