Revert setting the default width of a serialized enumeration #37
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of change
Setting the enum
width
as this code did narrows the enumeration value when it has a non-default width and a deployable object is unused.e.g. That
static_cast
narrows the value of the enumeration regardless what its actual literal type is. This causes serialization to fail.I first reported this in #36
Background
In #36 I show the fidl/fdepl used to define an enum with a non-default type, and show that the generated code (by generating with core, someip, then core again, as recommended in COVESA/capicxx-core-tools#32, versions 3.2.14) has the proper enum literal type. However that line causes the deserialization to fail.
This is due to this change in
OutputStream.hpp
and was committed with the comment:
Impact
With this change, my deployment type is still a
uint8_t
, e.g. (from #36)And the
Deployable
is still set tonullptr
on creation, which is expected behaviour according to COVESA/capicxx-someip-tools#37, though it means we skip the entire code path that deals with a deployable.But OutputStream::writeValue(const Enumeration<Base_> &_value) is able to pass the proper value (as type information is retained) to
writeValue
, which fixes serialization.