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

OS_ObjectIdFromInteger argument narrowing error #1385

Open
superolmo opened this issue May 1, 2023 · 0 comments
Open

OS_ObjectIdFromInteger argument narrowing error #1385

superolmo opened this issue May 1, 2023 · 0 comments
Labels

Comments

@superolmo
Copy link

superolmo commented May 1, 2023

Describe the bug
When building for VxWorks 7 a C++ app, I get the error:
error: narrowing conversion of 'value' from 'long unsigned int' to 'uint32_t' {aka 'unsigned int'} inside { } [-Werror=narrowing]

I fixed it by changing code to:
#ifdef OSAL_OMIT_DEPRECATED
osal_id_t idv = {(uint32)value};
#else
osal_id_t idv = (osal_id_t)value;
#endif
return idv;

The code above still narrow down value from long unsigned to int unsigned.
I understand that both VxWorks 7 and C++ are not supported, so really the question is:

  • Shouldn't OS_ObjectIdFromInteger be taking an integer in spite of a long since the returned values is always an int?

To Reproduce

Expected behavior
Build without errors

Code snips
osapi-idmap.h L105

System observed on:

  • OS: Oracle Linux 8.7
  • v6.0.0-rc4+dev184

Additional context

Reporter Info
Claudio Olmi
NASA JSC

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

No branches or pull requests

2 participants