diff options
Diffstat (limited to 'src/lib/netlist/plib')
-rw-r--r-- | src/lib/netlist/plib/palloc.h | 4 | ||||
-rw-r--r-- | src/lib/netlist/plib/pmath.h | 4 | ||||
-rw-r--r-- | src/lib/netlist/plib/ppreprocessor.cpp | 59 | ||||
-rw-r--r-- | src/lib/netlist/plib/pstring.cpp | 4 | ||||
-rw-r--r-- | src/lib/netlist/plib/pstring.h | 4 | ||||
-rw-r--r-- | src/lib/netlist/plib/ptokenizer.cpp | 2 |
6 files changed, 45 insertions, 32 deletions
diff --git a/src/lib/netlist/plib/palloc.h b/src/lib/netlist/plib/palloc.h index c1269e3752c..035fbdb749d 100644 --- a/src/lib/netlist/plib/palloc.h +++ b/src/lib/netlist/plib/palloc.h @@ -367,8 +367,8 @@ namespace plib { return true; } - size_type cur_alloc() const noexcept { return m_stat_cur_alloc(); } - size_type max_alloc() const noexcept { return m_stat_max_alloc(); } + size_type cur_alloc() const noexcept { return m_stat_cur_alloc(); } // NOLINT(readability-convert-member-functions-to-static) + size_type max_alloc() const noexcept { return m_stat_max_alloc(); } // NOLINT(readability-convert-member-functions-to-static) private: static size_t &m_stat_cur_alloc() noexcept { static size_t val = 0; return val; } static size_t &m_stat_max_alloc() noexcept { static size_t val = 0; return val; } diff --git a/src/lib/netlist/plib/pmath.h b/src/lib/netlist/plib/pmath.h index 4fd928ddb54..e995c3a6c27 100644 --- a/src/lib/netlist/plib/pmath.h +++ b/src/lib/netlist/plib/pmath.h @@ -76,7 +76,7 @@ namespace plib /// later. /// template <typename V> - static inline constexpr const T magic(V &&v) noexcept { return static_cast<T>(v); } + static inline constexpr T magic(V &&v) noexcept { return static_cast<T>(v); } }; /// \brief typesafe reciprocal function @@ -415,7 +415,7 @@ namespace plib return (m != 0 && n != 0) ? (plib::abs(m) / gcd(m, n)) * plib::abs(n) : 0; } - static_assert(noexcept(constants<double>::one()) == true, "Not evaluated as constexpr"); + static_assert(noexcept(constants<double>::one()), "Not evaluated as constexpr"); } // namespace plib diff --git a/src/lib/netlist/plib/ppreprocessor.cpp b/src/lib/netlist/plib/ppreprocessor.cpp index f98a57cb921..e2058a5b5ad 100644 --- a/src/lib/netlist/plib/ppreprocessor.cpp +++ b/src/lib/netlist/plib/ppreprocessor.cpp @@ -56,7 +56,7 @@ namespace plib { pstring e = plib::pfmt("{1}:{2}:0: error: {3}\n") (m_stack.back().m_name, m_stack.back().m_lineno, err); m_stack.pop_back(); - while (m_stack.size() > 0) + while (!m_stack.empty()) { if (m_stack.size() == 1) trail = trail_first; @@ -236,38 +236,51 @@ namespace plib { tmpret.push_back(s); } else - if (!remove_ws || (tmp[pi] != " " && tmp[pi] != "\t")) - tmpret.push_back(tmp[pi]); + { + pstring tok=tmp[pi]; + if (tok.size() >= 2 && pi < tmp.size() - 2 ) + { + auto sc=tok.substr(0,1); + auto ec=tok.substr(tok.size()-1, 1); + if ((sc == "." || (sc>="0" && sc<="9")) && (ec=="e" || ec=="E")) + { + // looks like an incomplete float due splitting by - or + + tok = tok + tmp[pi+1] + tmp[pi+2]; + pi += 2; + } + } + if (!remove_ws || (tok != " " && tok != "\t")) + tmpret.push_back(tok); + } pi++; } + if (!concat) return tmpret; - else + + // FIXME: error if concat at beginning or end + string_list ret; + pi = 0; + while (pi<tmpret.size()) { - // FIXME: error if concat at beginning or end - string_list ret; - pi = 0; - while (pi<tmpret.size()) + if (tmpret[pi] == "##") { - if (tmpret[pi] == "##") - { - while (ret.back() == " " || ret.back() == "\t") - ret.pop_back(); - pstring cc = ret.back(); + while (ret.back() == " " || ret.back() == "\t") ret.pop_back(); - pi++; - while (pi < tmpret.size() && (tmpret[pi] == " " || tmpret[pi] == "\t")) - pi++; - if (pi == tmpret.size()) - error("## found at end of sequence"); - ret.push_back(cc + tmpret[pi]); - } - else - ret.push_back(tmpret[pi]); + pstring cc = ret.back(); + ret.pop_back(); pi++; + while (pi < tmpret.size() && (tmpret[pi] == " " || tmpret[pi] == "\t")) + pi++; + if (pi == tmpret.size()) + error("## found at end of sequence"); + ret.push_back(cc + tmpret[pi]); } - return ret; + else + ret.push_back(tmpret[pi]); + pi++; } + return ret; } bool ppreprocessor::is_valid_token(const pstring &str) diff --git a/src/lib/netlist/plib/pstring.cpp b/src/lib/netlist/plib/pstring.cpp index ba09f342838..a7b18cd7e17 100644 --- a/src/lib/netlist/plib/pstring.cpp +++ b/src/lib/netlist/plib/pstring.cpp @@ -29,9 +29,9 @@ int pstring_t<F>::compare(const pstring_t &right) const noexcept if (si != this->end() && ri != right.end()) return static_cast<int>(*si) - static_cast<int>(*ri); - else if (this->mem_t_size() > right.mem_t_size()) + if (this->mem_t_size() > right.mem_t_size()) return 1; - else if (this->mem_t_size() < right.mem_t_size()) + if (this->mem_t_size() < right.mem_t_size()) return -1; return 0; } diff --git a/src/lib/netlist/plib/pstring.h b/src/lib/netlist/plib/pstring.h index 29f8fe2e6da..86b041cadaf 100644 --- a/src/lib/netlist/plib/pstring.h +++ b/src/lib/netlist/plib/pstring.h @@ -186,8 +186,8 @@ public: pstring_t& operator+=(const pstring_t &string) { m_str.append(string.m_str); return *this; } pstring_t& operator+=(const code_t c) { traits_type::encode(c, m_str); return *this; } friend pstring_t operator+(const pstring_t &lhs, const pstring_t &rhs) { return pstring_t(lhs) += rhs; } - friend pstring_t operator+(const pstring_t &lhs, const code_t rhs) { return pstring_t(lhs) += rhs; } - friend pstring_t operator+(const code_t lhs, const pstring_t &rhs) { return pstring_t(1, lhs) += rhs; } + friend pstring_t operator+(const pstring_t &lhs, code_t rhs) { return pstring_t(lhs) += rhs; } + friend pstring_t operator+(code_t lhs, const pstring_t &rhs) { return pstring_t(1, lhs) += rhs; } // comparison operators bool operator==(const pstring_t &string) const noexcept { return (compare(string) == 0); } diff --git a/src/lib/netlist/plib/ptokenizer.cpp b/src/lib/netlist/plib/ptokenizer.cpp index a29b3342333..7ccb0ff8ca2 100644 --- a/src/lib/netlist/plib/ptokenizer.cpp +++ b/src/lib/netlist/plib/ptokenizer.cpp @@ -292,7 +292,7 @@ namespace plib { pstring e = plib::pfmt("{1}:{2}:0: error: {3}\n") (m_source_location.back().file_name(), m_source_location.back().line(), errs()); m_source_location.pop_back(); - while (m_source_location.size() > 0) + while (!m_source_location.empty()) { if (m_source_location.size() == 1) trail = trail_first; |