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.


_______________________________________________
bugs mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/bugs

Reply via email to