diff --git a/common/clutil.cc b/common/clutil.cc index 3cfc8a8c8c..fab1649ee1 100644 --- a/common/clutil.cc +++ b/common/clutil.cc @@ -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) { diff --git a/common/swaglog.h b/common/swaglog.h index 25368501ac..5a3434d624 100644 --- a/common/swaglog.h +++ b/common/swaglog.h @@ -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__, \ diff --git a/rednose_repo b/rednose_repo index de6e160b0e..7d0841db15 160000 --- a/rednose_repo +++ b/rednose_repo @@ -1 +1 @@ -Subproject commit de6e160b0e6ef4e286461d6d08297eed8f6fc493 +Subproject commit 7d0841db152a2de67676617d4034e97cf64caa4b diff --git a/selfdrive/boardd/boardd.cc b/selfdrive/boardd/boardd.cc index 8f5375e6e1..31ae0a4102 100644 --- a/selfdrive/boardd/boardd.cc +++ b/selfdrive/boardd/boardd.cc @@ -155,7 +155,7 @@ bool safety_setter_thread(std::vector 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 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 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; } diff --git a/selfdrive/modeld/dmonitoringmodeld.cc b/selfdrive/modeld/dmonitoringmodeld.cc index bd3564714a..2890b44fe0 100644 --- a/selfdrive/modeld/dmonitoringmodeld.cc +++ b/selfdrive/modeld/dmonitoringmodeld.cc @@ -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); } diff --git a/selfdrive/modeld/modeld.cc b/selfdrive/modeld/modeld.cc index 1203704013..18f3c3ef8a 100644 --- a/selfdrive/modeld/modeld.cc +++ b/selfdrive/modeld/modeld.cc @@ -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); diff --git a/selfdrive/modeld/navmodeld.cc b/selfdrive/modeld/navmodeld.cc index bd78e7a48b..802b88ac2e 100644 --- a/selfdrive/modeld/navmodeld.cc +++ b/selfdrive/modeld/navmodeld.cc @@ -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); } diff --git a/selfdrive/modeld/runners/onnxmodel.cc b/selfdrive/modeld/runners/onnxmodel.cc index e9a5d09406..48c16457fd 100644 --- a/selfdrive/modeld/runners/onnxmodel.cc +++ b/selfdrive/modeld/runners/onnxmodel.cc @@ -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; diff --git a/system/loggerd/encoderd.cc b/system/loggerd/encoderd.cc index 2cb26dc8d5..1646b1ec08 100644 --- a/system/loggerd/encoderd.cc +++ b/system/loggerd/encoderd.cc @@ -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; diff --git a/system/loggerd/loggerd.cc b/system/loggerd/loggerd.cc index 9cad9d7f2e..5bbeb43d53 100644 --- a/system/loggerd/loggerd.cc +++ b/system/loggerd/loggerd.cc @@ -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++; diff --git a/system/loggerd/video_writer.cc b/system/loggerd/video_writer.cc index 91bf09355f..1b449056cb 100644 --- a/system/loggerd/video_writer.cc +++ b/system/loggerd/video_writer.cc @@ -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); } diff --git a/system/ubloxd/ublox_msg.cc b/system/ubloxd/ublox_msg.cc index ee8447fa64..7cecf58bed 100644 --- a/system/ubloxd/ublox_msg.cc +++ b/system/ubloxd/ublox_msg.cc @@ -390,7 +390,7 @@ kj::Array 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()); }