1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-18 21:23:02 +00:00

fix clang-tidy complaints

some of these are ridiculous and so have been silenced. I'm a huge fan
of static code analysis but I have a hard time believing that writing
"0U" is a qualitative improvement over "0u".
This commit is contained in:
Jim Melton 2021-02-15 21:30:50 -07:00
parent 35f07b76a0
commit c67f23c913
No known key found for this signature in database
GPG Key ID: C46392D9AACAB216
5 changed files with 27 additions and 25 deletions

View File

@ -22,6 +22,7 @@
#include <glog/logging.h>
#include <cmath> // ceil, floor
#include <fstream>
#include <utility> // move
using namespace std::string_literals;
@ -133,9 +134,13 @@ gr::basic_block_sptr FileSourceBase::get_left_block()
gr::basic_block_sptr FileSourceBase::get_right_block()
{
if (valve_) return valve_;
if (throttle_) return throttle_;
// clang-tidy wants braces around the if-conditions. clang-format wants to break the braces into
// multiple line blocks. It's much more readable this way
// clang-format off
if (valve_) { return valve_; }
if (throttle_) { return throttle_; }
return source();
// clang-format on
}
@ -174,37 +179,32 @@ uint64_t FileSourceBase::samples() const
}
FileSourceBase::FileSourceBase(ConfigurationInterface const* configuration, std::string role, std::string impl,
FileSourceBase::FileSourceBase(ConfigurationInterface const* configuration, std::string const& role, std::string impl,
Concurrent_Queue<pmt::pmt_t>* queue,
std::string default_item_type)
: SignalSourceBase(configuration, role, impl), filename_(configuration->property(role + ".filename"s, "../data/example_capture.dat"s)), file_source_()
: SignalSourceBase(configuration, role, std::move(impl)), filename_(configuration->property(role + ".filename"s, "../data/example_capture.dat"s)), file_source_(),
,
item_type_(configuration->property(role + ".item_type"s, default_item_type)),
item_size_(0) // invalid
,
is_complex_(false)
item_type_(configuration->property(role + ".item_type"s, default_item_type)), // NOLINT
item_size_(0),
is_complex_(false),
// apparently, MacOS (LLVM) finds 0UL ambiguous with bool, int64_t, uint64_t, int32_t, int16_t, uint16_t,... float, double
,
header_size_(configuration->property(role + ".header_size"s, uint64_t(0))),
seconds_to_skip_(configuration->property(role + ".seconds_to_skip", 0.0)),
repeat_(configuration->property(role + ".repeat"s, false))
repeat_(configuration->property(role + ".repeat"s, false)),
,
samples_(configuration->property(role + ".samples"s, uint64_t(0))),
sampling_frequency_(configuration->property(role + ".sampling_frequency"s, int64_t(0))),
valve_(),
queue_(queue)
valve_(), // NOLINT
queue_(queue),
,
enable_throttle_control_(configuration->property(role + ".enable_throttle_control"s, false)),
throttle_()
throttle_(), // NOLINT
,
dump_(configuration->property(role + ".dump"s, false)),
dump_filename_(configuration->property(role + ".dump_filename"s, "../data/my_capture.dat"s)),
sink_()
sink_() // NOLINT
{
// override value with commandline flag, if present
if (FLAGS_signal_source != "-")

View File

@ -84,7 +84,7 @@ protected:
// Subclasses may want to assert default item types that are appropriate to the specific file
// type supported. Rather than require the item type to be specified in the config file, allow
// sub-classes to impose their will
FileSourceBase(ConfigurationInterface const* configuration, std::string role, std::string impl,
FileSourceBase(ConfigurationInterface const* configuration, std::string const& role, std::string impl,
Concurrent_Queue<pmt::pmt_t>* queue,
std::string default_item_type = "short");

View File

@ -20,6 +20,8 @@
#include "signal_source_base.h"
#include "configuration_interface.h"
#include <utility> // move
using namespace std::string_literals;
@ -39,6 +41,6 @@ size_t SignalSourceBase::getRfChannels() const
}
SignalSourceBase::SignalSourceBase(ConfigurationInterface const* configuration, std::string role, std::string impl)
: SignalSourceInterface(), role_(role), implementation_(impl), rfChannels_(configuration->property(role + ".RF_channels"s, 1u))
: role_(std::move(role)), implementation_(std::move(impl)), rfChannels_(configuration->property(role + ".RF_channels"s, 1u))
{
}

View File

@ -191,7 +191,7 @@ std::unique_ptr<To> dynamic_unique_cast(std::unique_ptr<From>&& p)
return result;
}
auto findRole(ConfigurationInterface const* configuration, std::string base, int ID) -> std::string
auto findRole(ConfigurationInterface const* configuration, std::string const& base, int ID) -> std::string
{
auto role = base + std::to_string(ID);
@ -200,7 +200,7 @@ auto findRole(ConfigurationInterface const* configuration, std::string base, int
if (ID < 1)
{
auto stub = configuration->property(role + impl_prop, ""s);
if (stub.empty()) role = base; // legacy format
if (stub.empty()) { role = base; } // NOLINT -- legacy format
}
return role;
};

View File

@ -110,7 +110,7 @@ void GNSSFlowgraph::init()
auto& src = sig_source_.back();
auto RF_Channels = src->getRfChannels();
std::cout << "RF Channels " << RF_Channels << '\n';
for (auto j = 0u; j < RF_Channels; ++j)
for (auto j = 0U; j < RF_Channels; ++j)
{
sig_conditioner_.push_back(block_factory->GetSignalConditioner(configuration_.get(), signal_conditioner_ID));
signal_conditioner_ID++;
@ -1022,7 +1022,7 @@ int GNSSFlowgraph::connect_signal_sources_to_signal_conditioners()
{
auto RF_Channels = src->getRfChannels();
for (auto j = 0u; j < RF_Channels; ++j)
for (auto j = 0U; j < RF_Channels; ++j)
{
// Connect the multichannel signal source to multiple signal conditioners
// GNURADIO max_streams=-1 means infinite ports!
@ -1117,7 +1117,7 @@ int GNSSFlowgraph::disconnect_signal_sources_from_signal_conditioners()
{
auto RF_Channels = src->getRfChannels();
for (auto j = 0u; j < RF_Channels; ++j)
for (auto j = 0U; j < RF_Channels; ++j)
{
if (src->get_right_block()->output_signature()->max_streams() > 1 or src->get_right_block()->output_signature()->max_streams() == -1)
{