-
Notifications
You must be signed in to change notification settings - Fork 46
Cast Fw types in C++ codegen #737
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
bocchino
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR looks good and correct, but I thought we were moving towards having a single ID type for all these IDs. If we add all these casts, won't we just need to delete them later? Does anything go wrong now if we omit these casts?
Do these warnings occur when, for example, the channel ID type is smaller than the base ID type? If so, maybe the answer is to unify the types. |
|
I will double check the case of having the type smaller than the base ID type and get back to you! |
|
I ran without these changes and tried the case where FwChanIdType is smaller (U16) than the FwIdType (U32) and received the implicit conversion warnings. Currently in fprime, all of the id types are aliases of the FwIdType, maybe that is sufficient? However, if a user configures any of those id types to something different they will hit the warning. |
|
@LeStarch do you think there is a use case for configuring an ID type (like FwEventIdType or FwChanIdType for instance) to something smaller than the base ID type (ie: FwIdType)? Maybe casting the IDs is not a good idea since it would in a way "suppress" the implicit conversion warnings and wouldn't alert users that their IDs are smaller than the base ID? |
|
@jwest115 when would a channel ID or command ID ever not be of exactly base ID type? It seems odd that we'd ever allow users to configure something different, because that could silently break the system. I can see users wanting to have a smaller ID to save downlink, but I feel the appropriate action would be to shrink the base ID field across the board. Am I missing something here? |
|
@LeStarch in this PR we introduced a new alias type |
|
@jwest115 that is what I was concluding too. I think it would be dangerous to have ID types that are functionally not capable of storing a complete ID. @bocchino, @timcanham thoughts? |
|
Closing since we decided to not add casts at this time. |
Related to nasa/fprime#3714, in C++ codegen, cast opcodes, event IDs, channel IDs, etc. to their respective types (ie: FwOpcodeType, FwEventIdType, FwChanIdType, etc.). This helps avoid implicit type conversion warnings that occur when building.
Partially addresses nasa/fprime#3529 (fprime updates are included in nasa/fprime#3714).