summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/chunked.cc2
-rw-r--r--src/common.hh6
-rw-r--r--src/gui_config.cc4
-rw-r--r--src/gui_gtk.cc38
-rw-r--r--src/gui_htmlattrtext.cc2
-rw-r--r--src/gui_plainattrtext.cc10
-rw-r--r--src/gui_qt.cc14
-rw-r--r--src/logger.cc2
-rw-r--r--src/main.cc4
-rw-r--r--src/mitm_stub.cc3
-rw-r--r--src/monitor-cmd.cc10
-rw-r--r--src/monitor-gui.cc12
-rw-r--r--src/proxy.cc5
-rw-r--r--src/ssl_mbedtls.cc4
-rw-r--r--src/ssl_openssl.cc22
15 files changed, 58 insertions, 80 deletions
diff --git a/src/chunked.cc b/src/chunked.cc
index dfafd89..8a6ad49 100644
--- a/src/chunked.cc
+++ b/src/chunked.cc
@@ -99,7 +99,7 @@ public:
}
protected:
- virtual void data(void const* UNUSED(data), size_t UNUSED(size)) {
+ virtual void data(void const*, size_t) {
}
private:
diff --git a/src/common.hh b/src/common.hh
index 53045a9..ed2451d 100644
--- a/src/common.hh
+++ b/src/common.hh
@@ -7,12 +7,6 @@
# include "config.h"
#endif
-#if HAVE_VAR_ATTRIBUTE_UNUSED && !defined(__GNUG__)
-# define UNUSED(x) __attribute__((unused)) x ## _unused
-#else
-# define UNUSED(x) /* x ## _unused */
-#endif
-
#include <assert.h>
#endif // COMMON_HH
diff --git a/src/gui_config.cc b/src/gui_config.cc
index 5fa5506..3fd1cd2 100644
--- a/src/gui_config.cc
+++ b/src/gui_config.cc
@@ -6,11 +6,11 @@
#include <string.h>
-bool GuiConfig::load_name(std::string const& UNUSED(name)) {
+bool GuiConfig::load_name(std::string const&) {
return false;
}
-bool GuiConfig::load_file(std::string const& UNUSED(filename)) {
+bool GuiConfig::load_file(std::string const&) {
return false;
}
diff --git a/src/gui_gtk.cc b/src/gui_gtk.cc
index af67921..c134e5f 100644
--- a/src/gui_gtk.cc
+++ b/src/gui_gtk.cc
@@ -693,9 +693,7 @@ public:
auto ptr = new std::string(data);
gtk_clipboard_set_with_data(
clipboard, target, 1,
- [](GtkClipboard* UNUSED(clipboard),
- GtkSelectionData* selection,
- guint UNUSED(info),
+ [](GtkClipboard*, GtkSelectionData* selection, guint,
gpointer user_data) -> void {
auto data = reinterpret_cast<std::string*>(user_data);
gtk_selection_data_set(selection,
@@ -704,8 +702,7 @@ public:
reinterpret_cast<guchar const*>(data->data()),
data->size());
},
- [](GtkClipboard* UNUSED(clipboard),
- gpointer user_data) -> void {
+ [](GtkClipboard*, gpointer user_data) -> void {
auto data = reinterpret_cast<std::string*>(user_data);
delete data;
},
@@ -1379,7 +1376,7 @@ protected:
}
}
- static void show_filechooser(GtkButton* UNUSED(button), gpointer user_data) {
+ static void show_filechooser(GtkButton*, gpointer user_data) {
auto value = reinterpret_cast<FileValue*>(user_data);
auto ret = gtk_native_dialog_run(GTK_NATIVE_DIALOG(value->chooser_));
if (ret == GTK_RESPONSE_ACCEPT) {
@@ -1390,24 +1387,22 @@ protected:
}
}
- static void changed(GtkEditable* UNUSED(editable), gpointer user_data) {
+ static void changed(GtkEditable*, gpointer user_data) {
auto value = reinterpret_cast<Value*>(user_data);
value->me_->notify_changed(value->id_);
}
- static void file_set(GtkFileChooserButton* UNUSED(widget),
- gpointer user_data) {
+ static void file_set(GtkFileChooserButton*, gpointer user_data) {
auto value = reinterpret_cast<Value*>(user_data);
value->me_->notify_changed(value->id_);
}
- static void toggled(GtkToggleButton* UNUSED(button), gpointer user_data) {
+ static void toggled(GtkToggleButton*, gpointer user_data) {
auto value = reinterpret_cast<Value*>(user_data);
value->me_->notify_changed(value->id_);
}
- virtual gint add_extra_widgets(GtkGrid* UNUSED(grid), gint row,
- gint UNUSED(colspan)) {
+ virtual gint add_extra_widgets(GtkGrid*, gint row, gint) {
return row;
}
@@ -1628,7 +1623,7 @@ public:
observers_.erase(listener);
}
- void show(GuiWindow* UNUSED(parent)) override {
+ void show(GuiWindow*) override {
if (wnd_) {
assert(false);
focus();
@@ -1690,12 +1685,12 @@ protected:
gtk_text_view_set_buffer(GTK_TEXT_VIEW(view_), buf);
}
- static void buf_changed(GtkTextBuffer* UNUSED(buffer), gpointer user_data) {
+ static void buf_changed(GtkTextBuffer*, gpointer user_data) {
auto me = reinterpret_cast<GtkGuiTextWindow*>(user_data);
me->scroll_to_bottom();
}
- static gboolean delete_event(GtkWidget* widget, GdkEvent* UNUSED(event),
+ static gboolean delete_event(GtkWidget* widget, GdkEvent*,
gpointer user_data) {
auto me = reinterpret_cast<GtkGuiTextWindow*>(user_data);
assert(me->wnd_ == widget);
@@ -1819,11 +1814,11 @@ void main_app_activate(GApplication* g_app) {
app->main_->sync_split();
}
-void main_app_window_open(MainAppWindow* UNUSED(win), GFile* UNUSED(file)) {
+void main_app_window_open(MainAppWindow*, GFile*) {
}
void main_app_open(GApplication* app, GFile** files, gint n_files,
- gchar const* UNUSED(hint)) {
+ gchar const*) {
auto windows = gtk_application_get_windows(GTK_APPLICATION(app));
auto win = windows ? MAIN_APP_WINDOW(windows->data)
: main_app_window_new(MAIN_APP(app));
@@ -1837,7 +1832,7 @@ void main_app_open(GApplication* app, GFile** files, gint n_files,
MAIN_APP(app)->main_->sync_split();
}
-void main_app_init(MainApp* UNUSED(app)) {
+void main_app_init(MainApp*) {
}
void main_app_class_init(MainAppClass* clazz) {
@@ -1845,10 +1840,10 @@ void main_app_class_init(MainAppClass* clazz) {
G_APPLICATION_CLASS(clazz)->open = main_app_open;
}
-void main_app_window_init(MainAppWindow* UNUSED(app)) {
+void main_app_window_init(MainAppWindow*) {
}
-void main_app_window_class_init(MainAppWindowClass* UNUSED(clazz)) {
+void main_app_window_class_init(MainAppWindowClass*) {
}
MainApp* main_app_new(GtkGuiMain* main) {
@@ -1975,8 +1970,7 @@ std::string GtkGuiMenu::unescape(std::string const& action) {
return action;
}
-void menu_item_activate(GSimpleAction* action, GVariant* UNUSED(parameter),
- gpointer data) {
+void menu_item_activate(GSimpleAction* action, GVariant*, gpointer data) {
auto menu = reinterpret_cast<GtkGuiMenu*>(data);
menu->activate(action);
}
diff --git a/src/gui_htmlattrtext.cc b/src/gui_htmlattrtext.cc
index 453d550..9a6fac7 100644
--- a/src/gui_htmlattrtext.cc
+++ b/src/gui_htmlattrtext.cc
@@ -228,7 +228,7 @@ private:
out->append("\">");
}
- static void end_tag(std::string* out, Attribute const& UNUSED(attr)) {
+ static void end_tag(std::string* out, Attribute const&) {
out->append("</span>");
}
diff --git a/src/gui_plainattrtext.cc b/src/gui_plainattrtext.cc
index a588172..1b90f4b 100644
--- a/src/gui_plainattrtext.cc
+++ b/src/gui_plainattrtext.cc
@@ -8,7 +8,7 @@ namespace {
class PlainAttributedTextImpl : public PlainAttributedText {
public:
- void append(const char* str, size_t len, Attribute const& UNUSED(attr),
+ void append(const char* str, size_t len, Attribute const&,
size_t start, size_t length) override {
if (!str || start >= len) return;
length = std::min(len - start, length);
@@ -16,13 +16,11 @@ public:
text_.append(str + start, length);
}
- void add(Attribute const& UNUSED(attr), size_t UNUSED(start),
- size_t UNUSED(length)) override {
+ void add(Attribute const&, size_t, size_t) override {
}
- void set(Attribute const& UNUSED(attr), size_t UNUSED(start),
- size_t UNUSED(length)) override {
+ void set(Attribute const&, size_t, size_t) override {
}
- void clear(size_t UNUSED(start), size_t UNUSED(length)) override {
+ void clear(size_t, size_t) override {
}
std::string text() const override {
diff --git a/src/gui_qt.cc b/src/gui_qt.cc
index c47d8fc..5cd16f9 100644
--- a/src/gui_qt.cc
+++ b/src/gui_qt.cc
@@ -287,7 +287,7 @@ public:
return QModelIndex();
}
- QModelIndex parent(const QModelIndex& UNUSED(index)) const override {
+ QModelIndex parent(const QModelIndex&) const override {
return QModelIndex();
}
@@ -1142,7 +1142,7 @@ protected:
v->check_->setChecked(v->value_);
v->check_->setEnabled(v->enable_);
v->check_->connect(v->check_, &QCheckBox::stateChanged,
- [=](int UNUSED(state)) {
+ [=](int) {
notify_changed(v->id_);
});
break;
@@ -1151,7 +1151,7 @@ protected:
auto vp = value.get();
if (edit) {
edit->connect(edit, &QLineEdit::textChanged,
- [=](QString const& UNUSED(text)) {
+ [=](QString const&) {
notify_changed(vp->id_);
});
edit->setEnabled(value->enable_);
@@ -1162,7 +1162,7 @@ protected:
v->button_->setEnabled(v->enable_);
edit->setReadOnly(true);
dialog_->connect(v->button_, &QPushButton::clicked,
- [=](bool UNUSED(checked)) {
+ [=](bool) {
showFileDialog(v);
});
layout->addWidget(label, row, 0);
@@ -1241,7 +1241,7 @@ protected:
}
}
- virtual int add_extra_widgets(QGridLayout*, int row, int UNUSED(columns)) {
+ virtual int add_extra_widgets(QGridLayout*, int row, int) {
return row;
}
@@ -1491,7 +1491,7 @@ public:
return true;
}
- void show(GuiWindow* UNUSED(parent)) override {
+ void show(GuiWindow*) override {
if (widget_) {
focus();
return;
@@ -1584,7 +1584,7 @@ bool QtGuiMain::run(int argc, char** argv) {
tree->setUniformRowHeights(true);
tree->setSelectionMode(QAbstractItemView::SingleSelection);
QObject::connect(tree->selectionModel(), &QItemSelectionModel::selectionChanged,
- [=](QItemSelection const& selected, QItemSelection const& UNUSED(previous)) {
+ [=](QItemSelection const& selected, QItemSelection const&) {
if (selected.size() == 1) {
notify_selected_row(selected.indexes()[0].row());
} else {
diff --git a/src/logger.cc b/src/logger.cc
index df1af0c..e04b588 100644
--- a/src/logger.cc
+++ b/src/logger.cc
@@ -129,7 +129,7 @@ private:
class NullLogger : public Logger {
public:
- void out(Level UNUSED(lvl), char const* UNUSED(format), ...) override {
+ void out(Level, char const*, ...) override {
}
};
diff --git a/src/main.cc b/src/main.cc
index f4f6a84..d03dd45 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -19,11 +19,11 @@ namespace {
Proxy* g_proxy;
-void proxy_quit(int UNUSED(sig)) {
+void proxy_quit(int) {
g_proxy->quit();
}
-void proxy_reload(int UNUSED(sig)) {
+void proxy_reload(int) {
g_proxy->reload();
}
diff --git a/src/mitm_stub.cc b/src/mitm_stub.cc
index 6f4dcb0..1d206f1 100644
--- a/src/mitm_stub.cc
+++ b/src/mitm_stub.cc
@@ -5,7 +5,6 @@
#include "mitm.hh"
// static
-Mitm* Mitm::create(Logger* UNUSED(logger), Config* UNUSED(config),
- std::string const& UNUSED(cwd)) {
+Mitm* Mitm::create(Logger*, Config*, std::string const&) {
return nullptr;
}
diff --git a/src/monitor-cmd.cc b/src/monitor-cmd.cc
index 8aa8b99..b0caee3 100644
--- a/src/monitor-cmd.cc
+++ b/src/monitor-cmd.cc
@@ -51,15 +51,15 @@ public:
}
}
- void error(Monitor* UNUSED(monitor), std::string const& error) override {
+ void error(Monitor*, std::string const& error) override {
std::cerr << "# Error: " << error << std::endl;
}
- void package(Monitor* UNUSED(monitor), Package const& package) override {
+ void package(Monitor*, Package const& package) override {
packages_.insert(std::make_pair(package.id, package));
}
- void package_data(Monitor* UNUSED(monitor), uint32_t id,
+ void package_data(Monitor*, uint32_t id,
char const* data, size_t size, bool last) override {
auto it = packages_.find(id);
if (it == packages_.end()) {
@@ -143,12 +143,12 @@ private:
io::auto_pipe signal_pipe;
-void signal(int UNUSED(signum)) {
+void signal(int) {
io::write_all(signal_pipe.write(), "", 1);
std::cerr << "# Caught signal" << std::endl;
}
-void quit_loop(Looper* looper, int UNUSED(fd), uint8_t UNUSED(events)) {
+void quit_loop(Looper* looper, int, uint8_t) {
looper->quit();
}
diff --git a/src/monitor-gui.cc b/src/monitor-gui.cc
index 450e96d..4abdd21 100644
--- a/src/monitor-gui.cc
+++ b/src/monitor-gui.cc
@@ -373,7 +373,7 @@ class MonitorGui : GuiMenu::Listener, GuiMain::Listener, Monitor::Delegate,
private:
class ConnectFormListener : public GuiFormApply::Listener {
public:
- void changed(GuiForm* UNUSED(form), std::string const& UNUSED(id)) override {
+ void changed(GuiForm*, std::string const&) override {
}
bool about_to_close(GuiForm* form) override {
@@ -556,7 +556,7 @@ private:
#if HAVE_SSL
class GenerateFormListener : public GuiFormApply::Listener {
public:
- void changed(GuiForm* UNUSED(form), std::string const& UNUSED(id)) override {
+ void changed(GuiForm*, std::string const&) override {
}
bool about_to_close(GuiForm* form) override {
@@ -1322,17 +1322,15 @@ private:
return ~size;
}
#else // HAVE_PCAP
- static bool is_pcap(std::string const& UNUSED(file)) {
+ static bool is_pcap(std::string const&) {
return false;
}
- static bool load_pcap(std::string const& UNUSED(file),
- PackageList* UNUSED(packages)) {
+ static bool load_pcap(std::string const&, PackageList*) {
return false;
}
- static bool save_pcap(PackageList const* UNUSED(packages),
- std::string const& UNUSED(file)) {
+ static bool save_pcap(PackageList const*, std::string const&) {
return false;
}
#endif // HAVE_PCAP
diff --git a/src/proxy.cc b/src/proxy.cc
index 878b40c..3909541 100644
--- a/src/proxy.cc
+++ b/src/proxy.cc
@@ -88,7 +88,7 @@ public:
return *this;
}
- iterator operator++(int UNUSED(dummy)) {
+ iterator operator++(int) {
iterator ret(*this);
++(*this);
return ret;
@@ -1553,8 +1553,7 @@ void ProxyImpl::monitor_error(size_t index, uint16_t status_code,
}
}
-bool ProxyImpl::support_monitor_version(
- size_t UNUSED(index), std::string const& version) {
+bool ProxyImpl::support_monitor_version(size_t, std::string const& version) {
if (version.empty()) return false;
// TODO: Actually do some version check here
return version.compare(VERSION) == 0;
diff --git a/src/ssl_mbedtls.cc b/src/ssl_mbedtls.cc
index 75a624b..1809eba 100644
--- a/src/ssl_mbedtls.cc
+++ b/src/ssl_mbedtls.cc
@@ -231,11 +231,11 @@ protected:
result_ = NO_ERR;
}
- virtual bool before_setup(SetupData const& UNUSED(data)) {
+ virtual bool before_setup(SetupData const&) {
return true;
}
- virtual bool after_setup(SetupData const& UNUSED(data)) {
+ virtual bool after_setup(SetupData const&) {
return true;
}
diff --git a/src/ssl_openssl.cc b/src/ssl_openssl.cc
index 0430f22..14c3162 100644
--- a/src/ssl_openssl.cc
+++ b/src/ssl_openssl.cc
@@ -341,11 +341,10 @@ private:
static int bio_puts(BIO* bio, const char* str) {
return bio_write(bio, str, strlen(str));
}
- static int bio_gets(BIO* UNUSED(bio), char* UNUSED(str), int UNUSED(size)) {
+ static int bio_gets(BIO*, char*, int) {
return -2;
}
- static long bio_ctrl(BIO* UNUSED(bio), int cmd,
- long UNUSED(num), void* UNUSED(ptr)) {
+ static long bio_ctrl(BIO*, int cmd, long, void*) {
if (cmd == BIO_CTRL_FLUSH) {
return 1;
}
@@ -453,20 +452,18 @@ protected:
} // namespace
// static
-SSLEntropy* SSLEntropy::create(Logger* UNUSED(logger)) {
+SSLEntropy* SSLEntropy::create(Logger*) {
return new SSLEntropyImpl();
}
// static
-SSLCertStore* SSLCertStore::create(Logger* UNUSED(logger),
- std::string const& bundle) {
+SSLCertStore* SSLCertStore::create(Logger*, std::string const& bundle) {
// TODO(the_jk): Read certificates here and not later when store is used
return new SSLCertStoreImpl(bundle);
}
// static
-bool SSLKey::generate(Logger* logger, SSLEntropy* UNUSED(entropy),
- std::string* key) {
+bool SSLKey::generate(Logger* logger, SSLEntropy*, std::string* key) {
check_init();
RSA* rsa = RSA_new();
@@ -533,7 +530,7 @@ SSLKey* SSLKey::load(Logger* logger, std::string const& data) {
}
// static
-bool SSLCert::generate(Logger* logger, SSLEntropy* UNUSED(entropy),
+bool SSLCert::generate(Logger* logger, SSLEntropy*,
SSLCert* issuer_cert, SSLKey* issuer_key,
std::string const& host, SSLKey* key,
std::string* cert) {
@@ -693,8 +690,7 @@ SSLCert* SSLCert::load(Logger* logger, std::string const& data) {
const uint16_t SSL::UNSECURE = 0x01;
// static
-SSL* SSL::server(Logger* logger, SSLEntropy* UNUSED(entropy),
- SSLCert* cert, SSLKey* key,
+SSL* SSL::server(Logger* logger, SSLEntropy*, SSLCert* cert, SSLKey* key,
uint16_t flags) {
std::unique_ptr<SSLServerImpl> ret(new SSLServerImpl(logger, flags));
if (!ret->setup(cert, key)) return nullptr;
@@ -702,8 +698,8 @@ SSL* SSL::server(Logger* logger, SSLEntropy* UNUSED(entropy),
}
// static
-SSL* SSL::client(Logger* logger, SSLEntropy* UNUSED(entropy),
- SSLCertStore* store, std::string const& host, uint16_t flags) {
+SSL* SSL::client(Logger* logger, SSLEntropy*, SSLCertStore* store,
+ std::string const& host, uint16_t flags) {
std::unique_ptr<SSLClientImpl> ret(new SSLClientImpl(logger, flags));
if (!ret->setup(store, host)) return nullptr;
return ret.release();