Is there a way to disable a specific compiler warning within the C code?
For example, is there a way to disable the "No break at the end of case" warning on a case by case basis (pun intended).
In Lint, I would add "//lint -fallthrough" before the next case statement.
Moving to CrossCore Embedded Studio and Add-ins
Hi,You can suppress the warning using the "-Wsuppress number[,number]" switch to the compiler. This can be added via Properties > C/C++ Build > Settings > Tool Settings > CrossCore SHARC C\C++ Compiler > Additional Options: -Wsuppress number.For example, if you want to suppress waning cc1080, then you need to add "-Wsuppress 1080" in Additional OptionsRegards,Santha kumari.K
Thank you for your response.
I don't want to universally disable the warning. I would like to be able to ignore specific instances of the warning.
Most compilers feature pragmas that serve this function. For reference, here is a VisualStudio example: stackoverflow.com/.../disable-single-warning-error
Hello,You can use the following syntax to disable the warning for particular function#pragma diag(push)#pragma diag(suppress:1080)// Your function#pragma diag(pop)#pragma diag takes two arguments and an optional third argument. Each argument is separated by a ":". The first argument must be the identifier suppress, warn, or remark. When MISRA is not enabled, the second argument is the error number in the format of number without any preceding "cc" or zeros. The error must be a discretionary error. When MISRA is enabled, the second argument is of the format misra_rule_9_6, where the "9_6" refers to rule 9.6 of the MISRA-C:2004 Guidelines.Regards,Santha kumari.K
Thank you for your reply.
"No Break at end of case" doesn't appear to have an error number.