Thirty-five files across the device drivers, the event recording, the
debugger interfaces, the flattened device tree support and several small
libraries had no Doxygen block. Doxygen listed none of them.
Give each file a block with @file, @ingroup and @brief. The brief names
what the file implements.
The score/cpu ports and the shell still lack their blocks. Later
commits add them.
Updates #5717.
Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
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>
The conversion method returns a type which can be wider than the type
of the value. The result was stored in the type of the value before
the range was checked, so the check saw a truncated value. On a 64
bit target rtems_string_to_int() returned success for a value outside
the range of an int.
Keep the result in the type of the conversion method and check its
range before it is narrowed. Report every range error of the method
and not only the one which saturates to the limit.
Update #5708.
Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
libc's strto* functions' behaviour isn't defined when the passed string
is NULL. In glibc it causes a seg fault when I tested it. This could
cause inconsistency.
rtem's stringto* functions didnt previously checked for null before
passing to underlying strto* functions.
Added the check which returns `RTEMS_INVALID_ADDRESS` on failure.
Also added a test case for the same
Signed-off-by: Prashant Rahul <prashantrahul141@protonmail.com>
This adapts stringto template file to adhere to the new api
Adds a special case for uchar conversion
Signed-off-by: Prashant Rahul <prashantrahul141@protonmail.com>
* libmisc/Makefile.am, libmisc/shell/main_chmod.c,
libmisc/shell/main_mdump.c, libmisc/shell/main_medit.c,
libmisc/shell/main_mfill.c, libmisc/shell/main_mmove.c,
libmisc/shell/main_msdosfmt.c, libmisc/shell/main_mwdump.c,
libmisc/shell/main_sleep.c, libmisc/shell/main_umask.c,
libmisc/shell/shell_script.c, libmisc/stringto/stringto.h,
libmisc/stringto/stringto_template.h: Convert return type from bool
to rtems_status_code and add rtems_string_to_pointer. Perform
associated clean up and changes for return type change.
* libmisc/stringto/stringtopointer.c: New file.
* Makefile.am, preinstall.am, libmisc/Makefile.am, wrapup/Makefile.am:
Add the stringto family of string to number converters. These are
error checking wrappers for the strtoXXX methods and do their best to
return false if the conversion failed. The error checking required
for this is tedious and error prone. Hence better to have in a family
of helper routines.
* libmisc/stringto/stringto.h, libmisc/stringto/stringto_template.h,
libmisc/stringto/stringtodouble.c, libmisc/stringto/stringtofloat.c,
libmisc/stringto/stringtoint.c, libmisc/stringto/stringtolong.c,
libmisc/stringto/stringtolonglong.c,
libmisc/stringto/stringtounsignedchar.c,
libmisc/stringto/stringtounsignedint.c,
libmisc/stringto/stringtounsignedlong.c,
libmisc/stringto/stringtounsignedlonglong.c: New files.