-
Notifications
You must be signed in to change notification settings - Fork 9k
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
swaglog: enable type-checked against format string. #29096
Conversation
failed to pass the checks. need correct the format string in rednose : commaai/rednose#31 |
4e516e8
to
a88a75c
Compare
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.
can you open the matching rednose PR?
@@ -390,7 +390,7 @@ kj::Array<capnp::word> UbloxMsgParser::parse_glonass_ephemeris(ubx_t::rxm_sfrbx_ | |||
eph.setP4(data->p4()); | |||
eph.setSvURA(glonass_URA_lookup.at(data->f_t())); | |||
if (msg->sv_id() != data->n()) { | |||
LOGE("SV_ID != SLOT_NUMBER: %d %d", msg->sv_id(), data->n()); | |||
LOGE("SV_ID != SLOT_NUMBER: %d %" PRIu64, msg->sv_id(), data->n()); |
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.
why not llu?
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.
use llu will report error on my laptop. the uint64_t is not the same as unsigned long long. https://stackoverflow.com/questions/32198368/unsigned-long-long-conflict-with-uint64-t
the PRIu64 can correctly format uint64_t as lu or llu on different platforms
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.
another way is use llu, and convert uint64_t to (unsigned long long):
LOGE("SV_ID != SLOT_NUMBER: %d %llu", msg->sv_id(), (unsigned long long)data->n());
opened at : commaai/rednose#31 |
enable type-check & correct format string.
added a macro
SWAG_LOG_CHECK_FMT
to causes the compiler to check the arguments in calls tocloudlog
for consistency with theprintf
style format string argument: