enable wshadow (#22756)
* enable wshadow (#22714) * fix replay * more build fixes Co-authored-by: Willem Melching <willem.melching@gmail.com>pull/22405/head^2
parent
88e2c4a418
commit
5246f0231e
|
@ -181,6 +181,7 @@ env = Environment(
|
|||
"-O2",
|
||||
"-Wunused",
|
||||
"-Werror",
|
||||
"-Wshadow",
|
||||
"-Wno-unknown-warning-option",
|
||||
"-Wno-deprecated-register",
|
||||
"-Wno-register",
|
||||
|
@ -267,7 +268,7 @@ def abspath(x):
|
|||
py_include = sysconfig.get_paths()['include']
|
||||
envCython = env.Clone()
|
||||
envCython["CPPPATH"] += [py_include, np.get_include()]
|
||||
envCython["CCFLAGS"] += ["-Wno-#warnings", "-Wno-deprecated-declarations"]
|
||||
envCython["CCFLAGS"] += ["-Wno-#warnings", "-Wno-shadow", "-Wno-deprecated-declarations"]
|
||||
|
||||
envCython["LIBS"] = []
|
||||
if arch == "Darwin":
|
||||
|
|
|
@ -41,16 +41,16 @@ Pigeon * Pigeon::connect(const char * tty) {
|
|||
return pigeon;
|
||||
}
|
||||
|
||||
bool Pigeon::wait_for_ack(const std::string &ack, const std::string &nack, int timeout_ms) {
|
||||
bool Pigeon::wait_for_ack(const std::string &ack_, const std::string &nack_, int timeout_ms) {
|
||||
std::string s;
|
||||
const double start_t = millis_since_boot();
|
||||
while (!do_exit) {
|
||||
s += receive();
|
||||
|
||||
if (s.find(ack) != std::string::npos) {
|
||||
if (s.find(ack_) != std::string::npos) {
|
||||
LOGD("Received ACK from ublox");
|
||||
return true;
|
||||
} else if (s.find(nack) != std::string::npos) {
|
||||
} else if (s.find(nack_) != std::string::npos) {
|
||||
LOGE("Received NACK from ublox");
|
||||
return false;
|
||||
} else if (s.size() > 0x1000 || ((millis_since_boot() - start_t) > timeout_ms)) {
|
||||
|
|
|
@ -75,11 +75,11 @@ private:
|
|||
cl_kernel krnl_;
|
||||
};
|
||||
|
||||
void CameraBuf::init(cl_device_id device_id, cl_context context, CameraState *s, VisionIpcServer * v, int frame_cnt, VisionStreamType rgb_type, VisionStreamType yuv_type, release_cb release_callback) {
|
||||
void CameraBuf::init(cl_device_id device_id, cl_context context, CameraState *s, VisionIpcServer * v, int frame_cnt, VisionStreamType init_rgb_type, VisionStreamType init_yuv_type, release_cb init_release_callback) {
|
||||
vipc_server = v;
|
||||
this->rgb_type = rgb_type;
|
||||
this->yuv_type = yuv_type;
|
||||
this->release_callback = release_callback;
|
||||
this->rgb_type = init_rgb_type;
|
||||
this->yuv_type = init_yuv_type;
|
||||
this->release_callback = init_release_callback;
|
||||
|
||||
const CameraInfo *ci = &s->ci;
|
||||
camera_state = s;
|
||||
|
|
|
@ -344,12 +344,12 @@ void Localizer::handle_cam_odo(double current_time, const cereal::CameraOdometry
|
|||
|
||||
void Localizer::handle_live_calib(double current_time, const cereal::LiveCalibrationData::Reader& log) {
|
||||
if (log.getRpyCalib().size() > 0) {
|
||||
auto calib = floatlist2vector(log.getRpyCalib());
|
||||
if ((calib.minCoeff() < -CALIB_RPY_SANITY_CHECK) || (calib.maxCoeff() > CALIB_RPY_SANITY_CHECK)) {
|
||||
auto live_calib = floatlist2vector(log.getRpyCalib());
|
||||
if ((live_calib.minCoeff() < -CALIB_RPY_SANITY_CHECK) || (live_calib.maxCoeff() > CALIB_RPY_SANITY_CHECK)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this->calib = calib;
|
||||
this->calib = live_calib;
|
||||
this->device_from_calib = euler2rot(this->calib);
|
||||
this->calib_from_device = this->device_from_calib.transpose();
|
||||
this->calibrated = log.getCalStatus() == 1;
|
||||
|
|
|
@ -172,12 +172,14 @@ kj::Array<capnp::word> UbloxMsgParser::gen_rxm_sfrbx(ubx_t::rxm_sfrbx_t *msg) {
|
|||
}
|
||||
|
||||
// Collect subframes in map and parse when we have all the parts
|
||||
kaitai::kstream stream(subframe_data);
|
||||
gps_t subframe(&stream);
|
||||
int subframe_id = subframe.how()->subframe_id();
|
||||
{
|
||||
kaitai::kstream stream(subframe_data);
|
||||
gps_t subframe(&stream);
|
||||
int subframe_id = subframe.how()->subframe_id();
|
||||
|
||||
if (subframe_id == 1) gps_subframes[msg->sv_id()].clear();
|
||||
gps_subframes[msg->sv_id()][subframe_id] = subframe_data;
|
||||
if (subframe_id == 1) gps_subframes[msg->sv_id()].clear();
|
||||
gps_subframes[msg->sv_id()][subframe_id] = subframe_data;
|
||||
}
|
||||
|
||||
if (gps_subframes[msg->sv_id()].size() == 5) {
|
||||
MessageBuilder msg_builder;
|
||||
|
|
|
@ -45,10 +45,10 @@ int main() {
|
|||
if(parser.add_data(data + bytes_consumed, (uint32_t)(len - bytes_consumed), bytes_consumed_this_time)) {
|
||||
|
||||
try {
|
||||
auto msg = parser.gen_msg();
|
||||
if (msg.second.size() > 0) {
|
||||
auto bytes = msg.second.asBytes();
|
||||
pm.send(msg.first.c_str(), bytes.begin(), bytes.size());
|
||||
auto ublox_msg = parser.gen_msg();
|
||||
if (ublox_msg.second.size() > 0) {
|
||||
auto bytes = ublox_msg.second.asBytes();
|
||||
pm.send(ublox_msg.first.c_str(), bytes.begin(), bytes.size());
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
LOGE("Error parsing ublox message %s", e.what());
|
||||
|
|
|
@ -126,21 +126,21 @@ struct LoggerdState {
|
|||
LoggerdState s;
|
||||
|
||||
// Wait for all encoders to reach the same frame id
|
||||
bool sync_encoders(LoggerdState *s, CameraType cam_type, uint32_t frame_id) {
|
||||
if (s->camera_synced[cam_type]) return true;
|
||||
bool sync_encoders(LoggerdState *state, CameraType cam_type, uint32_t frame_id) {
|
||||
if (state->camera_synced[cam_type]) return true;
|
||||
|
||||
if (s->max_waiting > 1 && s->encoders_ready != s->max_waiting) {
|
||||
update_max_atomic(s->latest_frame_id, frame_id);
|
||||
if (std::exchange(s->camera_ready[cam_type], true) == false) {
|
||||
++s->encoders_ready;
|
||||
if (state->max_waiting > 1 && state->encoders_ready != state->max_waiting) {
|
||||
update_max_atomic(state->latest_frame_id, frame_id);
|
||||
if (std::exchange(state->camera_ready[cam_type], true) == false) {
|
||||
++state->encoders_ready;
|
||||
LOGE("camera %d encoder ready", cam_type);
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
// Small margin in case one of the encoders already dropped the next frame
|
||||
uint32_t start_frame_id = s->latest_frame_id + 2;
|
||||
uint32_t start_frame_id = state->latest_frame_id + 2;
|
||||
bool synced = frame_id >= start_frame_id;
|
||||
s->camera_synced[cam_type] = synced;
|
||||
state->camera_synced[cam_type] = synced;
|
||||
if (!synced) LOGE("camera %d waiting for frame %d, cur %d", cam_type, start_frame_id, frame_id);
|
||||
return synced;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ void write_msg(LoggerHandle *logger) {
|
|||
TEST_CASE("logger") {
|
||||
const std::string log_root = "/tmp/test_logger";
|
||||
system(("rm " + log_root + " -rf").c_str());
|
||||
|
||||
|
||||
ExitHandler do_exit;
|
||||
|
||||
LoggerState logger = {};
|
||||
|
@ -121,11 +121,11 @@ TEST_CASE("logger") {
|
|||
REQUIRE(segment == i);
|
||||
main_segment = segment;
|
||||
if (i == 0) {
|
||||
for (int i = 0; i < thread_cnt; ++i) {
|
||||
for (int j = 0; j < thread_cnt; ++j) {
|
||||
threads.push_back(std::thread(logging_thread));
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
for (int j = 0; j < 100; ++j) {
|
||||
write_msg(logger.cur_handle);
|
||||
usleep(1);
|
||||
}
|
||||
|
|
|
@ -22,10 +22,10 @@ ModelFrame::ModelFrame(cl_device_id device_id, cl_context context) {
|
|||
loadyuv_init(&loadyuv, context, device_id, MODEL_WIDTH, MODEL_HEIGHT);
|
||||
}
|
||||
|
||||
float* ModelFrame::prepare(cl_mem yuv_cl, int frame_width, int frame_height, const mat3 &transform, cl_mem *output) {
|
||||
float* ModelFrame::prepare(cl_mem yuv_cl, int frame_width, int frame_height, const mat3 &projection, cl_mem *output) {
|
||||
transform_queue(&this->transform, q,
|
||||
yuv_cl, frame_width, frame_height,
|
||||
y_cl, u_cl, v_cl, MODEL_WIDTH, MODEL_HEIGHT, transform);
|
||||
y_cl, u_cl, v_cl, MODEL_WIDTH, MODEL_HEIGHT, projection);
|
||||
|
||||
if (output == NULL) {
|
||||
loadyuv_queue(&loadyuv, q, y_cl, u_cl, v_cl, net_input_cl);
|
||||
|
|
|
@ -225,8 +225,8 @@ void buildProcs(cereal::ProcLog::Builder &builder) {
|
|||
const ProcCache &extra_info = Parser::getProcExtraInfo(r.pid, r.name);
|
||||
l.setExe(extra_info.exe);
|
||||
auto lcmdline = l.initCmdline(extra_info.cmdline.size());
|
||||
for (size_t i = 0; i < lcmdline.size(); i++) {
|
||||
lcmdline.set(i, extra_info.cmdline[i]);
|
||||
for (size_t j = 0; j < lcmdline.size(); j++) {
|
||||
lcmdline.set(j, extra_info.cmdline[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -576,9 +576,9 @@ void MapInstructions::updateDistance(float d) {
|
|||
distance->setText(distance_str);
|
||||
}
|
||||
|
||||
void MapInstructions::showError(QString error) {
|
||||
void MapInstructions::showError(QString error_text) {
|
||||
primary->setText("");
|
||||
distance->setText(error);
|
||||
distance->setText(error_text);
|
||||
distance->setAlignment(Qt::AlignCenter);
|
||||
|
||||
secondary->setVisible(false);
|
||||
|
|
|
@ -138,7 +138,6 @@ MapPanel::MapPanel(QWidget* parent) : QWidget(parent) {
|
|||
HttpRequest* deleter = new HttpRequest(this);
|
||||
|
||||
QObject::connect(repeater, &RequestRepeater::receivedResponse, [=](QString resp) {
|
||||
auto params = Params();
|
||||
if (resp != "null") {
|
||||
if (params.get("NavDestination").empty()) {
|
||||
qWarning() << "Setting NavDestination from /next" << resp;
|
||||
|
|
|
@ -23,7 +23,7 @@ Networking::Networking(QWidget* parent, bool show_advanced) : QFrame(parent) {
|
|||
connect(wifi, &WifiManager::refreshSignal, this, &Networking::refresh);
|
||||
connect(wifi, &WifiManager::wrongPassword, this, &Networking::wrongPassword);
|
||||
|
||||
QWidget* wifiScreen = new QWidget(this);
|
||||
wifiScreen = new QWidget(this);
|
||||
QVBoxLayout* vlayout = new QVBoxLayout(wifiScreen);
|
||||
vlayout->setContentsMargins(20, 20, 20, 20);
|
||||
if (show_advanced) {
|
||||
|
|
|
@ -416,19 +416,19 @@ void WifiManager::activateModemConnection(const QDBusObjectPath &path) {
|
|||
NetworkType WifiManager::currentNetworkType() {
|
||||
QDBusInterface nm(NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE_PROPERTIES, bus);
|
||||
nm.setTimeout(DBUS_TIMEOUT);
|
||||
const QDBusObjectPath &path = get_response<QDBusObjectPath>(nm.call("Get", NM_DBUS_INTERFACE, "PrimaryConnection"));
|
||||
const QDBusObjectPath &primary_conn = get_response<QDBusObjectPath>(nm.call("Get", NM_DBUS_INTERFACE, "PrimaryConnection"));
|
||||
|
||||
QDBusInterface nm2(NM_DBUS_SERVICE, path.path(), NM_DBUS_INTERFACE_PROPERTIES, bus);
|
||||
QDBusInterface nm2(NM_DBUS_SERVICE, primary_conn.path(), NM_DBUS_INTERFACE_PROPERTIES, bus);
|
||||
nm.setTimeout(DBUS_TIMEOUT);
|
||||
const QString &type = get_response<QString>(nm2.call("Get", NM_DBUS_INTERFACE_ACTIVE_CONNECTION, "Type"));
|
||||
const QString &primary_type = get_response<QString>(nm2.call("Get", NM_DBUS_INTERFACE_ACTIVE_CONNECTION, "Type"));
|
||||
|
||||
if (type == "802-3-ethernet") {
|
||||
if (primary_type == "802-3-ethernet") {
|
||||
return NetworkType::ETHERNET;
|
||||
} else if (type == "802-11-wireless" && !isTetheringEnabled()) {
|
||||
} else if (primary_type == "802-11-wireless" && !isTetheringEnabled()) {
|
||||
return NetworkType::WIFI;
|
||||
} else {
|
||||
for (const QDBusObjectPath &path : get_active_connections()) {
|
||||
QDBusInterface nm3(NM_DBUS_SERVICE, path.path(), NM_DBUS_INTERFACE_PROPERTIES, bus);
|
||||
for (const QDBusObjectPath &conn : get_active_connections()) {
|
||||
QDBusInterface nm3(NM_DBUS_SERVICE, conn.path(), NM_DBUS_INTERFACE_PROPERTIES, bus);
|
||||
nm3.setTimeout(DBUS_TIMEOUT);
|
||||
const QString &type = get_response<QString>(nm3.call("Get", NM_DBUS_INTERFACE_ACTIVE_CONNECTION, "Type"));
|
||||
if (type == "gsm") {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <sstream>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QLabel>
|
||||
|
|
|
@ -201,9 +201,9 @@ void CameraViewWidget::updateFrameMat(int w, int h) {
|
|||
}
|
||||
} else if (vipc_client->connected) {
|
||||
// fit frame to widget size
|
||||
float w = (float)width() / height();
|
||||
float f = (float)vipc_client->buffers[0].width / vipc_client->buffers[0].height;
|
||||
frame_mat = matmul(device_transform, get_fit_view_transform(w, f));
|
||||
float widget_aspect_ratio = (float)width() / height();
|
||||
float frame_aspect_ratio = (float)vipc_client->buffers[0].width / vipc_client->buffers[0].height;
|
||||
frame_mat = matmul(device_transform, get_fit_view_transform(widget_aspect_ratio, frame_aspect_ratio));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,10 +30,10 @@ AbstractControl::AbstractControl(const QString &title, const QString &desc, cons
|
|||
// left icon
|
||||
if (!icon.isEmpty()) {
|
||||
QPixmap pix(icon);
|
||||
QLabel *icon = new QLabel();
|
||||
icon->setPixmap(pix.scaledToWidth(80, Qt::SmoothTransformation));
|
||||
icon->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
|
||||
hlayout->addWidget(icon);
|
||||
QLabel *icon_label = new QLabel();
|
||||
icon_label->setPixmap(pix.scaledToWidth(80, Qt::SmoothTransformation));
|
||||
icon_label->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
|
||||
hlayout->addWidget(icon_label);
|
||||
}
|
||||
|
||||
// title
|
||||
|
|
|
@ -113,7 +113,7 @@ bool FrameReader::load(const std::string &url, std::atomic<bool> *abort) {
|
|||
frames_.reserve(60 * 20); // 20fps, one minute
|
||||
while (!(abort && *abort)) {
|
||||
Frame &frame = frames_.emplace_back();
|
||||
int err = av_read_frame(pFormatCtx_, &frame.pkt);
|
||||
err = av_read_frame(pFormatCtx_, &frame.pkt);
|
||||
if (err < 0) {
|
||||
frames_.pop_back();
|
||||
valid_ = (err == AVERROR_EOF);
|
||||
|
|
|
@ -39,7 +39,7 @@ int getch() {
|
|||
return ch;
|
||||
}
|
||||
|
||||
void keyboardThread(Replay *replay) {
|
||||
void keyboardThread(Replay *replay_) {
|
||||
char c;
|
||||
while (true) {
|
||||
c = getch();
|
||||
|
@ -51,26 +51,26 @@ void keyboardThread(Replay *replay) {
|
|||
try {
|
||||
if (r[0] == '#') {
|
||||
r.erase(0, 1);
|
||||
replay->seekTo(std::stoi(r) * 60, false);
|
||||
replay_->seekTo(std::stoi(r) * 60, false);
|
||||
} else {
|
||||
replay->seekTo(std::stoi(r), false);
|
||||
replay_->seekTo(std::stoi(r), false);
|
||||
}
|
||||
} catch (std::invalid_argument) {
|
||||
qDebug() << "invalid argument";
|
||||
}
|
||||
getch(); // remove \n from entering seek
|
||||
} else if (c == 'm') {
|
||||
replay->seekTo(+60, true);
|
||||
replay_->seekTo(+60, true);
|
||||
} else if (c == 'M') {
|
||||
replay->seekTo(-60, true);
|
||||
replay_->seekTo(-60, true);
|
||||
} else if (c == 's') {
|
||||
replay->seekTo(+10, true);
|
||||
replay_->seekTo(+10, true);
|
||||
} else if (c == 'S') {
|
||||
replay->seekTo(-10, true);
|
||||
replay_->seekTo(-10, true);
|
||||
} else if (c == 'G') {
|
||||
replay->seekTo(0, true);
|
||||
replay_->seekTo(0, true);
|
||||
} else if (c == ' ') {
|
||||
replay->pause(!replay->isPaused());
|
||||
replay_->pause(!replay_->isPaused());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,11 +52,11 @@ static GLint defaultFBO = -1;
|
|||
NVGLUframebuffer* nvgluCreateFramebuffer(NVGcontext* ctx, int w, int h, int imageFlags)
|
||||
{
|
||||
#ifdef NANOVG_FBO_VALID
|
||||
GLint defaultFBO;
|
||||
GLint localDefaultFBO;
|
||||
GLint defaultRBO;
|
||||
NVGLUframebuffer* fb = NULL;
|
||||
|
||||
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &defaultFBO);
|
||||
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &localDefaultFBO);
|
||||
glGetIntegerv(GL_RENDERBUFFER_BINDING, &defaultRBO);
|
||||
|
||||
fb = (NVGLUframebuffer*)malloc(sizeof(NVGLUframebuffer));
|
||||
|
@ -92,11 +92,11 @@ NVGLUframebuffer* nvgluCreateFramebuffer(NVGcontext* ctx, int w, int h, int imag
|
|||
|
||||
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) goto error;
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, defaultFBO);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, localDefaultFBO);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, defaultRBO);
|
||||
return fb;
|
||||
error:
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, defaultFBO);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, localDefaultFBO);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, defaultRBO);
|
||||
nvgluDeleteFramebuffer(fb);
|
||||
return NULL;
|
||||
|
|
Loading…
Reference in New Issue