netlist: clang tidy. (nw)
This commit is contained in:
parent
20551e42a7
commit
2b49e6ed11
@ -19,21 +19,16 @@ TIDY_FLAGSX += -llvm-header-guard,-cppcoreguidelines-pro-type-reinterpret-cast,
|
||||
TIDY_FLAGSX += -cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-owning-memory,
|
||||
TIDY_FLAGSX += -modernize-use-default-member-init,-cppcoreguidelines-pro-bounds-constant-array-index,
|
||||
TIDY_FLAGSX += -modernize-pass-by-value,-cppcoreguidelines-pro-type-static-cast-downcast,
|
||||
#TIDY_FLAGSX += -cppcoreguidelines-special-member-functions,
|
||||
#TIDY_FLAGSX += -cppcoreguidelines-pro-bounds-array-to-pointer-decay,
|
||||
TIDY_FLAGSX += performance-unnecessary-value-param,-cppcoreguidelines-avoid-magic-numbers,
|
||||
TIDY_FLAGSX += -cppcoreguidelines-avoid-magic-numbers,
|
||||
TIDY_FLAGSX += -cppcoreguidelines-macro-usage,
|
||||
TIDY_FLAGSX += -cppcoreguidelines-non-private-member-variables-in-classes,-misc-non-private-member-variables-in-classes,
|
||||
#TIDY_FLAGSX += -cppcoreguidelines-avoid-c-arrays,-modernize-avoid-c-arrays,
|
||||
#TIDY_FLAGSX += -modernize-use-using,
|
||||
TIDY_FLAGSX += performance-unnecessary-copy-initialization,
|
||||
TIDY_FLAGSX += -bugprone-macro-parentheses,-misc-macro-parentheses
|
||||
|
||||
space :=
|
||||
space +=
|
||||
TIDY_FLAGS = $(subst $(space),,$(TIDY_FLAGSX))
|
||||
|
||||
TIDY_FLAGS = -checks=llvm-include-order,llvm-namespace-comment,modernize-use-override,modernize-use-using -fix
|
||||
#TIDY_FLAGS = -checks=llvm-include-order,llvm-namespace-comment,modernize-use-override,modernize-use-using -fix
|
||||
#TIDY_FLAGS = -checks=llvm-include-order -fix
|
||||
#TIDY_FLAGS = -checks=llvm-namespace-comment -fix
|
||||
#TIDY_FLAGS = -checks=modernize-use-override -fix
|
||||
|
@ -381,7 +381,7 @@ pstring ppreprocessor::replace_macros(const pstring &line)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static pstring catremainder(const std::vector<pstring> &elems, std::size_t start, pstring sep)
|
||||
static pstring catremainder(const std::vector<pstring> &elems, std::size_t start, const pstring &sep)
|
||||
{
|
||||
pstring ret("");
|
||||
for (std::size_t i = start; i < elems.size(); i++)
|
||||
|
@ -23,12 +23,14 @@
|
||||
class wav_t
|
||||
{
|
||||
public:
|
||||
// FIXME: Initialized in intialize, need better c++ compliance
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init)
|
||||
// XXNOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init)
|
||||
wav_t(plib::postream &strm, std::size_t sr, std::size_t channels)
|
||||
: m_f(strm)
|
||||
/* force "play" to play and warn about eof instead of being silent */
|
||||
, m_fmt(static_cast<std::uint16_t>(channels), static_cast<std::uint32_t>(sr))
|
||||
, m_data(m_f.seekable() ? 0 : 0xffffffff)
|
||||
{
|
||||
initialize(sr, channels);
|
||||
|
||||
write(m_fh);
|
||||
write(m_fmt);
|
||||
write(m_data);
|
||||
@ -72,56 +74,44 @@ public:
|
||||
private:
|
||||
struct riff_chunk_t
|
||||
{
|
||||
uint8_t group_id[4];
|
||||
uint32_t filelen;
|
||||
uint8_t rifftype[4];
|
||||
uint8_t group_id[4] = {'R','I','F','F'};
|
||||
uint32_t filelen = 0;
|
||||
uint8_t rifftype[4] = {'W','A','V','E'};
|
||||
};
|
||||
|
||||
struct riff_format_t
|
||||
{
|
||||
uint8_t signature[4];
|
||||
uint32_t fmt_length;
|
||||
uint16_t format_tag;
|
||||
riff_format_t(uint16_t achannels, uint32_t asample_rate)
|
||||
{
|
||||
channels = achannels;
|
||||
sample_rate = asample_rate;
|
||||
block_align = channels * ((bits_sample + 7) / 8);
|
||||
bytes_per_second = sample_rate * block_align;
|
||||
}
|
||||
uint8_t signature[4] = {'f','m','t',' '};
|
||||
uint32_t fmt_length = 16;
|
||||
uint16_t format_tag = 0x0001; // PCM
|
||||
uint16_t channels;
|
||||
uint32_t sample_rate;
|
||||
uint32_t bytes_per_second;
|
||||
uint16_t block_align;
|
||||
uint16_t bits_sample;
|
||||
uint16_t bits_sample = 16;
|
||||
};
|
||||
|
||||
struct riff_data_t
|
||||
{
|
||||
uint8_t signature[4];
|
||||
riff_data_t(uint32_t alen) : len(alen) {}
|
||||
uint8_t signature[4] = {'d','a','t','a'};
|
||||
uint32_t len;
|
||||
// data follows
|
||||
};
|
||||
|
||||
void initialize(std::size_t sr, std::size_t channels)
|
||||
{
|
||||
std::memcpy(m_fh.group_id, "RIFF", 4);
|
||||
m_fh.filelen = 0x0; // Fixme
|
||||
std::memcpy(m_fh.rifftype, "WAVE", 4);
|
||||
|
||||
std::memcpy(m_fmt.signature, "fmt ", 4);
|
||||
m_fmt.fmt_length = 16;
|
||||
m_fmt.format_tag = 0x0001; //PCM
|
||||
m_fmt.channels = static_cast<std::uint16_t>(channels);
|
||||
m_fmt.sample_rate = static_cast<std::uint32_t>(sr);
|
||||
m_fmt.bits_sample = 16;
|
||||
m_fmt.block_align = m_fmt.channels * ((m_fmt.bits_sample + 7) / 8);
|
||||
m_fmt.bytes_per_second = m_fmt.sample_rate * m_fmt.block_align;
|
||||
|
||||
std::memcpy(m_data.signature, "data", 4);
|
||||
//m_data.len = m_fmt.bytes_per_second * 2 * 0;
|
||||
/* force "play" to play and warn about eof instead of being silent */
|
||||
m_data.len = (m_f.seekable() ? 0 : 0xffffffff);
|
||||
}
|
||||
plib::postream &m_f;
|
||||
|
||||
riff_chunk_t m_fh;
|
||||
riff_format_t m_fmt;
|
||||
riff_data_t m_data;
|
||||
|
||||
plib::postream &m_f;
|
||||
};
|
||||
|
||||
class log_processor
|
||||
@ -304,7 +294,7 @@ public:
|
||||
ANALOG
|
||||
};
|
||||
|
||||
vcdwriter(plib::postream &fo, std::vector<pstring> channels,
|
||||
vcdwriter(plib::postream &fo, const std::vector<pstring> &channels,
|
||||
format_e format, double high_level = 2.0, double low_level = 1.0)
|
||||
: m_channels(channels.size())
|
||||
, m_last_time(0)
|
||||
|
@ -59,8 +59,8 @@ private:
|
||||
struct net_t
|
||||
{
|
||||
public:
|
||||
explicit net_t(const pstring &aname)
|
||||
: m_name(aname), m_no_export(false) {}
|
||||
explicit net_t(pstring aname)
|
||||
: m_name(std::move(aname)), m_no_export(false) {}
|
||||
|
||||
const pstring &name() { return m_name;}
|
||||
std::vector<pstring> &terminals() { return m_terminals; }
|
||||
@ -76,16 +76,28 @@ private:
|
||||
struct dev_t
|
||||
{
|
||||
public:
|
||||
dev_t(const pstring &atype, const pstring &aname, const pstring &amodel)
|
||||
: m_type(atype), m_name(aname), m_model(amodel), m_val(0), m_has_val(false)
|
||||
dev_t(pstring atype, pstring aname, pstring amodel)
|
||||
: m_type(std::move(atype))
|
||||
, m_name(std::move(aname))
|
||||
, m_model(std::move(amodel))
|
||||
, m_val(0)
|
||||
, m_has_val(false)
|
||||
{}
|
||||
|
||||
dev_t(const pstring &atype, const pstring &aname, double aval)
|
||||
: m_type(atype), m_name(aname), m_model(""), m_val(aval), m_has_val(true)
|
||||
dev_t(pstring atype, pstring aname, double aval)
|
||||
: m_type(std::move(atype))
|
||||
, m_name(std::move(aname))
|
||||
, m_model("")
|
||||
, m_val(aval)
|
||||
, m_has_val(true)
|
||||
{}
|
||||
|
||||
dev_t(const pstring &atype, const pstring &aname)
|
||||
: m_type(atype), m_name(aname), m_model(""), m_val(0.0), m_has_val(false)
|
||||
dev_t(pstring atype, pstring aname)
|
||||
: m_type(std::move(atype))
|
||||
, m_name(std::move(aname))
|
||||
, m_model("")
|
||||
, m_val(0.0)
|
||||
, m_has_val(false)
|
||||
{}
|
||||
|
||||
const pstring &name() { return m_name;}
|
||||
@ -113,8 +125,8 @@ private:
|
||||
struct pin_alias_t
|
||||
{
|
||||
public:
|
||||
pin_alias_t(const pstring &name, const pstring &alias)
|
||||
: m_name(name), m_alias(alias)
|
||||
pin_alias_t(pstring name, pstring alias)
|
||||
: m_name(std::move(name)), m_alias(std::move(alias))
|
||||
{}
|
||||
const pstring &name() { return m_name; }
|
||||
const pstring &alias() { return m_alias; }
|
||||
|
Loading…
Reference in New Issue
Block a user