More style checks.

This commit is contained in:
Daniel Kirchner 2019-02-14 11:37:24 +01:00
parent f003696d7e
commit 8ca6715e18
11 changed files with 16 additions and 13 deletions

View File

@ -240,7 +240,7 @@ bool contains(T const& _t, V const& _v)
/// place at the end, but already visited elements might be invalidated. /// place at the end, but already visited elements might be invalidated.
/// If nothing is replaced, no copy is performed. /// If nothing is replaced, no copy is performed.
template <typename T, typename F> template <typename T, typename F>
void iterateReplacing(std::vector<T>& _vector, const F& _f) void iterateReplacing(std::vector<T>& _vector, F const& _f)
{ {
// Concept: _f must be Callable, must accept param T&, must return optional<vector<T>> // Concept: _f must be Callable, must accept param T&, must return optional<vector<T>>
bool useModified = false; bool useModified = false;

View File

@ -57,7 +57,7 @@ Error::Error(Type _type, SourceLocation const& _location, string const& _descrip
*this << errinfo_comment(_description); *this << errinfo_comment(_description);
} }
Error::Error(Error::Type _type, const std::string& _description, const SourceLocation& _location): Error::Error(Error::Type _type, std::string const& _description, SourceLocation const& _location):
Error(_type) Error(_type)
{ {
if (!_location.isEmpty()) if (!_location.isEmpty())

View File

@ -653,7 +653,7 @@ void CompilerUtils::convertType(
bool chopSignBitsPending = _chopSignBits && targetTypeCategory == Type::Category::Integer; bool chopSignBitsPending = _chopSignBits && targetTypeCategory == Type::Category::Integer;
if (chopSignBitsPending) if (chopSignBitsPending)
{ {
const IntegerType& targetIntegerType = dynamic_cast<const IntegerType &>(_targetType); const IntegerType& targetIntegerType = dynamic_cast<IntegerType const&>(_targetType);
chopSignBitsPending = targetIntegerType.isSigned(); chopSignBitsPending = targetIntegerType.isSigned();
} }

View File

@ -355,7 +355,7 @@ bool hasPayableFunctions(ContractDefinition const& _contract)
void ContractCompiler::appendFunctionSelector(ContractDefinition const& _contract) void ContractCompiler::appendFunctionSelector(ContractDefinition const& _contract)
{ {
map<FixedHash<4>, FunctionTypePointer> interfaceFunctions = _contract.interfaceFunctions(); map<FixedHash<4>, FunctionTypePointer> interfaceFunctions = _contract.interfaceFunctions();
map<FixedHash<4>, const eth::AssemblyItem> callDataUnpackerEntryPoints; map<FixedHash<4>, eth::AssemblyItem const> callDataUnpackerEntryPoints;
if (_contract.isLibrary()) if (_contract.isLibrary())
{ {

View File

@ -473,7 +473,7 @@ void StorageByteArrayElement::setToZero(SourceLocation const&, bool _removeRefer
m_context << Instruction::SWAP1 << Instruction::SSTORE; m_context << Instruction::SWAP1 << Instruction::SSTORE;
} }
StorageArrayLength::StorageArrayLength(CompilerContext& _compilerContext, const ArrayType& _arrayType): StorageArrayLength::StorageArrayLength(CompilerContext& _compilerContext, ArrayType const& _arrayType):
LValue(_compilerContext, _arrayType.memberType("length").get()), LValue(_compilerContext, _arrayType.memberType("length").get()),
m_arrayType(_arrayType) m_arrayType(_arrayType)
{ {

View File

@ -19,8 +19,11 @@ FORMATERROR=$(
( (
git grep -nIE "\<(if|for)\(" -- '*.h' '*.cpp' # no space after "if" or "for" git grep -nIE "\<(if|for)\(" -- '*.h' '*.cpp' # no space after "if" or "for"
git grep -nIE "\<if\>\s*\(.*\)\s*\{\s*$" -- '*.h' '*.cpp' # "{\n" on same line as "if" / "for" git grep -nIE "\<if\>\s*\(.*\)\s*\{\s*$" -- '*.h' '*.cpp' # "{\n" on same line as "if" / "for"
git grep -nIE "\(const " -- '*.h' '*.cpp' # const on left side of type git grep -nIE "[,\(<]\s*const " -- '*.h' '*.cpp' # const on left side of type
git grep -nIE "^ [^*]|[^*] | [^*]" -- '*.h' '*.cpp' # uses spaces for indentation or mixes spaces and tabs git grep -nIE "^ [^*]|[^*] | [^*]" -- '*.h' '*.cpp' # uses spaces for indentation or mixes spaces and tabs
git grep -nIE "[a-zA-Z0-9_]\s*[&][a-zA-Z_]" -- '*.h' '*.cpp' | egrep -v "return [&]" # right-aligned reference ampersand (needs to exclude return)
# right-aligned reference pointer star (needs to exclude return and comments)
git grep -nIE "[a-zA-Z0-9_]\s*[*][a-zA-Z_]" -- '*.h' '*.cpp' | egrep -v "return [*]" | egrep -v "^* [*]" | egrep -v "^*//.*"
) | egrep -v "^[a-zA-Z\./]*:[0-9]*:\s*\/(\/|\*)" | egrep -v "^test/" ) | egrep -v "^[a-zA-Z\./]*:[0-9]*:\s*\/(\/|\*)" | egrep -v "^test/"
) )