Skip to content

Commit 4955d98

Browse files
spacewolfXfrMael FEURGARD
andauthored
Warning fixing (#35)
* Bumped Cpp standard to 20 for warning fix, required adding `this` in lambda captures * Removed duplicate verbose flag --------- Co-authored-by: Mael FEURGARD <mael.feurgard@laas.fr>
1 parent de588d1 commit 4955d98

44 files changed

Lines changed: 224 additions & 225 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ include(GNUInstallDirs)
66

77
set(CXX_EXTRA_FLAGS "-Wall -Wextra -fno-sized-deallocation")
88

9-
set(CMAKE_CXX_STANDARD 17)
9+
set(CMAKE_CXX_STANDARD 20)
1010
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_EXTRA_FLAGS}")
1111
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${CXX_EXTRA_FLAGS} -Werror")
1212

docs/source/developer_guide/widgets.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Finally, you can bind a callback to any message with the PprzDispatcher's ``bind
7979
.. code-block:: cpp
8080
8181
pprzApp()->toolbox()->pprzDispatcher()->bind("INTRUDER", this,
82-
[=](QString sender, pprzlink::Message msg) {
82+
[=,this](QString sender, pprzlink::Message msg) {
8383
onIntruder(sender, msg);
8484
});
8585

src/app_settings.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ SettingsEditor::SettingsEditor(bool standalone, QWidget* parent): QDialog(parent
151151
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
152152
lay->addWidget(buttonBox);
153153

154-
connect(buttonBox->button(QDialogButtonBox::Ok), &QPushButton::clicked, this, [=](){
154+
connect(buttonBox->button(QDialogButtonBox::Ok), &QPushButton::clicked, this, [this](){
155155
for(auto &cb:callbacks) {
156156
cb();
157157
}
@@ -165,7 +165,7 @@ SettingsEditor::SettingsEditor(bool standalone, QWidget* parent): QDialog(parent
165165
}
166166
});
167167

168-
connect(buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked, this, [=](){
168+
connect(buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked, this, [=,this](){
169169
reject();
170170
if(standalone) {
171171
qDebug() << "Restarting application...";
@@ -190,7 +190,7 @@ std::function<void()> SettingsEditor::addSetting(QString name, QString key, QWid
190190
auto edit = new QLineEdit(settings.value(key).toString(), w);
191191
gl->addWidget(edit, r, 1);
192192

193-
auto cb = [=]() {
193+
auto cb = [=,this]() {
194194
auto settings = getAppSettings();
195195
settings.setValue(key, edit->text());
196196
};
@@ -200,7 +200,7 @@ std::function<void()> SettingsEditor::addSetting(QString name, QString key, QWid
200200
auto edit = new QLineEdit(settings.value(key).toString(), w);
201201
gl->addWidget(edit, r, 1);
202202

203-
auto cb = [=]() {
203+
auto cb = [=,this]() {
204204
auto settings = getAppSettings();
205205
settings.setValue(key, edit->text().toInt());
206206
};
@@ -210,7 +210,7 @@ std::function<void()> SettingsEditor::addSetting(QString name, QString key, QWid
210210
auto edit = new QLineEdit(settings.value(key).toString(), w);
211211
gl->addWidget(edit, r, 1);
212212

213-
auto cb = [=]() {
213+
auto cb = [=,this]() {
214214
auto settings = getAppSettings();
215215
settings.setValue(key, edit->text().toDouble());
216216
};
@@ -223,15 +223,15 @@ std::function<void()> SettingsEditor::addSetting(QString name, QString key, QWid
223223
QToolButton* but = new QToolButton(w);
224224
but->setIcon(style()->standardIcon(QStyle::SP_DirOpenIcon));
225225
gl->addWidget(but, r, 2);
226-
connect(but, &QToolButton::clicked, this, [=]() {
226+
connect(but, &QToolButton::clicked, this, [=,this]() {
227227
auto dir = QFileDialog::getExistingDirectory(w, name, edit->text());
228228
qDebug() << dir;
229229
if(dir != "") {
230230
edit->setText(dir);
231231
}
232232
});
233233

234-
auto cb = [=]() {
234+
auto cb = [=,this]() {
235235
auto settings = getAppSettings();
236236
settings.setValue(key, edit->text());
237237
};
@@ -244,7 +244,7 @@ std::function<void()> SettingsEditor::addSetting(QString name, QString key, QWid
244244
QToolButton* but = new QToolButton(w);
245245
but->setIcon(style()->standardIcon(QStyle::SP_DirOpenIcon));
246246
gl->addWidget(but, r, 2);
247-
connect(but, &QToolButton::clicked, this, [=]() {
247+
connect(but, &QToolButton::clicked, this, [=,this]() {
248248
QFileInfo fi(edit->text());
249249
auto dir = QFileDialog::getOpenFileName(w, name, fi.absoluteDir().path());
250250
qDebug() << dir;
@@ -253,7 +253,7 @@ std::function<void()> SettingsEditor::addSetting(QString name, QString key, QWid
253253
}
254254
});
255255

256-
auto cb = [=]() {
256+
auto cb = [=,this]() {
257257
auto settings = getAppSettings();
258258
settings.setValue(key, edit->text());
259259
};
@@ -266,7 +266,7 @@ std::function<void()> SettingsEditor::addSetting(QString name, QString key, QWid
266266
combo->setCurrentText(current);
267267
gl->addWidget(combo, r, 1);
268268

269-
auto cb = [=]() {
269+
auto cb = [=,this]() {
270270
auto settings = getAppSettings();
271271
settings.setValue(key, combo->currentText());
272272
};

src/common/aircraft_status.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ AircraftStatus::AircraftStatus(QString ac_id, QObject *parent) : QObject(parent)
99
watcher = new AircraftWatcher(ac_id, this);
1010

1111
//listen for NAVIGATION_REF to update origin waypoint of fixedwings
12-
PprzDispatcher::get()->bind("NAVIGATION_REF", this, [=](QString sender, pprzlink::Message msg) {
12+
PprzDispatcher::get()->bind("NAVIGATION_REF", this, [=,this](QString sender, pprzlink::Message msg) {
1313
if(sender == ac_id) {
1414
int32_t utm_east, utm_north;
1515
uint8_t utm_zone;
@@ -27,7 +27,7 @@ AircraftStatus::AircraftStatus(QString ac_id, QObject *parent) : QObject(parent)
2727
});
2828

2929
//listen for INS_REF to update origin waypoint of rotorcrafts
30-
PprzDispatcher::get()->bind("INS_REF", this, [=](QString sender, pprzlink::Message msg) {
30+
PprzDispatcher::get()->bind("INS_REF", this, [=,this](QString sender, pprzlink::Message msg) {
3131
if(sender == ac_id) {
3232

3333
int32_t lat0, lon0, alt0;

src/common/setting.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Setting::Setting(QDomElement setel, uint8_t& setting_no, QObject* parent) : QObj
8080
}
8181

8282
float Setting::getAltUnitCoef(QString altUnit) {
83-
auto coef_alt = [=](QString alt){
83+
auto coef_alt = [=,this](QString alt){
8484
auto coef = Units::get()->getCoef(unit, alt);
8585
if(coef.has_value()) {
8686
return coef.value();

src/main.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ int main(int argc, char *argv[])
8787
parser.addVersionOption();
8888
parser.addOption({{"c", "configure"}, "Configure app settings."});
8989
parser.addOption({{"s", "silent"}, "Silent mode."});
90-
parser.addOption({{"v", "verbose"}, "Verbose"});
9190
parser.addOption({{"f", "fpedit"}, "edit flight plan", "file"});
9291
parser.addOption({{"b", "bus"}, "Ivy bus", "bus"});
9392
#if defined(SPEECH_ENABLED)

src/pprzmain.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,21 +64,21 @@ void PprzMain::populate_menu() {
6464
auto file_menu = menu_bar->addMenu("&File");
6565

6666
auto user_dir = file_menu->addAction("Open user directory");
67-
connect(user_dir, &QAction::triggered, [=](){
67+
connect(user_dir, &QAction::triggered, [=,this](){
6868
auto settings = getAppSettings();
6969
QString path = QDir::toNativeSeparators(appConfig()->value("USER_DATA_PATH").toString());
7070
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
7171
});
7272

7373
auto app_dir = file_menu->addAction("Open app directory");
74-
connect(app_dir, &QAction::triggered, [=](){
74+
connect(app_dir, &QAction::triggered, [=,this](){
7575
auto settings = getAppSettings();
7676
QString path = QDir::toNativeSeparators(appConfig()->value("APP_DATA_PATH").toString());
7777
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
7878
});
7979

8080
auto edit_settings = file_menu->addAction("Edit Settings");
81-
connect(edit_settings, &QAction::triggered, [=](){
81+
connect(edit_settings, &QAction::triggered, [=,this](){
8282
auto se = new SettingsEditor();
8383
se->open();
8484
});
@@ -96,7 +96,7 @@ void PprzMain::populate_menu() {
9696
map_track_ac->setChecked(false);
9797

9898
auto open_flight_plan = file_menu->addAction("Open FlightPlans");
99-
connect(open_flight_plan, &QAction::triggered, [=](){
99+
connect(open_flight_plan, &QAction::triggered, [=,this](){
100100
auto settings = getAppSettings();
101101
auto pprz_home = appConfig()->value("PAPARAZZI_HOME").toString();
102102
auto files = QFileDialog::getOpenFileNames(this, "open fp", pprz_home + "/conf/flight_plans", "*.xml");
@@ -157,7 +157,7 @@ void PprzMain::populate_menu() {
157157
"<li><a %1 href=\"https://libzip.org/\">libzip</a></li>"
158158
"</ul>").arg(QCoreApplication::applicationVersion());
159159

160-
connect(about, &QAction::triggered, [=]() {
160+
connect(about, &QAction::triggered, [=,this]() {
161161
QMessageBox::about(this,"About PprzGCS", about_txt);
162162

163163
});

src/tools/AircraftManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ void ConfigData::setData(QDomDocument* doc, QString uri) {
181181
}
182182
} else if(uri.left(sepi) == "http") {
183183
auto netacc = new QNetworkAccessManager(this);
184-
connect(netacc, &QNetworkAccessManager::finished, this, [=](QNetworkReply* reply) {
184+
connect(netacc, &QNetworkAccessManager::finished, this, [=,this](QNetworkReply* reply) {
185185
auto data = reply->readAll();
186186
if(reply->error() == QNetworkReply::NetworkError::NoError) {
187187
doc->setContent(data);

src/tools/dispatcher_ui.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
DispatcherUi::DispatcherUi(PprzApplication* app, PprzToolbox* toolbox) : PprzTool(app, toolbox),
44
selected_ac_id("")
55
{
6-
connect(this, &DispatcherUi::ac_selected, [=](QString ac_id){
6+
connect(this, &DispatcherUi::ac_selected, [=,this](QString ac_id){
77
selected_ac_id = ac_id;
88
});
99

src/tools/grpcconnector.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ GRPCConnector::GRPCConnector(PprzApplication* app, PprzToolbox* toolbox) : PprzT
4444
void GRPCConnector::setToolbox(PprzToolbox* toolbox) {
4545
PprzTool::setToolbox(toolbox);
4646

47-
auto th = QThread::create([=] {
47+
auto th = QThread::create([=,this] {
4848
this->runServer();
4949
});
5050
th->start();

0 commit comments

Comments
 (0)