mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-11-16 19:04:53 +08:00
The string to integer template checked the range of the value in every instantiation. Six of the seven integer instantiations use a conversion method whose type is not wider than the type of the value. For those the two comparisons were constant and the code behind them was dead. Coverity reported this as CID 1700407 to CID 1700418. Emit the range check only where the type of the conversion method is wider than the type of the value. Every instantiation which sets STRING_TO_RESULT_TYPE gives the maximum of that type in STRING_TO_RESULT_MAX. The template compares the two maxima. An undefined macro drops the check without a diagnostic, so a missing STRING_TO_RESULT_MAX is an error. Behaviour is unchanged. Where the two types have the same width, the conversion method sets ERANGE. The template already turns ERANGE into RTEMS_INVALID_NUMBER. Update #5708. Assisted-by: Claude:claude-opus-5 claude-code Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>