From 20f59e957e70250cfb876ac7a1743134d6b83339 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Thu, 6 Jul 2017 08:56:39 +0200 Subject: [PATCH] Apply some clang-tidy fixes. This patch was generated using clang-tidy: clang-tidy -checks="-*,..." -fix The following set of checks was enabled: modernize-use-nullptr,modernize-deprecated-headers,modernize-make-shared, modernize-redundant-void-arg,modernize-use-bool-literals, modernize-use-emplace,modernize-use-equals-default, google-readability-namespace-comments,misc-unused-using-decls Add NOLINT to have clang-tidy (among other tools) ignore some lines that are not meant to be changed. --- pv/binding/decoder.cpp | 3 +-- pv/binding/device.cpp | 3 +-- pv/binding/inputoutput.cpp | 3 +-- pv/data/decode/decoder.cpp | 2 -- pv/data/decode/decoder.hpp | 2 -- pv/data/decodesignal.hpp | 1 - pv/devicemanager.cpp | 2 -- pv/mainwindow.cpp | 1 - pv/views/trace/cursor.cpp | 2 +- pv/views/trace/decodetrace.cpp | 3 --- pv/views/trace/decodetrace.hpp | 2 +- pv/views/trace/view.cpp | 1 - pv/views/trace/viewport.cpp | 2 +- 13 files changed, 6 insertions(+), 21 deletions(-) diff --git a/pv/binding/decoder.cpp b/pv/binding/decoder.cpp index 28f42a08..f51f9077 100644 --- a/pv/binding/decoder.cpp +++ b/pv/binding/decoder.cpp @@ -31,7 +31,6 @@ #include using boost::none; -using std::make_pair; using std::map; using std::pair; using std::shared_ptr; @@ -97,7 +96,7 @@ shared_ptr Decoder::bind_enum( vector< pair > values; for (GSList *l = option->values; l; l = l->next) { Glib::VariantBase var = Glib::VariantBase((GVariant*)l->data, true); - values.push_back(make_pair(var, print_gvariant(var))); + values.emplace_back(var, print_gvariant(var)); } return shared_ptr(new Enum(name, desc, values, getter, setter)); diff --git a/pv/binding/device.cpp b/pv/binding/device.cpp index 20082db2..1afc2ce2 100644 --- a/pv/binding/device.cpp +++ b/pv/binding/device.cpp @@ -32,7 +32,6 @@ using boost::optional; using std::function; -using std::make_pair; using std::pair; using std::set; using std::shared_ptr; @@ -157,7 +156,7 @@ void Device::bind_enum(const QString &name, const QString &desc, vector< pair > values; while ((iter.next_value(gvar))) - values.push_back(make_pair(gvar, printer(gvar))); + values.emplace_back(gvar, printer(gvar)); properties_.push_back(shared_ptr(new Enum(name, desc, values, getter, setter))); diff --git a/pv/binding/inputoutput.cpp b/pv/binding/inputoutput.cpp index 9d2299af..4aa0c0ea 100644 --- a/pv/binding/inputoutput.cpp +++ b/pv/binding/inputoutput.cpp @@ -35,7 +35,6 @@ using boost::none; -using std::make_pair; using std::map; using std::pair; using std::shared_ptr; @@ -111,7 +110,7 @@ shared_ptr InputOutput::bind_enum( { vector< pair > enum_vals; for (VariantBase var : values) - enum_vals.push_back(make_pair(var, print_gvariant(var))); + enum_vals.emplace_back(var, print_gvariant(var)); return shared_ptr(new Enum(name, desc, enum_vals, getter, setter)); } diff --git a/pv/data/decode/decoder.cpp b/pv/data/decode/decoder.cpp index 2a9b980b..cd3e97d6 100644 --- a/pv/data/decode/decoder.cpp +++ b/pv/data/decode/decoder.cpp @@ -28,9 +28,7 @@ #include using pv::data::DecodeChannel; -using std::set; using std::map; -using std::shared_ptr; using std::string; namespace pv { diff --git a/pv/data/decode/decoder.hpp b/pv/data/decode/decoder.hpp index 4ec193b1..1ef3a28a 100644 --- a/pv/data/decode/decoder.hpp +++ b/pv/data/decode/decoder.hpp @@ -28,8 +28,6 @@ #include using std::map; -using std::set; -using std::shared_ptr; using std::string; using std::vector; diff --git a/pv/data/decodesignal.hpp b/pv/data/decodesignal.hpp index 3d90f7f7..0e091152 100644 --- a/pv/data/decodesignal.hpp +++ b/pv/data/decodesignal.hpp @@ -40,7 +40,6 @@ using std::condition_variable; using std::map; using std::mutex; using std::pair; -using std::unordered_set; using std::vector; using std::shared_ptr; diff --git a/pv/devicemanager.cpp b/pv/devicemanager.cpp index 35efa127..ccd3716a 100644 --- a/pv/devicemanager.cpp +++ b/pv/devicemanager.cpp @@ -48,8 +48,6 @@ using std::string; using std::unique_ptr; using std::vector; -using Glib::ustring; -using Glib::Variant; using Glib::VariantBase; using sigrok::ConfigKey; diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index 119ce0a7..52b62508 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -53,7 +53,6 @@ using std::bind; using std::dynamic_pointer_cast; using std::make_shared; -using std::map; using std::placeholders::_1; using std::shared_ptr; using std::string; diff --git a/pv/views/trace/cursor.cpp b/pv/views/trace/cursor.cpp index 4fb4b65d..88c4ebfd 100644 --- a/pv/views/trace/cursor.cpp +++ b/pv/views/trace/cursor.cpp @@ -34,7 +34,7 @@ #include #include -using std::abs; // Force usage of std::abs() instead of C's abs(). +using std::abs; // NOLINT. Force usage of std::abs() instead of C's abs(). using std::shared_ptr; namespace pv { diff --git a/pv/views/trace/decodetrace.cpp b/pv/views/trace/decodetrace.cpp index 21d88923..b0395eaa 100644 --- a/pv/views/trace/decodetrace.cpp +++ b/pv/views/trace/decodetrace.cpp @@ -56,14 +56,11 @@ extern "C" { using std::all_of; using std::make_pair; using std::max; -using std::map; using std::min; using std::out_of_range; using std::pair; using std::shared_ptr; -using std::make_shared; using std::tie; -using std::unordered_set; using std::vector; using pv::data::decode::Annotation; diff --git a/pv/views/trace/decodetrace.hpp b/pv/views/trace/decodetrace.hpp index 26da3ace..d6a1fbbe 100644 --- a/pv/views/trace/decodetrace.hpp +++ b/pv/views/trace/decodetrace.hpp @@ -60,7 +60,7 @@ class Annotation; class Decoder; class Row; } -} +} // namespace data namespace widgets { class DecoderGroupBox; diff --git a/pv/views/trace/view.cpp b/pv/views/trace/view.cpp index 0b5eef74..f8378d98 100644 --- a/pv/views/trace/view.cpp +++ b/pv/views/trace/view.cpp @@ -73,7 +73,6 @@ using pv::util::Timestamp; using std::back_inserter; using std::copy_if; using std::count_if; -using std::dynamic_pointer_cast; using std::inserter; using std::max; using std::make_pair; diff --git a/pv/views/trace/viewport.cpp b/pv/views/trace/viewport.cpp index d426a133..8eb32a5e 100644 --- a/pv/views/trace/viewport.cpp +++ b/pv/views/trace/viewport.cpp @@ -37,7 +37,7 @@ using std::abs; using std::back_inserter; using std::copy; using std::dynamic_pointer_cast; -using std::none_of; // Used in assert()s. +using std::none_of; // NOLINT. Used in assert()s. using std::shared_ptr; using std::stable_sort; using std::vector; -- 2.30.2