From 91f10823943d8df4c538bb6e1aebb6282c20410d Mon Sep 17 00:00:00 2001 From: Willem Melching Date: Tue, 26 May 2020 13:27:01 -0700 Subject: [PATCH] -Werror (#1567) * werror * -Wno-inconsistent-missing-override * Silence ffmpeg deprecation warnings * add some more pragmas to ignore warnings Co-authored-by: Comma Device old-commit-hash: 50f3f1d3357b356c5b1144c518f35375f5bb9924 --- SConstruct | 8 +++----- selfdrive/controls/lib/cluster/fastcluster_dm.cpp | 4 ++-- selfdrive/loggerd/encoder.c | 5 ++++- selfdrive/loggerd/raw_logger.cc | 2 ++ selfdrive/modeld/runners/snpemodel.cc | 2 ++ selfdrive/ui/paint.cc | 11 ++++++----- selfdrive/ui/ui.cc | 8 ++++---- 7 files changed, 23 insertions(+), 17 deletions(-) diff --git a/SConstruct b/SConstruct index f6024a0f33..285a1743b6 100644 --- a/SConstruct +++ b/SConstruct @@ -106,11 +106,9 @@ env = Environment( "-g", "-fPIC", "-O2", - "-Werror=implicit-function-declaration", - "-Werror=incompatible-pointer-types", - "-Werror=int-conversion", - "-Werror=return-type", - "-Werror=format-extra-args", + "-Werror", + "-Wno-deprecated-register", + "-Wno-inconsistent-missing-override", ] + cflags + ccflags_asan, CPPPATH=cpppath + [ diff --git a/selfdrive/controls/lib/cluster/fastcluster_dm.cpp b/selfdrive/controls/lib/cluster/fastcluster_dm.cpp index 8834bc24a0..ee6670c204 100644 --- a/selfdrive/controls/lib/cluster/fastcluster_dm.cpp +++ b/selfdrive/controls/lib/cluster/fastcluster_dm.cpp @@ -49,8 +49,8 @@ #ifdef NO_INCLUDE_FENV #pragma message("Do not use fenv header.") #else -#pragma message("Use fenv header. If there is a warning about unknown #pragma STDC FENV_ACCESS, this can be ignored.") -#pragma STDC FENV_ACCESS on +//#pragma message("Use fenv header. If there is a warning about unknown #pragma STDC FENV_ACCESS, this can be ignored.") +//#pragma STDC FENV_ACCESS on #include #endif diff --git a/selfdrive/loggerd/encoder.c b/selfdrive/loggerd/encoder.c index 1509ff1130..3b9beb4d61 100644 --- a/selfdrive/loggerd/encoder.c +++ b/selfdrive/loggerd/encoder.c @@ -1,3 +1,5 @@ +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + #include #include #include @@ -24,6 +26,7 @@ #include "encoder.h" + //#define ALOG(...) __android_log_print(ANDROID_LOG_VERBOSE, "omxapp", ##__VA_ARGS__) // encoder: lossey codec using hardware hevc @@ -226,7 +229,7 @@ void encoder_init(EncoderState *s, const char* filename, int width, int height, in_port.format.video.xFramerate = (s->fps * 65536); in_port.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused; // in_port.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar; - in_port.format.video.eColorFormat = QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m; + in_port.format.video.eColorFormat = (OMX_COLOR_FORMATTYPE)QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m; err = OMX_SetParameter(s->handle, OMX_IndexParamPortDefinition, (OMX_PTR) &in_port); diff --git a/selfdrive/loggerd/raw_logger.cc b/selfdrive/loggerd/raw_logger.cc index 37b3f28428..d9fc289ded 100644 --- a/selfdrive/loggerd/raw_logger.cc +++ b/selfdrive/loggerd/raw_logger.cc @@ -1,3 +1,5 @@ +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + #include #include #include diff --git a/selfdrive/modeld/runners/snpemodel.cc b/selfdrive/modeld/runners/snpemodel.cc index 4f3d8f58a3..19740f9a93 100644 --- a/selfdrive/modeld/runners/snpemodel.cc +++ b/selfdrive/modeld/runners/snpemodel.cc @@ -1,3 +1,5 @@ +#pragma clang diagnostic ignored "-Wexceptions" + #include #include #include "common/util.h" diff --git a/selfdrive/ui/paint.cc b/selfdrive/ui/paint.cc index ff1db9a251..588f20c3a6 100644 --- a/selfdrive/ui/paint.cc +++ b/selfdrive/ui/paint.cc @@ -1,6 +1,7 @@ #include "ui.hpp" #include #include +#include #include "common/util.h" #define NANOVG_GLES3_IMPLEMENTATION @@ -396,7 +397,7 @@ static void ui_draw_world(UIState *s) { if (scene->lead_status) { draw_lead(s, scene->lead_d_rel, scene->lead_v_rel, scene->lead_y_rel); } - if ((scene->lead_status2) && (fabs(scene->lead_d_rel - scene->lead_d_rel2) > 3.0)) { + if ((scene->lead_status2) && (std::abs(scene->lead_d_rel - scene->lead_d_rel2) > 3.0)) { draw_lead(s, scene->lead_d_rel2, scene->lead_v_rel2, scene->lead_y_rel2); } nvgRestore(s->vg); @@ -617,9 +618,9 @@ static void ui_draw_driver_view(UIState *s) { } else { fbox_x = valid_frame_x + valid_frame_w - box_h / 2 + (scene->face_x + 0.5) * (box_h / 2) - 0.5 * 0.6 * box_h / 2; } - if (abs(scene->face_x) <= 0.35 && abs(scene->face_y) <= 0.4) { + if (std::abs(scene->face_x) <= 0.35 && std::abs(scene->face_y) <= 0.4) { ui_draw_rect(s->vg, fbox_x, fbox_y, 0.6 * box_h / 2, 0.6 * box_h / 2, - nvgRGBAf(1.0, 1.0, 1.0, 0.8 - ((abs(scene->face_x) > abs(scene->face_y) ? abs(scene->face_x) : abs(scene->face_y))) * 0.6 / 0.375), + nvgRGBAf(1.0, 1.0, 1.0, 0.8 - ((std::abs(scene->face_x) > std::abs(scene->face_y) ? std::abs(scene->face_x) : std::abs(scene->face_y))) * 0.6 / 0.375), 35, 10); } else { ui_draw_rect(s->vg, fbox_x, fbox_y, 0.6 * box_h / 2, 0.6 * box_h / 2, nvgRGBAf(1.0, 1.0, 1.0, 0.2), 35, 10); @@ -959,9 +960,9 @@ void ui_nvg_init(UIState *s) { s->rear_frame_mat = matmul(device_transform, frame_transform); for(int i = 0;i < UI_BUF_COUNT; i++) { - s->khr[i] = NULL; + s->khr[i] = 0; s->priv_hnds[i] = NULL; - s->khr_front[i] = NULL; + s->khr_front[i] = 0; s->priv_hnds_front[i] = NULL; } } diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index b573c3f42f..fa33e9cf6c 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -208,7 +208,7 @@ static void update_offroad_layout_timeout(UIState *s, int* timeout) { } static void ui_init(UIState *s) { - + pthread_mutex_init(&s->lock, NULL); s->sm = new SubMaster({"model", "controlsState", "uiLayoutState", "liveCalibration", "radarState", "thermal", "health", "ubloxGnss", "driverState", "dMonitoringState", "offroadLayout" @@ -426,7 +426,7 @@ void handle_message(UIState *s, SubMaster &sm) { // scene.mpc_y[i] = y_list[i]; // } // s->livempc_or_radarstate_changed = true; - // } + // } if (sm.updated("uiLayoutState")) { auto data = sm["uiLayoutState"].getUiLayoutState(); s->active_app = data.getActiveApp(); @@ -511,7 +511,7 @@ static void ui_update(UIState *s) { // do this here for now in lieu of a run_on_main_thread event for (int i=0; ikhr[i] != NULL) { + if(s->khr[i] != 0) { visionimg_destroy_gl(s->khr[i], s->priv_hnds[i]); glDeleteTextures(1, &s->frame_texs[i]); } @@ -541,7 +541,7 @@ static void ui_update(UIState *s) { } for (int i=0; ikhr_front[i] != NULL) { + if(s->khr_front[i] != 0) { visionimg_destroy_gl(s->khr_front[i], s->priv_hnds_front[i]); glDeleteTextures(1, &s->frame_front_texs[i]); }