-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Stop using PRI*16 and %zu format specifiers #17502
Stop using PRI*16 and %zu format specifiers #17502
Conversation
PR #17502: Size comparison from 8793870 to 5d0b953 Increases (6 builds for cc13x2_26x2, efr32, linux)
Decreases (34 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
Full report (34 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
|
It seems that I still have some issues from my last commit, I'll fix them |
27122f1
to
c6cecc2
Compare
Some libcs don't support them, use %u/%d/%x instead * Commit generated by running the following git-extras commands: git sed -f g '" PRIu16 "' 'u' git sed -f g '" PRIu16' 'u"' git sed -f g '" PRIx16 "' 'x' git sed -f g '" PRIx16' 'x"' git sed -f g '" PRIX16 "' 'X' git sed -f g '" PRIX16' 'X"' git sed -f g '" PRId16 "' 'd' git sed -f g '" PRId16' 'd"' git sed -f g '%zu' '%u' * Cast some %zu parameters due to warnings * Add lint rules * Run restyle Signed-off-by: Andrei Menzopol <[email protected]>
Signed-off-by: Andrei Menzopol <[email protected]>
Signed-off-by: Andrei Menzopol <[email protected]>
c6cecc2
to
6b6455b
Compare
Signed-off-by: Andrei Menzopol <[email protected]>
PR #17502: Size comparison from 03ea72d to 095801d Increases (10 builds for cc13x2_26x2, efr32, linux)
Decreases (40 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
Full report (43 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
|
I think eveything is ok now |
VerifyOrDieWithMsg(mPendingWork == 0, DataManagement, "CommandHandler::Close() called with %zu unfinished async work items", | ||
mPendingWork); | ||
VerifyOrDieWithMsg(mPendingWork == 0, DataManagement, "CommandHandler::Close() called with %u unfinished async work items", | ||
static_cast<unsigned int>(mPendingWork)); |
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.
mPendingWork should just be an unsigned
instead of size_t
. It's a simple counter... Followup for making that change is fine. If that happens, the other logs that involve it in this file should be fixed too.
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.
Got it, thanks
Commit generated by running the following git-extras commands:
git sed -f g '" PRIu16 "' 'u'
git sed -f g '" PRIu16' 'u"'
git sed -f g '" PRIx16 "' 'x'
git sed -f g '" PRIx16' 'x"'
git sed -f g '" PRIX16 "' 'X'
git sed -f g '" PRIX16' 'X"'
git sed -f g '" PRId16 "' 'd'
git sed -f g '" PRId16' 'd"'
git sed -f g '%zu' '%u'
Cast some %zu parameters due to warnings
Add lint rules
Run restyle
This PR is similar with #15099
Problem
Some libcs such as newlib-nano don't support new format specifiers (> C89/C++11). This causes problems in logs and may also cause crashes due to promotion rules.
Change overview
Replace these format specifiers with simpler ones (%u/%d/%x) and cast where necessary.
Testing
Passed all CI/CD on my fork