-
Notifications
You must be signed in to change notification settings - Fork 3k
Suppress shift warning for IAR compiler as well #7264
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@@ -32,6 +32,8 @@ but we check for ( width < 8) before performing shift, so it should not be an is | |||
#elif defined ( __GNUC__ ) | |||
#pragma GCC diagnostic push | |||
#pragma GCC diagnostic ignored "-Wshift-count-negative" | |||
#elif defined (__ICCARM__) | |||
#pragma diag_suppress=Pe062 // Shift count is negative |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for the comment.
/morph build |
@ARMmbed/mbed-os-maintainers So far, this is the second PR withing the last couple of days that I've seen resort to disabling warnings instead of updating code. It's fine, but it feels a bit risky imo. Do we want to start doing something different in regards to these types of PRs, or just continue as is? |
Build : SUCCESSBuild number : 2393 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 2029 |
You've got to look at it case-by-case. This one is absolutely a useful warning, so you definitely wouldn't want to disable it globally, but the particular code technique used here - achieving effective conditional compilation via My general feeling is that if the code gets less elegant or you start being coerced into poorer coding style because of a purely-advisory warning, the warning should go. Whether that's killed locally or globally depends on general utility of the warning versus how common false positives are. Compilers can generate so many possible warnings, but their utility can range from "C required diagnostic, cos this isn't valid C" (so why not an error?) to "I've detected a real logic anomaly" (thanks!) to "this C code wouldn't be valid C++" (so?). |
Test : SUCCESSBuild number : 2180 |
Description
Compiler gives invalid warning for shift operation, more details at https://github.com/ARMmbed/mbed-os/blob/master/drivers/MbedCRC.h#L23
Suppressing the warning for IAR compiler as well.
Pull request type
Issue: #7251