Skip to content

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

jwest115
Copy link
Collaborator

@jwest115 jwest115 commented Jun 10, 2025

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).

@jwest115 jwest115 requested a review from bocchino June 10, 2025 21:26
@jwest115 jwest115 marked this pull request as ready for review June 11, 2025 16:56
Copy link
Collaborator

@bocchino bocchino left a 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?

@bocchino
Copy link
Collaborator

This helps avoid implicit type conversion warnings that occur when building.

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.

@jwest115
Copy link
Collaborator Author

I will double check the case of having the type smaller than the base ID type and get back to you!

@jwest115
Copy link
Collaborator Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants