Enable the -Wconversion warning

This commit is contained in:
Alex Beregszaszi
2020-12-08 16:45:24 +00:00
parent 71a4a4efb1
commit 7e88ba8da0
56 changed files with 171 additions and 176 deletions
+3 -3
View File
@@ -156,14 +156,14 @@ private:
static std::string literalTokenKind(Token _token);
static std::string type(Expression const& _expression);
static std::string type(VariableDeclaration const& _varDecl);
static int nodeId(ASTNode const& _node)
static int64_t nodeId(ASTNode const& _node)
{
return _node.id();
}
template<class Container>
static Json::Value getContainerIds(Container const& _container, bool _order = false)
{
std::vector<int> tmp;
std::vector<int64_t> tmp;
for (auto const& element: _container)
{
@@ -174,7 +174,7 @@ private:
std::sort(tmp.begin(), tmp.end());
Json::Value json(Json::arrayValue);
for (int val: tmp)
for (int64_t val: tmp)
json.append(val);
return json;
+1 -1
View File
@@ -368,7 +368,7 @@ RationalNumberType const* TypeProvider::rationalNumber(Literal const& _literal)
{
size_t const digitCount = _literal.valueWithoutUnderscores().length() - 2;
if (digitCount % 2 == 0 && (digitCount / 2) <= 32)
compatibleBytesType = fixedBytes(digitCount / 2);
compatibleBytesType = fixedBytes(static_cast<unsigned>(digitCount / 2));
}
return rationalNumber(std::get<1>(validLiteral), compatibleBytesType);
+1 -1
View File
@@ -811,7 +811,7 @@ tuple<bool, rational> RationalNumberType::parseRational(string const& _value)
denominator = bigint(string(fractionalBegin, _value.end()));
denominator /= boost::multiprecision::pow(
bigint(10),
static_cast<size_t>(distance(radixPoint + 1, _value.end()))
static_cast<unsigned>(distance(radixPoint + 1, _value.end()))
);
numerator = bigint(string(_value.begin(), radixPoint));
value = numerator + denominator;
+2 -1
View File
@@ -294,6 +294,7 @@ public:
return *m_stackItems;
}
/// Total number of stack slots occupied by this type. This is the sum of ``sizeOnStack`` of all ``stackItems()``.
// TODO: consider changing the return type to be size_t
unsigned sizeOnStack() const
{
if (!m_stackSize)
@@ -306,7 +307,7 @@ public:
++sizeOnStack;
m_stackSize = sizeOnStack;
}
return *m_stackSize;
return static_cast<unsigned>(*m_stackSize);
}
/// If it is possible to initialize such a value in memory by just writing zeros
/// of the size memoryHeadSize().