Skip to content
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

Fix Pipe ID printf to be strict type-safe compatible #85

Closed
jphickey opened this issue Feb 26, 2021 · 0 comments · Fixed by #86
Closed

Fix Pipe ID printf to be strict type-safe compatible #85

jphickey opened this issue Feb 26, 2021 · 0 comments · Fixed by #86
Assignees

Comments

@jphickey
Copy link
Contributor

Is your feature request related to a problem? Please describe.
The CFE_SB_PipeId_t type is not a simple/plain integer if strict types are enabled. This trips up a printf statement in TO_LAB here where it tries to print the TO_LAB_Global.Tlm_pipe value:

/home/joe/code/cfecfs/github/apps/to_lab/fsw/src/to_lab_app.c:507:77: error: format ‘%d’ expects argument of type ‘int’, but argument 6 has type ‘CFE_SB_PipeId_t’ [-Werror=format=]
  507 |                           "L%d TO Can't Unsubscribe to Stream 0x%x on pipe %d, status %i", __LINE__,
      |                                                                            ~^
      |                                                                             |
      |                                                                             int
  508 |                           (unsigned int)CFE_SB_MsgIdToValue(pCmd->Stream), TO_LAB_Global.Tlm_pipe, (int)status);
      |                                                                            ~~~~~~~~~~~~~~~~~~~~~~
      |                                                                                         |
      |                                                                                         CFE_SB_PipeId_t

Describe the solution you'd like
Use the CFE_RESOURCEID_TO_ULONG() macro to get the simple value, and use %lu conversion specifier in printf.

Requester Info
Joseph Hickey, Vantage Systems, Inc.

jphickey added a commit to jphickey/to_lab that referenced this issue Feb 26, 2021
Using the macro makes it work whether strict or simple types are used.
@jphickey jphickey self-assigned this Feb 26, 2021
@skliper skliper closed this as completed in f0164b4 Mar 5, 2021
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 a pull request may close this issue.

1 participant