-
Notifications
You must be signed in to change notification settings - Fork 3k
Add format checking to printf-type APIs #8601
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
Conversation
Correct types passed to debug() calls - as part of this, block size and erase size are changed to be 32-bit - using 64-bit variables for these will cause unnecessary code bloat. Many uses of bd_size_t in the BlockDevice API should really be uint32_t or size_t, but that would be a bigger API change.
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.
Looks good to me 👍 Thanks!!
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.
Nice 👍 Looks good to me. In hindsight we should have used size_t
for the BlockDevice functions you outlined, but unfortunately it will be hard to change at this point.
/morph build |
Build : SUCCESSBuild number : 3525 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 3142 |
I did try adjusting those BlockDevice things to Not sure it'd make a massive difference anyway - I fixed what seemed to be the most wasteful, dividing by a 64-bit variable block size when it's a constant 512, but even that only seemed to shave a few bytes off. (Although maybe a bit more trimming elsewhere would eventually allow a 64/64 divide routine to be omitted from the library). |
Test : FAILUREBuild number : 3310 |
/morph test |
Test : SUCCESSBuild number : 3313 |
Description
Toolchains are capable of performing format-checking on user-defined
printf
variants. Add the necessary directives to do this for some commonly-used mbed OS APIs:error
mbed_error_printf
debug
,debug_if
Stream::printf
,Stream::scanf
,RawSerial::printf
Some clean-ups of warnings generated by this change.
SDBlockDevice
changes are most wide-ranging - it's using 64-bit arithmetic excessively due tobd_size_t
being used for all sorts of things that must be much smaller (being limited tosize_t
by being in-memory, or just block sizes).Pull request type