-
Notifications
You must be signed in to change notification settings - Fork 213
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
Remove warnings #561
Remove warnings #561
Conversation
Could you provide some more information? What is this |
I like to try to have 0 warnings. I got the following warning: comparison is always true due to limited range of data type [-Wtype-limits] This is generated by the following line:
id is here a uint8_t. This means that any value greater than is equal RTE_TRAP_I_MISALIGNED, because RTE_TRAP_I_MISALIGNED is 0. Actually, you would have to change the code as follows to no longer get the warning:
But I didn't want to make the change to keep the understanding of the code. That's why I turned off the warning for the small part. |
Ah, now I understand. I would actually do change the code base here. Having those pragmas makes the code base harder to understand. Furthermore, these pragmas might not be supported by other compilers like LLVM. So here is my proposal: add a "last" identifier to the trap ID enum: RTE_TRAP_FIRQ_14 = 27, /**< Fast interrupt channel 14 */
RTE_TRAP_FIRQ_15 = 28, /**< Fast interrupt channel 15 */
RTE_TRAP_enum_last = RTE_TRAP_FIRQ_15
}; and then use that for the range check: // id valid?
if (id > RTE_TRAP_enum_last) { Furthermore, I would change the type of the |
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.
sw/lib/source/neorv32_rte.c
Hey @Arun789788
What do you mean with that? |
Thank you very much for fixing! |
Remove some GCC warnings