aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-10-10 17:43:42 +0800
committerGitHub <noreply@github.com>2018-10-10 17:43:42 +0800
commit06200b4b64c911ea2e0b12076e0fa02093dacbf8 (patch)
tree5465e3be065998e506145d8e7272cc783d185427
parentf6f0cecc2f64f4fcda3da467bbe306b5859729aa (diff)
parent6c3d12d85bc7977817e8dc1c5bd0af4b29406b58 (diff)
downloaddexon-solidity-06200b4b64c911ea2e0b12076e0fa02093dacbf8.tar.gz
dexon-solidity-06200b4b64c911ea2e0b12076e0fa02093dacbf8.tar.zst
dexon-solidity-06200b4b64c911ea2e0b12076e0fa02093dacbf8.zip
Merge pull request #5180 from ethereum/cpp-cleanup
Some C++ cleanup
-rw-r--r--libdevcore/CommonIO.cpp1
-rw-r--r--libsolidity/analysis/SyntaxChecker.cpp2
-rw-r--r--libsolidity/analysis/TypeChecker.cpp2
-rw-r--r--libsolidity/codegen/ContractCompiler.cpp2
-rw-r--r--libsolidity/formal/SMTChecker.cpp2
-rw-r--r--libsolidity/inlineasm/AsmParser.cpp4
-rw-r--r--libsolidity/interface/CompilerStack.cpp2
-rw-r--r--libsolidity/interface/StandardCompiler.cpp2
-rw-r--r--libsolidity/parsing/Parser.cpp4
-rw-r--r--test/libsolidity/ASTJSONTest.cpp1
-rw-r--r--test/libsolidity/LibSolc.cpp4
-rw-r--r--test/libsolidity/SyntaxTest.cpp1
-rw-r--r--test/tools/fuzzer.cpp2
13 files changed, 13 insertions, 16 deletions
diff --git a/libdevcore/CommonIO.cpp b/libdevcore/CommonIO.cpp
index 9693d02a..2005d087 100644
--- a/libdevcore/CommonIO.cpp
+++ b/libdevcore/CommonIO.cpp
@@ -23,7 +23,6 @@
#include <iostream>
#include <cstdlib>
#include <fstream>
-#include <stdio.h>
#if defined(_WIN32)
#include <windows.h>
#else
diff --git a/libsolidity/analysis/SyntaxChecker.cpp b/libsolidity/analysis/SyntaxChecker.cpp
index d40a00d4..ab544388 100644
--- a/libsolidity/analysis/SyntaxChecker.cpp
+++ b/libsolidity/analysis/SyntaxChecker.cpp
@@ -76,7 +76,7 @@ bool SyntaxChecker::visit(PragmaDirective const& _pragma)
{
solAssert(m_sourceUnit, "");
vector<string> literals(_pragma.literals().begin() + 1, _pragma.literals().end());
- if (literals.size() == 0)
+ if (literals.empty())
m_errorReporter.syntaxError(
_pragma.location(),
"Experimental feature name is missing."
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index bc040623..39ea494d 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -2123,7 +2123,7 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess)
auto& annotation = _memberAccess.annotation();
- if (possibleMembers.size() == 0)
+ if (possibleMembers.empty())
{
if (initialMemberCount == 0)
{
diff --git a/libsolidity/codegen/ContractCompiler.cpp b/libsolidity/codegen/ContractCompiler.cpp
index e26bc13a..3a0fccfb 100644
--- a/libsolidity/codegen/ContractCompiler.cpp
+++ b/libsolidity/codegen/ContractCompiler.cpp
@@ -965,7 +965,7 @@ void ContractCompiler::popScopedVariables(ASTNode const* _node)
unsigned stackDiff = m_context.stackHeight() - blockHeight;
CompilerUtils(m_context).popStackSlots(stackDiff);
m_scopeStackHeight[m_modifierDepth].erase(_node);
- if (m_scopeStackHeight[m_modifierDepth].size() == 0)
+ if (m_scopeStackHeight[m_modifierDepth].empty())
m_scopeStackHeight.erase(m_modifierDepth);
}
diff --git a/libsolidity/formal/SMTChecker.cpp b/libsolidity/formal/SMTChecker.cpp
index 19785817..a7973852 100644
--- a/libsolidity/formal/SMTChecker.cpp
+++ b/libsolidity/formal/SMTChecker.cpp
@@ -894,7 +894,7 @@ void SMTChecker::pushPathCondition(smt::Expression const& _e)
smt::Expression SMTChecker::currentPathConditions()
{
- if (m_pathConditions.size() == 0)
+ if (m_pathConditions.empty())
return smt::Expression(true);
return m_pathConditions.back();
}
diff --git a/libsolidity/inlineasm/AsmParser.cpp b/libsolidity/inlineasm/AsmParser.cpp
index f34bbffe..54cdc1c6 100644
--- a/libsolidity/inlineasm/AsmParser.cpp
+++ b/libsolidity/inlineasm/AsmParser.cpp
@@ -26,7 +26,7 @@
#include <boost/algorithm/string.hpp>
-#include <ctype.h>
+#include <cctype>
#include <algorithm>
using namespace std;
@@ -97,7 +97,7 @@ assembly::Statement Parser::parseStatement()
fatalParserError("Only one default case allowed.");
else if (m_scanner->currentToken() == Token::Case)
fatalParserError("Case not allowed after default case.");
- if (_switch.cases.size() == 0)
+ if (_switch.cases.empty())
fatalParserError("Switch statement without any cases.");
_switch.location.end = _switch.cases.back().body.location.end;
return _switch;
diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp
index d1001c80..1f58245f 100644
--- a/libsolidity/interface/CompilerStack.cpp
+++ b/libsolidity/interface/CompilerStack.cpp
@@ -780,7 +780,7 @@ CompilerStack::Contract const& CompilerStack::contract(string const& _contractNa
// To provide a measure of backward-compatibility, if a contract is not located by its
// fully-qualified name, a lookup will be attempted purely on the contract's name to see
// if anything will satisfy.
- if (_contractName.find(":") == string::npos)
+ if (_contractName.find(':') == string::npos)
{
for (auto const& contractEntry: m_contracts)
{
diff --git a/libsolidity/interface/StandardCompiler.cpp b/libsolidity/interface/StandardCompiler.cpp
index 2305da13..8300e8db 100644
--- a/libsolidity/interface/StandardCompiler.cpp
+++ b/libsolidity/interface/StandardCompiler.cpp
@@ -509,7 +509,7 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input)
bool const compilationSuccess = m_compilerStack.state() == CompilerStack::State::CompilationSuccessful;
/// Inconsistent state - stop here to receive error reports from users
- if (!compilationSuccess && (errors.size() == 0))
+ if (!compilationSuccess && errors.empty())
return formatFatalError("InternalCompilerError", "No error reported, but compilation failed.");
Json::Value output = Json::objectValue;
diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp
index b390459a..ca9a9b57 100644
--- a/libsolidity/parsing/Parser.cpp
+++ b/libsolidity/parsing/Parser.cpp
@@ -20,7 +20,7 @@
* Solidity parser.
*/
-#include <ctype.h>
+#include <cctype>
#include <vector>
#include <libevmasm/SourceLocation.h>
#include <libsolidity/parsing/Parser.h>
@@ -554,7 +554,7 @@ ASTPointer<EnumDefinition> Parser::parseEnumDefinition()
if (m_scanner->currentToken() != Token::Identifier)
fatalParserError(string("Expected identifier after ','"));
}
- if (members.size() == 0)
+ if (members.empty())
parserError({"enum with no members is not allowed."});
nodeFactory.markEndPosition();
diff --git a/test/libsolidity/ASTJSONTest.cpp b/test/libsolidity/ASTJSONTest.cpp
index 05839c1f..be482d99 100644
--- a/test/libsolidity/ASTJSONTest.cpp
+++ b/test/libsolidity/ASTJSONTest.cpp
@@ -22,7 +22,6 @@
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/throw_exception.hpp>
-#include <cctype>
#include <fstream>
#include <memory>
#include <stdexcept>
diff --git a/test/libsolidity/LibSolc.cpp b/test/libsolidity/LibSolc.cpp
index 61e5ebba..94fed7e8 100644
--- a/test/libsolidity/LibSolc.cpp
+++ b/test/libsolidity/LibSolc.cpp
@@ -52,7 +52,7 @@ Json::Value compileMulti(string const& _input, bool _callback)
{
string output(
_callback ?
- compileJSONCallback(_input.c_str(), dev::test::Options::get().optimize, NULL) :
+ compileJSONCallback(_input.c_str(), dev::test::Options::get().optimize, nullptr) :
compileJSONMulti(_input.c_str(), dev::test::Options::get().optimize)
);
Json::Value ret;
@@ -62,7 +62,7 @@ Json::Value compileMulti(string const& _input, bool _callback)
Json::Value compile(string const& _input)
{
- string output(compileStandard(_input.c_str(), NULL));
+ string output(compileStandard(_input.c_str(), nullptr));
Json::Value ret;
BOOST_REQUIRE(jsonParseStrict(output, ret));
return ret;
diff --git a/test/libsolidity/SyntaxTest.cpp b/test/libsolidity/SyntaxTest.cpp
index 1de42300..91d1681f 100644
--- a/test/libsolidity/SyntaxTest.cpp
+++ b/test/libsolidity/SyntaxTest.cpp
@@ -20,7 +20,6 @@
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/throw_exception.hpp>
-#include <cctype>
#include <fstream>
#include <memory>
#include <stdexcept>
diff --git a/test/tools/fuzzer.cpp b/test/tools/fuzzer.cpp
index ce4b721f..f7b42b25 100644
--- a/test/tools/fuzzer.cpp
+++ b/test/tools/fuzzer.cpp
@@ -86,7 +86,7 @@ void testConstantOptimizer()
void runCompiler(string input)
{
- string outputString(compileStandard(input.c_str(), NULL));
+ string outputString(compileStandard(input.c_str(), nullptr));
Json::Value output;
if (!jsonParseStrict(outputString, output))
{