RTEMS | Warnings in cpukit dev/can (#5388)
Michal Lenc (@michallenc)
gitlab at rtems.org
Sat Dec 13 15:17:27 UTC 2025
Michal Lenc commented: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5388#note_137313
!873 fixes `-Wsign-compare` warnings, but I am having troubles with `-Wtype-limits` as these seem to be C++ only according to GCC documentation. And honestly I am not sure what to do with them. The issue seems to be in branches like
```c
if ( queue.dlen_max > CAN_FRAME_MAX_DLEN ) {
return -EINVAL;
}
```
where `queue.dlen_max` is `uint8_t` and `CAN_FRAME_MAX_DLEN` is just `unsigned int` because it's a define. Making `dlen_max` unsigned integer is something I'd like to avoid though. If I understand the source of the warning right, we can do something like
```c
if ( queue.dlen_max > ( uint8_t )CAN_FRAME_MAX_DLEN ) {
return -EINVAL;
}
```
Doesn't look good though. Honestly it seems like `-Wtype-limits` analysis is a bit clumsy here.
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5388#note_137313
You're receiving this email because of your account on gitlab.rtems.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20251213/18a56e2a/attachment.htm>
More information about the bugs
mailing list