diff --git a/libdevcore/CommonData.h b/libdevcore/CommonData.h index adf9d70ce..ec3d014d9 100644 --- a/libdevcore/CommonData.h +++ b/libdevcore/CommonData.h @@ -240,7 +240,7 @@ bool contains(T const& _t, V const& _v) /// place at the end, but already visited elements might be invalidated. /// If nothing is replaced, no copy is performed. template -void iterateReplacing(std::vector& _vector, const F& _f) +void iterateReplacing(std::vector& _vector, F const& _f) { // Concept: _f must be Callable, must accept param T&, must return optional> bool useModified = false; diff --git a/liblangutil/ErrorReporter.cpp b/liblangutil/ErrorReporter.cpp index 5b6e0072f..fb01847d5 100644 --- a/liblangutil/ErrorReporter.cpp +++ b/liblangutil/ErrorReporter.cpp @@ -134,7 +134,7 @@ void ErrorReporter::clear() m_errorList.clear(); } -void ErrorReporter::declarationError(SourceLocation const& _location, SecondarySourceLocation const&_secondaryLocation, string const& _description) +void ErrorReporter::declarationError(SourceLocation const& _location, SecondarySourceLocation const& _secondaryLocation, string const& _description) { error( Error::Type::DeclarationError, diff --git a/liblangutil/Exceptions.cpp b/liblangutil/Exceptions.cpp index 346313d5e..4e68dfa5b 100644 --- a/liblangutil/Exceptions.cpp +++ b/liblangutil/Exceptions.cpp @@ -57,7 +57,7 @@ Error::Error(Type _type, SourceLocation const& _location, string const& _descrip *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) { if (!_location.isEmpty()) diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp index f8c8b3a88..e19e452ba 100644 --- a/libsolidity/codegen/CompilerUtils.cpp +++ b/libsolidity/codegen/CompilerUtils.cpp @@ -653,7 +653,7 @@ void CompilerUtils::convertType( bool chopSignBitsPending = _chopSignBits && targetTypeCategory == Type::Category::Integer; if (chopSignBitsPending) { - const IntegerType& targetIntegerType = dynamic_cast(_targetType); + const IntegerType& targetIntegerType = dynamic_cast(_targetType); chopSignBitsPending = targetIntegerType.isSigned(); } diff --git a/libsolidity/codegen/ContractCompiler.cpp b/libsolidity/codegen/ContractCompiler.cpp index c3e37f4d2..31342816c 100644 --- a/libsolidity/codegen/ContractCompiler.cpp +++ b/libsolidity/codegen/ContractCompiler.cpp @@ -355,7 +355,7 @@ bool hasPayableFunctions(ContractDefinition const& _contract) void ContractCompiler::appendFunctionSelector(ContractDefinition const& _contract) { map, FunctionTypePointer> interfaceFunctions = _contract.interfaceFunctions(); - map, const eth::AssemblyItem> callDataUnpackerEntryPoints; + map, eth::AssemblyItem const> callDataUnpackerEntryPoints; if (_contract.isLibrary()) { diff --git a/libsolidity/codegen/LValue.cpp b/libsolidity/codegen/LValue.cpp index 70dbee812..d3fe4e439 100644 --- a/libsolidity/codegen/LValue.cpp +++ b/libsolidity/codegen/LValue.cpp @@ -473,7 +473,7 @@ void StorageByteArrayElement::setToZero(SourceLocation const&, bool _removeRefer 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()), m_arrayType(_arrayType) { diff --git a/libsolidity/formal/SymbolicVariables.cpp b/libsolidity/formal/SymbolicVariables.cpp index c4fc81da8..57921558c 100644 --- a/libsolidity/formal/SymbolicVariables.cpp +++ b/libsolidity/formal/SymbolicVariables.cpp @@ -65,7 +65,7 @@ smt::Expression SymbolicVariable::increaseIndex() SymbolicBoolVariable::SymbolicBoolVariable( TypePointer _type, string const& _uniqueName, - smt::SolverInterface&_interface + smt::SolverInterface& _interface ): SymbolicVariable(move(_type), _uniqueName, _interface) { @@ -102,7 +102,7 @@ SymbolicFixedBytesVariable::SymbolicFixedBytesVariable( SymbolicFunctionVariable::SymbolicFunctionVariable( TypePointer _type, string const& _uniqueName, - smt::SolverInterface&_interface + smt::SolverInterface& _interface ): SymbolicVariable(move(_type), _uniqueName, _interface), m_declaration(m_interface.newVariable(currentName(), smtSort(*m_type))) diff --git a/libsolidity/interface/Natspec.cpp b/libsolidity/interface/Natspec.cpp index 27aa07388..e28d8703e 100644 --- a/libsolidity/interface/Natspec.cpp +++ b/libsolidity/interface/Natspec.cpp @@ -118,7 +118,7 @@ string Natspec::extractDoc(multimap const& _tags, string const& return value; } -Json::Value Natspec::devDocumentation(std::multimap const &_tags) +Json::Value Natspec::devDocumentation(std::multimap const& _tags) { Json::Value json(Json::objectValue); auto dev = extractDoc(_tags, "dev"); diff --git a/libsolidity/interface/Natspec.h b/libsolidity/interface/Natspec.h index fbaa6d4da..7a0c40a1a 100644 --- a/libsolidity/interface/Natspec.h +++ b/libsolidity/interface/Natspec.h @@ -59,7 +59,7 @@ private: /// @param _tags docTags that are used. /// @return A JSON representation /// of the contract's developer documentation - static Json::Value devDocumentation(std::multimap const &_tags); + static Json::Value devDocumentation(std::multimap const& _tags); }; } //solidity NS diff --git a/libyul/optimiser/StructuralSimplifier.h b/libyul/optimiser/StructuralSimplifier.h index d68a96206..111c7fdc7 100644 --- a/libyul/optimiser/StructuralSimplifier.h +++ b/libyul/optimiser/StructuralSimplifier.h @@ -44,8 +44,8 @@ public: void operator()(Block& _block) override; private: void simplify(std::vector& _statements); - bool expressionAlwaysTrue(Expression const &_expression); - bool expressionAlwaysFalse(Expression const &_expression); + bool expressionAlwaysTrue(Expression const& _expression); + bool expressionAlwaysFalse(Expression const& _expression); }; } diff --git a/scripts/check_style.sh b/scripts/check_style.sh index 09d5825ee..f24f79973 100755 --- a/scripts/check_style.sh +++ b/scripts/check_style.sh @@ -19,8 +19,11 @@ FORMATERROR=$( ( git grep -nIE "\<(if|for)\(" -- '*.h' '*.cpp' # no space after "if" or "for" git grep -nIE "\\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 "[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/" )