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
IAR: Suppress C "bypasses initialization" warning #7261
Conversation
By default IAR generates "transfer of control bypasses initialization" warnings for C code - it's a legal construct that frequently occurs when doing Linux-style "goto error". Many occurrences in Nanostack. Suppress the warning for C only, to align with GCC and ARMCC. Have to take care not to put it in the "common" section, as this would suppress it for C++, where it actually is illegal.
Interesting. Good to know that other tools don't normally do this. |
/morph build |
Instead of suppressing warnings for all C files, shouldn;t we suppress them for relevant files only as done for other compilers here
I would suggest change as below:
Also please check if we have warnings for GNU ARM compiler as well? |
Build : SUCCESSBuild number : 2390 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 2027 |
Test : SUCCESSBuild number : 2178 |
@deepikabhavnani - thanks for that - I'd forgotten we did already have a suppression inside Nanostack for ARMCC. GCC does not warn about this, so there's no suppression needed. Had I remembered, I might have added it in there, but I think the Possible warning workarounds are:
Of those, only 3 is actually an improvement to the code, but can make a mess of your source layout, to the extent it's usually not worthwhile, except if it's This does mean we're now inconsistent - the warning will be present outside Nanostack for ARMCC only. We should resolve that either by limiting this suppression to Nanostack, or adding it to ARMCC globally. I vote for the latter. |
I am fine with either of the option, as long as it is consistent across compilers |
Description
By default IAR generates "transfer of control bypasses initialization"
warnings for C code - it's a legal construct that frequently occurs when
doing Linux-style "goto error". Many occurrences in Nanostack.
Suppress the warning for C only, to align with GCC and ARMCC. Have to
take care not to put it in the "common" section, as this would suppress
it for C++, where it actually is illegal.
Resolves #7253 and #7254.
Pull request type