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

Designated initializer in osapi-clock.h header breaks C++ compilation unit. #1365

Closed
jhnphm opened this issue Feb 9, 2023 · 1 comment · Fixed by #1371
Closed

Designated initializer in osapi-clock.h header breaks C++ compilation unit. #1365

jhnphm opened this issue Feb 9, 2023 · 1 comment · Fixed by #1371

Comments

@jhnphm
Copy link

jhnphm commented Feb 9, 2023

Describe the bug
Designated initializer in osapi-clock.h header breaks C++ compilation unit. C++ does not support this until C++20

To Reproduce
#include "cfe.h" in a C++ compilation unit
Build file, observe error.

Expected behavior
Successful compilation

Code snips
Instance of designated initializer used here:

return (OS_time_t) {.ticks = (tm / OS_TIME_TICK_RESOLUTION_NS)};

Other instances in OS_TimeFromTotalSeconds, OS_TimeFromTotalMilliseconds, OS_TimeFromTotalMicroseconds, OS_TimeFromTotalNanoseconds. Issue seems to have been introduced in #1310 .

System observed on:

  • SP-0s
  • OS: VxWorks 6.9
  • Versions: cFE v7.0.0-rc4+dev242, OSAL v6.0.0-rc4+dev179, PSP v1.6.0-rc4+dev67

Additional context
Inline header functions should use C++03 (latest standard supported by VxWorks 6.9) compatible constructs.

Reporter Info
John N Pham, Northrop Grumman

@jphickey jphickey self-assigned this Feb 24, 2023
@jphickey
Copy link
Contributor

I will look at this. For now, if you wanted to patch your code, just remove the .ticks = designation part, it should work fine (there is just one member in this wrapper object).

We don't currently validate the OSAL headers for use in C++ at all, we should re-evaluate if this is something we should consider adding to our workflows. I know there are a handful of C++ users out there.

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

Successfully merging a pull request may close this issue.

4 participants