mirror of
https://github.com/infiniteCable2/openpilot.git
synced 2026-07-26 03:42:05 +08:00
swaglog: enable type-checked against format string (#29096)
* check&fix fmt * bump rednose * correct format string * bump rednose --------- Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> old-commit-hash: 940954c13e4fb352618448e435b5c1a722fdc3aa
This commit is contained in:
+3
-3
@@ -38,8 +38,8 @@ void cl_print_info(cl_platform_id platform, cl_device_id device) {
|
||||
LOGD("extensions: %s", get_platform_info(platform, CL_PLATFORM_EXTENSIONS).c_str());
|
||||
LOGD("name: %s", get_device_info(device, CL_DEVICE_NAME).c_str());
|
||||
LOGD("device version: %s", get_device_info(device, CL_DEVICE_VERSION).c_str());
|
||||
LOGD("max work group size: %d", work_group_size);
|
||||
LOGD("type = %d = ", device_type, type_str);
|
||||
LOGD("max work group size: %zu", work_group_size);
|
||||
LOGD("type = %d, %s", (int)device_type, type_str);
|
||||
}
|
||||
|
||||
void cl_print_build_errors(cl_program program, cl_device_id device) {
|
||||
@@ -62,7 +62,7 @@ cl_device_id cl_get_device_id(cl_device_type device_type) {
|
||||
CL_CHECK(clGetPlatformIDs(num_platforms, &platform_ids[0], NULL));
|
||||
|
||||
for (size_t i = 0; i < num_platforms; ++i) {
|
||||
LOGD("platform[%d] CL_PLATFORM_NAME: %s", i, get_platform_info(platform_ids[i], CL_PLATFORM_NAME).c_str());
|
||||
LOGD("platform[%zu] CL_PLATFORM_NAME: %s", i, get_platform_info(platform_ids[i], CL_PLATFORM_NAME).c_str());
|
||||
|
||||
// Get first device
|
||||
if (cl_device_id device_id = NULL; clGetDeviceIDs(platform_ids[i], device_type, 1, &device_id, NULL) == 0 && device_id) {
|
||||
|
||||
+9
-3
@@ -9,14 +9,20 @@
|
||||
#define CLOUDLOG_CRITICAL 50
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define SWAG_LOG_CHECK_FMT(a, b) __attribute__ ((format (printf, a, b)))
|
||||
#else
|
||||
#define SWAG_LOG_CHECK_FMT(a, b)
|
||||
#endif
|
||||
|
||||
void cloudlog_e(int levelnum, const char* filename, int lineno, const char* func,
|
||||
const char* fmt, ...) /*__attribute__ ((format (printf, 6, 7)))*/;
|
||||
const char* fmt, ...) SWAG_LOG_CHECK_FMT(5, 6);
|
||||
|
||||
void cloudlog_te(int levelnum, const char* filename, int lineno, const char* func,
|
||||
const char* fmt, ...) /*__attribute__ ((format (printf, 6, 7)))*/;
|
||||
const char* fmt, ...) SWAG_LOG_CHECK_FMT(5, 6);
|
||||
|
||||
void cloudlog_te(int levelnum, const char* filename, int lineno, const char* func,
|
||||
uint32_t frame_id, const char* fmt, ...) /*__attribute__ ((format (printf, 6, 7)))*/;
|
||||
uint32_t frame_id, const char* fmt, ...) SWAG_LOG_CHECK_FMT(6, 7);
|
||||
|
||||
|
||||
#define cloudlog(lvl, fmt, ...) cloudlog_e(lvl, __FILE__, __LINE__, \
|
||||
|
||||
+1
-1
Submodule rednose_repo updated: de6e160b0e...7d0841db15
@@ -155,7 +155,7 @@ bool safety_setter_thread(std::vector<Panda *> pandas) {
|
||||
}
|
||||
util::sleep_for(100);
|
||||
}
|
||||
LOGW("got %d bytes CarParams", params.size());
|
||||
LOGW("got %lu bytes CarParams", params.size());
|
||||
|
||||
AlignedBuffer aligned_buf;
|
||||
capnp::FlatArrayMessageReader cmsg(aligned_buf.align(params.data(), params.size()));
|
||||
@@ -237,7 +237,7 @@ void can_send_thread(std::vector<Panda *> pandas, bool fake_send) {
|
||||
LOGT("sendcan sent to panda: %s", (panda->hw_serial()).c_str());
|
||||
}
|
||||
} else {
|
||||
LOGE("sendcan too old to send: %llu, %llu", nanos_since_boot(), event.getLogMonoTime());
|
||||
LOGE("sendcan too old to send: %" PRIu64 ", %" PRIu64, nanos_since_boot(), event.getLogMonoTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -277,7 +277,7 @@ void can_recv_thread(std::vector<Panda *> pandas) {
|
||||
std::this_thread::sleep_for(std::chrono::nanoseconds(remaining));
|
||||
} else {
|
||||
if (ignition) {
|
||||
LOGW("missed cycles (%d) %lld", (int)-1*remaining/dt, remaining);
|
||||
LOGW("missed cycles (%lu) %lld", (unsigned long)(-1*remaining/dt), (long long)remaining);
|
||||
}
|
||||
next_frame_time = cur_time;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
// run the models
|
||||
if (vipc_client.connected) {
|
||||
LOGW("connected with buffer size: %d", vipc_client.buffers[0].len);
|
||||
LOGW("connected with buffer size: %zu", vipc_client.buffers[0].len);
|
||||
run_model(model, vipc_client);
|
||||
}
|
||||
|
||||
|
||||
@@ -237,11 +237,11 @@ int main(int argc, char **argv) {
|
||||
// vipc_client.connected is false only when do_exit is true
|
||||
if (!do_exit) {
|
||||
const VisionBuf *b = &vipc_client_main.buffers[0];
|
||||
LOGW("connected main cam with buffer size: %d (%d x %d)", b->len, b->width, b->height);
|
||||
LOGW("connected main cam with buffer size: %zu (%zu x %zu)", b->len, b->width, b->height);
|
||||
|
||||
if (use_extra_client) {
|
||||
const VisionBuf *wb = &vipc_client_extra.buffers[0];
|
||||
LOGW("connected extra cam with buffer size: %d (%d x %d)", wb->len, wb->width, wb->height);
|
||||
LOGW("connected extra cam with buffer size: %zu (%zu x %zu)", wb->len, wb->width, wb->height);
|
||||
}
|
||||
|
||||
run_model(model, vipc_client_main, vipc_client_extra, main_wide_camera, use_extra_client);
|
||||
|
||||
@@ -61,7 +61,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
// run the models
|
||||
if (vipc_client.connected) {
|
||||
LOGW("connected with buffer size: %d", vipc_client.buffers[0].len);
|
||||
LOGW("connected with buffer size: %zu", vipc_client.buffers[0].len);
|
||||
run_model(model, vipc_client);
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ void ONNXModel::pread(float *buf, int size) {
|
||||
int err;
|
||||
err = poll(fds, 1, 10000); // 10 second timeout
|
||||
assert(err == 1 || (err == -1 && errno == EINTR));
|
||||
LOGD("host read remaining %d/%d poll %d", tr, size*sizeof(float), err);
|
||||
LOGD("host read remaining %d/%lu poll %d", tr, size*sizeof(float), err);
|
||||
err = read(pipeout[0], cbuf, tr);
|
||||
assert(err > 0 || (err == 0 && errno == EINTR));
|
||||
cbuf += err;
|
||||
|
||||
@@ -60,7 +60,7 @@ void encoder_thread(EncoderdState *s, const LogCameraInfo &cam_info) {
|
||||
// init encoders
|
||||
if (encoders.empty()) {
|
||||
VisionBuf buf_info = vipc_client.buffers[0];
|
||||
LOGW("encoder %s init %dx%d", cam_info.thread_name, buf_info.width, buf_info.height);
|
||||
LOGW("encoder %s init %zux%zu", cam_info.thread_name, buf_info.width, buf_info.height);
|
||||
assert(buf_info.width > 0 && buf_info.height > 0);
|
||||
|
||||
for (const auto &encoder_info : cam_info.encoder_infos) {
|
||||
@@ -81,7 +81,7 @@ void encoder_thread(EncoderdState *s, const LogCameraInfo &cam_info) {
|
||||
// detect loop around and drop the frames
|
||||
if (buf->get_frame_id() != extra.frame_id) {
|
||||
if (!lagging) {
|
||||
LOGE("encoder %s lag buffer id: %d extra id: %d", cam_info.thread_name, buf->get_frame_id(), extra.frame_id);
|
||||
LOGE("encoder %s lag buffer id: %" PRIu64 " extra id: %d", cam_info.thread_name, buf->get_frame_id(), extra.frame_id);
|
||||
lagging = true;
|
||||
}
|
||||
continue;
|
||||
|
||||
@@ -264,7 +264,7 @@ void loggerd_thread() {
|
||||
|
||||
if ((++msg_count % 1000) == 0) {
|
||||
double seconds = (millis_since_boot() - start_ts) / 1000.0;
|
||||
LOGD("%lu messages, %.2f msg/sec, %.2f KB/sec", msg_count, msg_count / seconds, bytes_count * 0.001 / seconds);
|
||||
LOGD("%" PRIu64 " messages, %.2f msg/sec, %.2f KB/sec", msg_count, msg_count / seconds, bytes_count * 0.001 / seconds);
|
||||
}
|
||||
|
||||
count++;
|
||||
|
||||
@@ -89,7 +89,7 @@ void VideoWriter::write(uint8_t *data, int len, long long timestamp, bool codecc
|
||||
|
||||
// TODO: can use av_write_frame for non raw?
|
||||
int err = av_interleaved_write_frame(ofmt_ctx, &pkt);
|
||||
if (err < 0) { LOGW("ts encoder write issue len: %d ts: %lu", len, timestamp); }
|
||||
if (err < 0) { LOGW("ts encoder write issue len: %d ts: %lld", len, timestamp); }
|
||||
|
||||
av_packet_unref(&pkt);
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
eph.setSvType(data->m());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user