Take care of warnings/errors created by cppcheck.
Summary: Warnings I ignored: Creates a new stacktrace object and then dumps it 102.570384 (102.495075) E[1]: [src/utils/exceptions.hpp:116]: (performance) Variable 'stacktrace_' is assigned in constructor body. Consider performing initialization in initialization list. 102.570390 (102.495081) E[1]: [src/utils/exceptions.hpp:127]: (performance) Variable 'stacktrace_' is assigned in constructor body. Consider performing initialization in initialization list. Used all over the codebase without explicit cast 102.570412 (102.495103) E[1]: [src/utils/stacktrace.hpp:14]: (style) Class 'Line' has a constructor with 1 argument that is not explicit. Not really used anywhere before initialized: 102.570526 (102.495217) E[1]: [src/data_structures/concurrent/skiplist.hpp:467]: (warning) Member variable 'Accessor::preds' is not initialized in the constructor. 102.570530 (102.495221) E[1]: [src/data_structures/concurrent/skiplist.hpp:467]: (warning) Member variable 'Accessor::succs' is not initialized in the constructor. Implicit conversions between types are used all over the codebase: 102.570548 (102.495239) E[1]: [src/storage/property_value.hpp:41]: (style) Class 'PropertyValue' has a constructor with 1 argument that is not explicit. 102.570552 (102.495243) E[1]: [src/storage/property_value.hpp:42]: (style) Class 'PropertyValue' has a constructor with 1 argument that is not explicit. 102.570557 (102.495248) E[1]: [src/storage/property_value.hpp:43]: (style) Class 'PropertyValue' has a constructor with 1 argument that is not explicit. 102.570561 (102.495252) E[1]: [src/storage/property_value.hpp:44]: (style) Class 'PropertyValue' has a constructor with 1 argument that is not explicit. 102.570566 (102.495257) E[1]: [src/storage/property_value.hpp:47]: (style) Class 'PropertyValue' has a constructor with 1 argument that is not explicit. 102.570570 (102.495261) E[1]: [src/storage/property_value.hpp:50]: (style) Class 'PropertyValue' has a constructor with 1 argument that is not explicit. 102.570578 (102.495269) E[1]: [src/storage/property_value.hpp:53]: (style) Class 'PropertyValue' has a constructor with 1 argument that is not explicit. 102.570582 (102.495273) E[1]: [src/storage/property_value.hpp:57]: (style) Class 'PropertyValue' has a constructor with 1 argument that is not explicit. 102.570591 (102.495282) E[1]: [src/query/typed_value.hpp:80]: (style) Class 'TypedValue' has a constructor with 1 argument that is not explicit. 102.570596 (102.495287) E[1]: [src/query/typed_value.hpp:81]: (style) Class 'TypedValue' has a constructor with 1 argument that is not explicit. 102.570601 (102.495292) E[1]: [src/query/typed_value.hpp:82]: (style) Class 'TypedValue' has a constructor with 1 argument that is not explicit. 102.570605 (102.495296) E[1]: [src/query/typed_value.hpp:83]: (style) Class 'TypedValue' has a constructor with 1 argument that is not explicit. 102.570609 (102.495300) E[1]: [src/query/typed_value.hpp:89]: (style) Class 'TypedValue' has a constructor with 1 argument that is not explicit. 102.570614 (102.495305) E[1]: [src/query/typed_value.hpp:92]: (style) Class 'TypedValue' has a constructor with 1 argument that is not explicit. 102.570618 (102.495309) E[1]: [src/query/typed_value.hpp:95]: (style) Class 'TypedValue' has a constructor with 1 argument that is not explicit. 102.570623 (102.495314) E[1]: [src/query/typed_value.hpp:98]: (style) Class 'TypedValue' has a constructor with 1 argument that is not explicit. 102.570627 (102.495318) E[1]: [src/query/typed_value.hpp:102]: (style) Class 'TypedValue' has a constructor with 1 argument that is not explicit. 102.570632 (102.495323) E[1]: [src/query/typed_value.hpp:105]: (style) Class 'TypedValue' has a constructor with 1 argument that is not explicit. 102.570636 (102.495327) E[1]: [src/query/typed_value.hpp:108]: (style) Class 'TypedValue' has a constructor with 1 argument that is not explicit. 102.570641 (102.495332) E[1]: [src/query/typed_value.hpp:109]: (style) Class 'TypedValue' has a constructor with 1 argument that is not explicit. 102.570645 (102.495336) E[1]: [src/communication/bolt/v1/decoder/decoded_value.hpp:88]: (style) Class 'DecodedValue' has a constructor with 1 argument that is not explicit. 102.570650 (102.495341) E[1]: [src/communication/bolt/v1/decoder/decoded_value.hpp:89]: (style) Class 'DecodedValue' has a constructor with 1 argument that is not explicit. 102.570654 (102.495345) E[1]: [src/communication/bolt/v1/decoder/decoded_value.hpp:90]: (style) Class 'DecodedValue' has a constructor with 1 argument that is not explicit. 102.570659 (102.495350) E[1]: [src/communication/bolt/v1/decoder/decoded_value.hpp:91]: (style) Class 'DecodedValue' has a constructor with 1 argument that is not explicit. 102.570663 (102.495354) E[1]: [src/communication/bolt/v1/decoder/decoded_value.hpp:94]: (style) Class 'DecodedValue' has a constructor with 1 argument that is not explicit. 102.570668 (102.495359) E[1]: [src/communication/bolt/v1/decoder/decoded_value.hpp:97]: (style) Class 'DecodedValue' has a constructor with 1 argument that is not explicit. 102.570672 (102.495363) E[1]: [src/communication/bolt/v1/decoder/decoded_value.hpp:100]: (style) Class 'DecodedValue' has a constructor with 1 argument that is not explicit. 102.570677 (102.495368) E[1]: [src/communication/bolt/v1/decoder/decoded_value.hpp:104]: (style) Class 'DecodedValue' has a constructor with 1 argument that is not explicit. 102.570681 (102.495372) E[1]: [src/communication/bolt/v1/decoder/decoded_value.hpp:107]: (style) Class 'DecodedValue' has a constructor with 1 argument that is not explicit. 102.570690 (102.495381) E[1]: [src/communication/bolt/v1/decoder/decoded_value.hpp:110]: (style) Class 'DecodedValue' has a constructor with 1 argument that is not explicit. 102.570694 (102.495385) E[1]: [src/communication/bolt/v1/decoder/decoded_value.hpp:113]: (style) Class 'DecodedValue' has a constructor with 1 argument that is not explicit. CypherParser: 102.570767 (102.495458) E[1]: [src/query/frontend/opencypher/generated/CypherParser.h:69]: (style) Class 'CypherParser' has a constructor with 1 argument that is not explicit. 102.570772 (102.495463) E[1]: [src/query/frontend/opencypher/generated/CypherLexer.h:40]: (style) Class 'CypherLexer' has a constructor with 1 argument that is not explicit. 102.570776 (102.495467) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:86]: (style) The scope of the variable '_la' can be reduced. 102.570781 (102.495472) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:311]: (style) The scope of the variable '_la' can be reduced. 102.570785 (102.495476) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:402]: (style) The scope of the variable '_la' can be reduced. 102.570789 (102.495480) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:497]: (style) The scope of the variable '_la' can be reduced. 102.570797 (102.495488) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:778]: (style) The scope of the variable '_la' can be reduced. 102.570802 (102.495493) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:895]: (style) The scope of the variable '_la' can be reduced. 102.570806 (102.495497) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:991]: (style) The scope of the variable '_la' can be reduced. 102.570811 (102.495502) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:1190]: (style) The scope of the variable '_la' can be reduced. 102.570815 (102.495506) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:1274]: (style) The scope of the variable '_la' can be reduced. 102.570820 (102.495511) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:1393]: (style) The scope of the variable '_la' can be reduced. 102.570824 (102.495515) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:1570]: (style) The scope of the variable '_la' can be reduced. 102.570829 (102.495520) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:1695]: (style) The scope of the variable '_la' can be reduced. 102.570834 (102.495525) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:1800]: (style) The scope of the variable '_la' can be reduced. 102.570839 (102.495530) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:1903]: (style) The scope of the variable '_la' can be reduced. 102.570843 (102.495534) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:2019]: (style) The scope of the variable '_la' can be reduced. 102.570848 (102.495539) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:2228]: (style) The scope of the variable '_la' can be reduced. 102.570852 (102.495543) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:2542]: (style) The scope of the variable '_la' can be reduced. 102.570857 (102.495548) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:2797]: (style) The scope of the variable '_la' can be reduced. 102.570861 (102.495552) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:2966]: (style) The scope of the variable '_la' can be reduced. 102.570866 (102.495557) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:3067]: (style) The scope of the variable '_la' can be reduced. 102.570870 (102.495561) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:3289]: (style) The scope of the variable '_la' can be reduced. 102.570875 (102.495566) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:3295]: (style) The scope of the variable 'alt' can be reduced. 102.570879 (102.495570) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:3419]: (style) The scope of the variable '_la' can be reduced. 102.570884 (102.495575) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:3596]: (style) The scope of the variable '_la' can be reduced. 102.570888 (102.495579) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:3688]: (style) The scope of the variable '_la' can be reduced. 102.570893 (102.495584) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:3963]: (style) The scope of the variable '_la' can be reduced. 102.570897 (102.495588) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:4452]: (style) The scope of the variable '_la' can be reduced. 102.570902 (102.495593) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:4586]: (style) The scope of the variable '_la' can be reduced. 102.570906 (102.495597) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:4813]: (style) The scope of the variable '_la' can be reduced. 102.570911 (102.495602) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:4943]: (style) The scope of the variable '_la' can be reduced. 102.570918 (102.495609) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:5026]: (style) The scope of the variable '_la' can be reduced. 102.570923 (102.495614) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:5569]: (style) The scope of the variable '_la' can be reduced. 102.570928 (102.495619) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:5664]: (style) The scope of the variable '_la' can be reduced. 102.570932 (102.495623) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:5755]: (style) The scope of the variable '_la' can be reduced. 102.570937 (102.495628) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:5888]: (style) The scope of the variable '_la' can be reduced. 102.570941 (102.495632) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:6045]: (style) The scope of the variable '_la' can be reduced. 102.570946 (102.495637) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:6142]: (style) The scope of the variable '_la' can be reduced. 102.570950 (102.495641) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:6347]: (style) The scope of the variable '_la' can be reduced. 102.570955 (102.495646) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:6523]: (style) The scope of the variable '_la' can be reduced. 102.570959 (102.495650) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:6614]: (style) The scope of the variable '_la' can be reduced. 102.570964 (102.495655) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:6899]: (style) The scope of the variable '_la' can be reduced. 102.570968 (102.495659) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:6992]: (style) The scope of the variable '_la' can be reduced. 102.570973 (102.495664) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:7147]: (style) The scope of the variable '_la' can be reduced. 102.570977 (102.495668) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:7680]: (style) The scope of the variable '_la' can be reduced. 102.570982 (102.495673) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:7759]: (style) The scope of the variable '_la' can be reduced. 102.570986 (102.495677) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:7938]: (style) The scope of the variable '_la' can be reduced. 102.570991 (102.495682) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:8126]: (style) The scope of the variable '_la' can be reduced. 102.570995 (102.495686) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:8220]: (style) The scope of the variable '_la' can be reduced. 102.571000 (102.495691) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:8313]: (style) The scope of the variable '_la' can be reduced. 102.571004 (102.495695) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:8491]: (style) The scope of the variable '_la' can be reduced. 102.571009 (102.495700) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:8703]: (style) The scope of the variable '_la' can be reduced. 102.571013 (102.495704) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:8783]: (style) The scope of the variable '_la' can be reduced. 102.571018 (102.495709) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:8914]: (style) The scope of the variable '_la' can be reduced. 102.571022 (102.495713) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:9119]: (style) The scope of the variable '_la' can be reduced. 102.571027 (102.495718) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:9220]: (style) The scope of the variable '_la' can be reduced. 102.571034 (102.495725) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:9414]: (style) The scope of the variable '_la' can be reduced. 102.571039 (102.495730) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:9660]: (style) The scope of the variable '_la' can be reduced. 102.571043 (102.495734) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:10008]: (style) The scope of the variable '_la' can be reduced. 102.571048 (102.495739) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:10158]: (style) The scope of the variable '_la' can be reduced. 102.571052 (102.495743) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:10250]: (style) The scope of the variable '_la' can be reduced. 102.571057 (102.495748) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:10370]: (style) The scope of the variable '_la' can be reduced. 102.571061 (102.495752) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:10637]: (style) The scope of the variable '_la' can be reduced. 102.571065 (102.495756) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:10749]: (style) The scope of the variable '_la' can be reduced. 102.571070 (102.495761) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:10815]: (style) The scope of the variable '_la' can be reduced. 102.571075 (102.495766) E[1]: [src/query/frontend/opencypher/generated/CypherParser.cpp:10881]: (style) The scope of the variable '_la' can be reduced. We know that we represented it correctly in memory: 102.571079 (102.495770) E[1]: [src/communication/bolt/v1/decoder/decoder.hpp:252]: (portability) Casting between integer* and double* which have an incompatible binary data representation. Cont assigned but not used after: 102.571101 (102.495792) E[1]: [src/query/frontend/ast/ast.hpp:1008]: (style) Variable 'cont' is assigned a value that is never used. Reviewers: teon.banek, buda, mferencevic Reviewed By: teon.banek Subscribers: mferencevic, pullbot Differential Revision: https://phabricator.memgraph.io/D967
This commit is contained in:
parent
7fabdda938
commit
f50d87f736
@ -146,7 +146,7 @@ class DecodedValue {
|
||||
#undef DECL_GETTER_BY_REFERNCE
|
||||
|
||||
#define TYPE_CHECKER(type) \
|
||||
bool Is##type() const { return type_ == Type::type ; }
|
||||
bool Is##type() const { return type_ == Type::type; }
|
||||
|
||||
TYPE_CHECKER(Bool)
|
||||
TYPE_CHECKER(Int)
|
||||
@ -161,7 +161,6 @@ class DecodedValue {
|
||||
|
||||
#undef TYPE_CHECKER
|
||||
|
||||
|
||||
// conversion function to TypedValue
|
||||
operator query::TypedValue() const;
|
||||
|
||||
@ -204,4 +203,4 @@ std::ostream &operator<<(std::ostream &os, const DecodedUnboundedEdge &edge);
|
||||
std::ostream &operator<<(std::ostream &os, const DecodedPath &path);
|
||||
std::ostream &operator<<(std::ostream &os, const DecodedValue &value);
|
||||
std::ostream &operator<<(std::ostream &os, const DecodedValue::Type type);
|
||||
}
|
||||
} // namespace communication::bolt
|
||||
|
@ -21,7 +21,7 @@ namespace communication::bolt {
|
||||
template <typename Buffer>
|
||||
class Decoder {
|
||||
public:
|
||||
Decoder(Buffer &buffer) : buffer_(buffer) {}
|
||||
explicit Decoder(Buffer &buffer) : buffer_(buffer) {}
|
||||
|
||||
/**
|
||||
* Reads a DecodedValue from the available data in the buffer.
|
||||
@ -189,7 +189,6 @@ class Decoder {
|
||||
|
||||
bool ReadInt(const Marker &marker, DecodedValue *data) {
|
||||
uint8_t value = underlying_cast(marker);
|
||||
bool success = true;
|
||||
int64_t ret;
|
||||
VLOG(1) << "[ReadInt] Start";
|
||||
if (value >= 240 || value <= 127) {
|
||||
@ -232,11 +231,9 @@ class Decoder {
|
||||
<< underlying_cast(marker);
|
||||
return false;
|
||||
}
|
||||
if (success) {
|
||||
*data = DecodedValue(ret);
|
||||
VLOG(1) << "[ReadInt] Success";
|
||||
}
|
||||
return success;
|
||||
*data = DecodedValue(ret);
|
||||
VLOG(1) << "[ReadInt] Success";
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ReadDouble(const Marker marker, DecodedValue *data) {
|
||||
@ -249,6 +246,7 @@ class Decoder {
|
||||
return false;
|
||||
}
|
||||
value = bswap(value);
|
||||
// cppcheck-suppress invalidPointerCast
|
||||
ret = *reinterpret_cast<double *>(&value);
|
||||
*data = DecodedValue(ret);
|
||||
VLOG(1) << "[ReadDouble] Success";
|
||||
|
@ -16,7 +16,7 @@ namespace communication::bolt {
|
||||
template <typename Buffer>
|
||||
class BaseEncoder : public PrimitiveEncoder<Buffer> {
|
||||
public:
|
||||
BaseEncoder(Buffer &buffer) : PrimitiveEncoder<Buffer>(buffer) {}
|
||||
explicit BaseEncoder(Buffer &buffer) : PrimitiveEncoder<Buffer>(buffer) {}
|
||||
|
||||
void WriteList(const std::vector<query::TypedValue> &value) {
|
||||
this->WriteTypeSize(value.size(), MarkerList);
|
||||
@ -60,7 +60,7 @@ class BaseEncoder : public PrimitiveEncoder<Buffer> {
|
||||
void WriteEdge(const EdgeAccessor &edge, bool unbound = false) {
|
||||
this->WriteRAW(underlying_cast(Marker::TinyStruct) + (unbound ? 3 : 5));
|
||||
this->WriteRAW(underlying_cast(unbound ? Signature::UnboundRelationship
|
||||
: Signature::Relationship));
|
||||
: Signature::Relationship));
|
||||
|
||||
WriteUInt(edge.temporary_id());
|
||||
if (!unbound) {
|
||||
@ -163,4 +163,4 @@ class BaseEncoder : public PrimitiveEncoder<Buffer> {
|
||||
this->WriteInt(*reinterpret_cast<const int64_t *>(&value));
|
||||
}
|
||||
};
|
||||
}
|
||||
} // namespace communication::bolt
|
||||
|
@ -148,7 +148,7 @@ State HandleRun(TSession &session, State state, Marker marker) {
|
||||
}
|
||||
|
||||
auto code_message = [&e]() -> std::pair<std::string, std::string> {
|
||||
if (const auto *p = dynamic_cast<const query::QueryException *>(&e)) {
|
||||
if (dynamic_cast<const query::QueryException *>(&e)) {
|
||||
// Clients expect 4 strings separated by dots. First being database name
|
||||
// (for example: Neo, Memgraph...), second being either ClientError,
|
||||
// TransientError or DatabaseError (or ClientNotification for warnings).
|
||||
@ -170,7 +170,7 @@ State HandleRun(TSession &session, State state, Marker marker) {
|
||||
// discourage retry of this query.
|
||||
return {"Memgraph.ClientError.MemgraphError.MemgraphError", e.what()};
|
||||
}
|
||||
if (const auto *p = dynamic_cast<const utils::BasicException *>(&e)) {
|
||||
if (dynamic_cast<const utils::BasicException *>(&e)) {
|
||||
// Exception not derived from QueryException was thrown which means that
|
||||
// database probably aborted transaction because of some timeout,
|
||||
// deadlock, serialization error or something similar. We return
|
||||
@ -178,7 +178,7 @@ State HandleRun(TSession &session, State state, Marker marker) {
|
||||
return {"Memgraph.TransientError.MemgraphError.MemgraphError",
|
||||
e.what()};
|
||||
}
|
||||
if (const auto *p = dynamic_cast<const std::bad_alloc *>(&e)) {
|
||||
if (dynamic_cast<const std::bad_alloc *>(&e)) {
|
||||
// std::bad_alloc was thrown, God knows in which state is database ->
|
||||
// terminate.
|
||||
LOG(FATAL) << "Memgraph is out of memory";
|
||||
|
@ -50,7 +50,7 @@ class Network {
|
||||
|
||||
NetworkMessage(const std::string &address, uint16_t port,
|
||||
const std::string &reactor, const std::string &channel,
|
||||
std::unique_ptr<Message> message)
|
||||
std::unique_ptr<Message> &&message)
|
||||
: address(address),
|
||||
port(port),
|
||||
reactor(reactor),
|
||||
@ -129,8 +129,9 @@ class Network {
|
||||
|
||||
class RemoteChannelWriter : public ChannelWriter {
|
||||
public:
|
||||
RemoteChannelWriter(Network *network, std::string address, uint16_t port,
|
||||
std::string reactor, std::string channel)
|
||||
RemoteChannelWriter(Network *network, const std::string &address,
|
||||
uint16_t port, const std::string &reactor,
|
||||
const std::string &channel)
|
||||
: network_(network),
|
||||
address_(address),
|
||||
port_(port),
|
||||
@ -271,4 +272,4 @@ class DistributedSystem : public ChannelFinder {
|
||||
DistributedSystem &operator=(const DistributedSystem &) = delete;
|
||||
DistributedSystem &operator=(DistributedSystem &&) = delete;
|
||||
};
|
||||
}
|
||||
} // namespace communication::reactor
|
||||
|
@ -194,7 +194,7 @@ class EventStream {
|
||||
*/
|
||||
class OnEventOnceChainer {
|
||||
public:
|
||||
OnEventOnceChainer(EventStream &event_stream)
|
||||
explicit OnEventOnceChainer(EventStream &event_stream)
|
||||
: event_stream_(event_stream) {}
|
||||
~OnEventOnceChainer() { InstallCallbacks(); }
|
||||
|
||||
@ -272,7 +272,7 @@ class Channel {
|
||||
friend class Reactor; // to create a Params initialization object
|
||||
friend class EventStream::Subscription;
|
||||
|
||||
Channel(Params params)
|
||||
explicit Channel(const Params ¶ms)
|
||||
: channel_name_(params.channel_name),
|
||||
reactor_name_(params.reactor_name),
|
||||
mutex_(params.mutex),
|
||||
@ -294,8 +294,9 @@ class Channel {
|
||||
public:
|
||||
friend class Channel;
|
||||
|
||||
LocalChannelWriter(std::string reactor_name, std::string channel_name,
|
||||
std::weak_ptr<Channel> queue)
|
||||
LocalChannelWriter(const std::string &reactor_name,
|
||||
const std::string &channel_name,
|
||||
const std::weak_ptr<Channel> &queue)
|
||||
: reactor_name_(reactor_name),
|
||||
channel_name_(channel_name),
|
||||
queue_(queue) {}
|
||||
@ -330,7 +331,7 @@ class Channel {
|
||||
public:
|
||||
friend class Channel;
|
||||
|
||||
LocalEventStream(std::shared_ptr<std::mutex> mutex, Channel *queue)
|
||||
LocalEventStream(const std::shared_ptr<std::mutex> &mutex, Channel *queue)
|
||||
: mutex_(mutex), queue_(queue) {}
|
||||
|
||||
void OnEventHelper(std::type_index type_index, Callback callback) {
|
||||
@ -443,8 +444,8 @@ class Channel {
|
||||
class Reactor {
|
||||
friend class System;
|
||||
|
||||
Reactor(ChannelFinder &system, std::string name,
|
||||
std::function<void(Reactor &)> setup)
|
||||
Reactor(ChannelFinder &system, const std::string &name,
|
||||
const std::function<void(Reactor &)> &setup)
|
||||
: system_(system), name_(name), setup_(setup), main_(Open("main")) {}
|
||||
|
||||
public:
|
||||
@ -580,4 +581,4 @@ class System : public ChannelFinder {
|
||||
};
|
||||
|
||||
using Subscription = Channel::LocalEventStream::Subscription;
|
||||
}
|
||||
} // namespace communication::reactor
|
||||
|
@ -53,7 +53,7 @@ class Worker {
|
||||
EPOLLIN | EPOLLRDHUP);
|
||||
}
|
||||
|
||||
Worker(TSessionData &session_data) : session_data_(session_data) {}
|
||||
explicit Worker(TSessionData &session_data) : session_data_(session_data) {}
|
||||
|
||||
void Start(std::atomic<bool> &alive) {
|
||||
while (alive) {
|
||||
@ -193,4 +193,4 @@ class Worker {
|
||||
io::network::SocketEventDispatcher<SessionSocketListener> dispatcher_;
|
||||
std::vector<std::unique_ptr<SessionSocketListener>> session_listeners_;
|
||||
};
|
||||
}
|
||||
} // namespace communication
|
||||
|
@ -51,7 +51,7 @@ class AccessorBase {
|
||||
typedef typename SkipList<T>::ConstIterator list_it_con;
|
||||
|
||||
protected:
|
||||
AccessorBase(list *skiplist) : accessor(skiplist->access()) {}
|
||||
explicit AccessorBase(list *skiplist) : accessor(skiplist->access()) {}
|
||||
|
||||
public:
|
||||
AccessorBase(const AccessorBase &) = delete;
|
||||
|
@ -29,7 +29,7 @@ class ConcurrentPushQueue {
|
||||
// refs to an element, or arguments for emplace creation of
|
||||
// an element
|
||||
template <typename... TArgs>
|
||||
Node(TArgs &&... args) : element_(std::forward<TArgs>(args)...) {}
|
||||
explicit Node(TArgs &&... args) : element_(std::forward<TArgs>(args)...) {}
|
||||
|
||||
// element itself and pointer to next Node
|
||||
TElement element_;
|
||||
|
@ -193,7 +193,7 @@ class SkipList : private Lockable<lock_t> {
|
||||
void forward(size_t level, Node *next) { tower[level].store(next); }
|
||||
|
||||
private:
|
||||
Node(uint8_t height) : height(height) {
|
||||
explicit Node(uint8_t height) : height(height) {
|
||||
// here we assume, that the memory for N towers (N = height) has
|
||||
// been allocated right after the Node structure so we need to
|
||||
// initialize that memory
|
||||
@ -247,7 +247,7 @@ class SkipList : private Lockable<lock_t> {
|
||||
template <class It>
|
||||
class IteratorBase : public Crtp<It> {
|
||||
protected:
|
||||
IteratorBase(Node *node) : node(node) {}
|
||||
explicit IteratorBase(Node *node) : node(node) {}
|
||||
|
||||
Node *node{nullptr};
|
||||
|
||||
@ -302,7 +302,7 @@ class SkipList : private Lockable<lock_t> {
|
||||
|
||||
class ConstIterator : public IteratorBase<ConstIterator> {
|
||||
friend class SkipList;
|
||||
ConstIterator(Node *node) : IteratorBase<ConstIterator>(node) {}
|
||||
explicit ConstIterator(Node *node) : IteratorBase<ConstIterator>(node) {}
|
||||
|
||||
public:
|
||||
ConstIterator() = default;
|
||||
@ -321,7 +321,7 @@ class SkipList : private Lockable<lock_t> {
|
||||
|
||||
class Iterator : public IteratorBase<Iterator> {
|
||||
friend class SkipList;
|
||||
Iterator(Node *node) : IteratorBase<Iterator>(node) {}
|
||||
explicit Iterator(Node *node) : IteratorBase<Iterator>(node) {}
|
||||
|
||||
public:
|
||||
Iterator() = default;
|
||||
@ -347,7 +347,7 @@ class SkipList : private Lockable<lock_t> {
|
||||
class ReverseIterator : public Crtp<ReverseIterator> {
|
||||
friend class SkipList;
|
||||
|
||||
ReverseIterator(Node *node) : node_(node) {}
|
||||
explicit ReverseIterator(Node *node) : node_(node) {}
|
||||
|
||||
public:
|
||||
ReverseIterator(SkipList *skiplist, Node *node, Node *preds[])
|
||||
@ -456,7 +456,7 @@ class SkipList : private Lockable<lock_t> {
|
||||
class Accessor {
|
||||
friend class SkipList;
|
||||
|
||||
Accessor(TSkipList *skiplist)
|
||||
explicit Accessor(TSkipList *skiplist)
|
||||
: skiplist(skiplist), status_(skiplist->gc.CreateNewAccessor()) {
|
||||
DCHECK(skiplist != nullptr) << "Skiplist is nullptr.";
|
||||
}
|
||||
@ -464,6 +464,7 @@ class SkipList : private Lockable<lock_t> {
|
||||
public:
|
||||
Accessor(const Accessor &) = delete;
|
||||
|
||||
// cppcheck-suppress uninitMemberVar
|
||||
Accessor(Accessor &&other)
|
||||
: skiplist(other.skiplist), status_(other.status_) {
|
||||
other.skiplist = nullptr;
|
||||
@ -863,11 +864,11 @@ class SkipList : private Lockable<lock_t> {
|
||||
template <bool ADDING>
|
||||
static bool lock_nodes(uint8_t height, guard_t guards[], Node *preds[],
|
||||
Node *succs[]) {
|
||||
Node *prepred = nullptr, *pred = nullptr, *succ = nullptr;
|
||||
Node *prepred = nullptr;
|
||||
bool valid = true;
|
||||
|
||||
for (int level = 0; valid && level < height; ++level) {
|
||||
pred = preds[level], succ = succs[level];
|
||||
Node *pred = preds[level], *succ = succs[level];
|
||||
|
||||
if (pred != prepred)
|
||||
guards[level] = pred->acquire_unique(), prepred = pred;
|
||||
|
@ -23,7 +23,7 @@ class SkipListSuffix {
|
||||
public:
|
||||
class Iterator {
|
||||
public:
|
||||
Iterator(TIterator current) : current_(current) {}
|
||||
explicit Iterator(TIterator current) : current_(current) {}
|
||||
|
||||
TValue &operator*() { return *current_; }
|
||||
|
||||
@ -40,7 +40,7 @@ class SkipListSuffix {
|
||||
TIterator current_;
|
||||
};
|
||||
|
||||
SkipListSuffix(
|
||||
explicit SkipListSuffix(
|
||||
const TIterator begin,
|
||||
typename SkipList<TValue>::template Accessor<TAccessor> &&accessor)
|
||||
: begin_(begin), accessor_(std::move(accessor)) {}
|
||||
@ -79,9 +79,9 @@ static auto GetVlists(
|
||||
typename SkipList<TIndexEntry>::template Accessor<TAccessor>
|
||||
&&skiplist_accessor,
|
||||
TIterator begin,
|
||||
const std::function<bool(const TIndexEntry &entry)> predicate,
|
||||
const std::function<bool(const TIndexEntry &entry)> &predicate,
|
||||
const tx::Transaction &t,
|
||||
const std::function<bool(const TIndexEntry &, const TRecord *)> exists,
|
||||
const std::function<bool(const TIndexEntry &, const TRecord *)> &exists,
|
||||
bool current_state = false) {
|
||||
TIndexEntry *prev = nullptr;
|
||||
auto range = iter::takewhile(
|
||||
@ -141,7 +141,7 @@ template <class TKey, class TIndexEntry, class TRecord>
|
||||
static void Refresh(
|
||||
ConcurrentMap<TKey, SkipList<TIndexEntry> *> &indices,
|
||||
const tx::Snapshot &snapshot, tx::Engine &engine,
|
||||
const std::function<bool(const TKey &, const TIndexEntry &)> exists) {
|
||||
const std::function<bool(const TKey &, const TIndexEntry &)> &exists) {
|
||||
// iterate over all the indices
|
||||
for (auto &key_indices_pair : indices.access()) {
|
||||
// iterate over index entries
|
||||
|
@ -17,7 +17,7 @@ class HashedFileWriter {
|
||||
}
|
||||
|
||||
/** Constructor which also takes a file path and opens it immediately. */
|
||||
HashedFileWriter(const std::string &path) : HashedFileWriter() {
|
||||
explicit HashedFileWriter(const std::string &path) : HashedFileWriter() {
|
||||
output_stream_.open(path, std::ios::out | std::ios::binary);
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ namespace io::network {
|
||||
* see: man 3 getaddrinfo
|
||||
*/
|
||||
class AddrInfo {
|
||||
AddrInfo(struct addrinfo *info);
|
||||
explicit AddrInfo(struct addrinfo *info);
|
||||
|
||||
public:
|
||||
~AddrInfo();
|
||||
@ -19,4 +19,4 @@ class AddrInfo {
|
||||
private:
|
||||
struct addrinfo *info;
|
||||
};
|
||||
}
|
||||
} // namespace io::network
|
||||
|
@ -21,7 +21,7 @@ class Epoll {
|
||||
public:
|
||||
using Event = struct epoll_event;
|
||||
|
||||
Epoll(int flags) : epoll_fd_(epoll_create1(flags)) {
|
||||
explicit Epoll(int flags) : epoll_fd_(epoll_create1(flags)) {
|
||||
// epoll_create1 returns an error if there is a logical error in our code
|
||||
// (for example invalid flags) or if there is irrecoverable error. In both
|
||||
// cases it is best to terminate.
|
||||
@ -54,4 +54,4 @@ class Epoll {
|
||||
private:
|
||||
const int epoll_fd_;
|
||||
};
|
||||
}
|
||||
} // namespace io::network
|
||||
|
@ -168,7 +168,6 @@ std::experimental::optional<Socket> Socket::Accept() {
|
||||
char addr_decoded[INET6_ADDRSTRLEN];
|
||||
void *addr_src;
|
||||
unsigned short port;
|
||||
unsigned char family;
|
||||
|
||||
int sfd = accept(socket_, (struct sockaddr *)&addr, &addr_size);
|
||||
if (UNLIKELY(sfd == -1)) return std::experimental::nullopt;
|
||||
@ -176,11 +175,9 @@ std::experimental::optional<Socket> Socket::Accept() {
|
||||
if (addr.ss_family == AF_INET) {
|
||||
addr_src = (void *)&(((sockaddr_in *)&addr)->sin_addr);
|
||||
port = ntohs(((sockaddr_in *)&addr)->sin_port);
|
||||
family = 4;
|
||||
} else {
|
||||
addr_src = (void *)&(((sockaddr_in6 *)&addr)->sin6_addr);
|
||||
port = ntohs(((sockaddr_in6 *)&addr)->sin6_port);
|
||||
family = 6;
|
||||
}
|
||||
|
||||
inet_ntop(addr.ss_family, addr_src, addr_decoded, INET6_ADDRSTRLEN);
|
||||
@ -229,4 +226,4 @@ bool Socket::Write(const std::string &s,
|
||||
int Socket::Read(void *buffer, size_t len) {
|
||||
return read(socket_, buffer, len);
|
||||
}
|
||||
}
|
||||
} // namespace io::network
|
||||
|
@ -15,7 +15,7 @@ namespace io::network {
|
||||
template <class Listener>
|
||||
class SocketEventDispatcher {
|
||||
public:
|
||||
SocketEventDispatcher(uint32_t flags = 0) : epoll_(flags) {}
|
||||
explicit SocketEventDispatcher(uint32_t flags = 0) : epoll_(flags) {}
|
||||
|
||||
void AddListener(int fd, Listener &listener, uint32_t events) {
|
||||
// Add the listener associated to fd file descriptor to epoll.
|
||||
@ -78,7 +78,7 @@ class SocketEventDispatcher {
|
||||
*/
|
||||
class BaseListener {
|
||||
public:
|
||||
BaseListener(Socket &socket) : socket_(socket) {}
|
||||
explicit BaseListener(Socket &socket) : socket_(socket) {}
|
||||
|
||||
void OnClose() { socket_.Close(); }
|
||||
|
||||
|
@ -8,7 +8,7 @@ template <class T>
|
||||
class Version {
|
||||
public:
|
||||
Version() = default;
|
||||
Version(T *older) : older_(older) {}
|
||||
explicit Version(T *older) : older_(older) {}
|
||||
|
||||
~Version() { delete older_.load(std::memory_order_seq_cst); }
|
||||
|
||||
@ -29,4 +29,4 @@ class Version {
|
||||
private:
|
||||
std::atomic<T *> older_{nullptr};
|
||||
};
|
||||
}
|
||||
} // namespace mvcc
|
||||
|
@ -16,7 +16,7 @@ class Context {
|
||||
Context(Context &&) = default;
|
||||
Context &operator=(Context &&) = default;
|
||||
|
||||
Context(GraphDbAccessor &db_accessor) : db_accessor_(db_accessor) {}
|
||||
explicit Context(GraphDbAccessor &db_accessor) : db_accessor_(db_accessor) {}
|
||||
GraphDbAccessor &db_accessor_;
|
||||
SymbolTable symbol_table_;
|
||||
Parameters parameters_;
|
||||
|
@ -45,13 +45,13 @@ class SemanticException : public QueryException {
|
||||
|
||||
class UnboundVariableError : public SemanticException {
|
||||
public:
|
||||
UnboundVariableError(const std::string &name)
|
||||
explicit UnboundVariableError(const std::string &name)
|
||||
: SemanticException("Unbound variable: " + name) {}
|
||||
};
|
||||
|
||||
class RedeclareVariableError : public SemanticException {
|
||||
public:
|
||||
RedeclareVariableError(const std::string &name)
|
||||
explicit RedeclareVariableError(const std::string &name)
|
||||
: SemanticException("Redeclaring variable: " + name) {}
|
||||
};
|
||||
|
||||
|
@ -87,7 +87,7 @@ class Tree : public ::utils::Visitable<HierarchicalTreeVisitor>,
|
||||
virtual Tree *Clone(AstTreeStorage &storage) const = 0;
|
||||
|
||||
protected:
|
||||
Tree(int uid) : uid_(uid) {}
|
||||
explicit Tree(int uid) : uid_(uid) {}
|
||||
|
||||
private:
|
||||
const int uid_;
|
||||
@ -102,7 +102,7 @@ class Expression : public Tree {
|
||||
Expression *Clone(AstTreeStorage &storage) const override = 0;
|
||||
|
||||
protected:
|
||||
Expression(int uid) : Tree(uid) {}
|
||||
explicit Expression(int uid) : Tree(uid) {}
|
||||
};
|
||||
|
||||
class Where : public Tree {
|
||||
@ -124,7 +124,7 @@ class Where : public Tree {
|
||||
Expression *expression_ = nullptr;
|
||||
|
||||
protected:
|
||||
Where(int uid) : Tree(uid) {}
|
||||
explicit Where(int uid) : Tree(uid) {}
|
||||
Where(int uid, Expression *expression) : Tree(uid), expression_(expression) {}
|
||||
};
|
||||
|
||||
@ -138,7 +138,7 @@ class BinaryOperator : public Expression {
|
||||
BinaryOperator *Clone(AstTreeStorage &storage) const override = 0;
|
||||
|
||||
protected:
|
||||
BinaryOperator(int uid) : Expression(uid) {}
|
||||
explicit BinaryOperator(int uid) : Expression(uid) {}
|
||||
BinaryOperator(int uid, Expression *expression1, Expression *expression2)
|
||||
: Expression(uid), expression1_(expression1), expression2_(expression2) {}
|
||||
};
|
||||
@ -152,7 +152,7 @@ class UnaryOperator : public Expression {
|
||||
UnaryOperator *Clone(AstTreeStorage &storage) const override = 0;
|
||||
|
||||
protected:
|
||||
UnaryOperator(int uid) : Expression(uid) {}
|
||||
explicit UnaryOperator(int uid) : Expression(uid) {}
|
||||
UnaryOperator(int uid, Expression *expression)
|
||||
: Expression(uid), expression_(expression) {}
|
||||
};
|
||||
@ -580,7 +580,7 @@ class BaseLiteral : public Expression {
|
||||
BaseLiteral *Clone(AstTreeStorage &storage) const override = 0;
|
||||
|
||||
protected:
|
||||
BaseLiteral(int uid) : Expression(uid) {}
|
||||
explicit BaseLiteral(int uid) : Expression(uid) {}
|
||||
};
|
||||
|
||||
class PrimitiveLiteral : public BaseLiteral {
|
||||
@ -601,7 +601,7 @@ class PrimitiveLiteral : public BaseLiteral {
|
||||
int token_position_ = -1;
|
||||
|
||||
protected:
|
||||
PrimitiveLiteral(int uid) : BaseLiteral(uid) {}
|
||||
explicit PrimitiveLiteral(int uid) : BaseLiteral(uid) {}
|
||||
template <typename T>
|
||||
PrimitiveLiteral(int uid, T value) : BaseLiteral(uid), value_(value) {}
|
||||
template <typename T>
|
||||
@ -633,7 +633,7 @@ class ListLiteral : public BaseLiteral {
|
||||
std::vector<Expression *> elements_;
|
||||
|
||||
protected:
|
||||
ListLiteral(int uid) : BaseLiteral(uid) {}
|
||||
explicit ListLiteral(int uid) : BaseLiteral(uid) {}
|
||||
ListLiteral(int uid, const std::vector<Expression *> &elements)
|
||||
: BaseLiteral(uid), elements_(elements) {}
|
||||
};
|
||||
@ -664,7 +664,7 @@ class MapLiteral : public BaseLiteral {
|
||||
elements_;
|
||||
|
||||
protected:
|
||||
MapLiteral(int uid) : BaseLiteral(uid) {}
|
||||
explicit MapLiteral(int uid) : BaseLiteral(uid) {}
|
||||
MapLiteral(
|
||||
int uid,
|
||||
const std::unordered_map<std::pair<std::string, GraphDbTypes::Property>,
|
||||
@ -722,7 +722,7 @@ class PropertyLookup : public Expression {
|
||||
property_name_(property_name),
|
||||
property_(property) {}
|
||||
PropertyLookup(int uid, Expression *expression,
|
||||
std::pair<std::string, GraphDbTypes::Property> property)
|
||||
const std::pair<std::string, GraphDbTypes::Property> &property)
|
||||
: Expression(uid),
|
||||
expression_(expression),
|
||||
property_name_(property.first),
|
||||
@ -750,7 +750,7 @@ class LabelsTest : public Expression {
|
||||
|
||||
protected:
|
||||
LabelsTest(int uid, Expression *expression,
|
||||
std::vector<GraphDbTypes::Label> labels)
|
||||
const std::vector<GraphDbTypes::Label> &labels)
|
||||
: Expression(uid), expression_(expression), labels_(labels) {}
|
||||
};
|
||||
|
||||
@ -783,9 +783,8 @@ class Function : public Expression {
|
||||
|
||||
protected:
|
||||
Function(int uid,
|
||||
std::function<TypedValue(const std::vector<TypedValue> &,
|
||||
GraphDbAccessor &)>
|
||||
function,
|
||||
const std::function<TypedValue(const std::vector<TypedValue> &,
|
||||
GraphDbAccessor &)> &function,
|
||||
const std::vector<Expression *> &arguments)
|
||||
: Expression(uid), function_(function), arguments_(arguments) {}
|
||||
};
|
||||
@ -827,7 +826,7 @@ class Aggregation : public BinaryOperator {
|
||||
// COUNT without expression denotes COUNT(*) in cypher.
|
||||
DCHECK(expression1 || op == Aggregation::Op::COUNT)
|
||||
<< "All aggregations, except COUNT require expression";
|
||||
DCHECK(expression2 == nullptr ^ op == Aggregation::Op::COLLECT_MAP)
|
||||
DCHECK((expression2 == nullptr) ^ (op == Aggregation::Op::COLLECT_MAP))
|
||||
<< "The second expression is obligatory in COLLECT_MAP and "
|
||||
"invalid otherwise";
|
||||
}
|
||||
@ -886,7 +885,7 @@ class ParameterLookup : public Expression {
|
||||
int token_position_ = -1;
|
||||
|
||||
protected:
|
||||
ParameterLookup(int uid) : Expression(uid) {}
|
||||
explicit ParameterLookup(int uid) : Expression(uid) {}
|
||||
ParameterLookup(int uid, int token_position)
|
||||
: Expression(uid), token_position_(token_position) {}
|
||||
};
|
||||
@ -916,7 +915,7 @@ class NamedExpression : public Tree {
|
||||
int token_position_ = -1;
|
||||
|
||||
protected:
|
||||
NamedExpression(int uid) : Tree(uid) {}
|
||||
explicit NamedExpression(int uid) : Tree(uid) {}
|
||||
NamedExpression(int uid, const std::string &name) : Tree(uid), name_(name) {}
|
||||
NamedExpression(int uid, const std::string &name, Expression *expression)
|
||||
: Tree(uid), name_(name), expression_(expression) {}
|
||||
@ -939,7 +938,7 @@ class PatternAtom : public Tree {
|
||||
PatternAtom *Clone(AstTreeStorage &storage) const override = 0;
|
||||
|
||||
protected:
|
||||
PatternAtom(int uid) : Tree(uid) {}
|
||||
explicit PatternAtom(int uid) : Tree(uid) {}
|
||||
PatternAtom(int uid, Identifier *identifier)
|
||||
: Tree(uid), identifier_(identifier) {}
|
||||
};
|
||||
@ -1005,7 +1004,7 @@ class EdgeAtom : public PatternAtom {
|
||||
cont = lower_bound_->Accept(visitor);
|
||||
}
|
||||
if (cont && upper_bound_) {
|
||||
cont = upper_bound_->Accept(visitor);
|
||||
upper_bound_->Accept(visitor);
|
||||
}
|
||||
}
|
||||
return visitor.PostVisit(*this);
|
||||
@ -1095,7 +1094,7 @@ class Pattern : public Tree {
|
||||
std::vector<PatternAtom *> atoms_;
|
||||
|
||||
protected:
|
||||
Pattern(int uid) : Tree(uid) {}
|
||||
explicit Pattern(int uid) : Tree(uid) {}
|
||||
};
|
||||
|
||||
// Clauses
|
||||
@ -1104,7 +1103,7 @@ class Clause : public Tree {
|
||||
friend class AstTreeStorage;
|
||||
|
||||
public:
|
||||
Clause(int uid) : Tree(uid) {}
|
||||
explicit Clause(int uid) : Tree(uid) {}
|
||||
|
||||
Clause *Clone(AstTreeStorage &storage) const override = 0;
|
||||
};
|
||||
@ -1135,14 +1134,14 @@ class Query : public Tree {
|
||||
std::vector<Clause *> clauses_;
|
||||
|
||||
protected:
|
||||
Query(int uid) : Tree(uid) {}
|
||||
explicit Query(int uid) : Tree(uid) {}
|
||||
};
|
||||
|
||||
class Create : public Clause {
|
||||
friend class AstTreeStorage;
|
||||
|
||||
public:
|
||||
Create(int uid) : Clause(uid) {}
|
||||
explicit Create(int uid) : Clause(uid) {}
|
||||
DEFVISITABLE(TreeVisitor<TypedValue>);
|
||||
bool Accept(HierarchicalTreeVisitor &visitor) override {
|
||||
if (visitor.PreVisit(*this)) {
|
||||
@ -1199,7 +1198,7 @@ class Match : public Clause {
|
||||
bool optional_ = false;
|
||||
|
||||
protected:
|
||||
Match(int uid) : Clause(uid) {}
|
||||
explicit Match(int uid) : Clause(uid) {}
|
||||
Match(int uid, bool optional) : Clause(uid), optional_(optional) {}
|
||||
};
|
||||
|
||||
@ -1266,7 +1265,7 @@ class Return : public Clause {
|
||||
ReturnBody body_;
|
||||
|
||||
protected:
|
||||
Return(int uid) : Clause(uid) {}
|
||||
explicit Return(int uid) : Clause(uid) {}
|
||||
};
|
||||
|
||||
class With : public Clause {
|
||||
@ -1309,7 +1308,7 @@ class With : public Clause {
|
||||
Where *where_ = nullptr;
|
||||
|
||||
protected:
|
||||
With(int uid) : Clause(uid) {}
|
||||
explicit With(int uid) : Clause(uid) {}
|
||||
};
|
||||
|
||||
class Delete : public Clause {
|
||||
@ -1339,7 +1338,7 @@ class Delete : public Clause {
|
||||
bool detach_ = false;
|
||||
|
||||
protected:
|
||||
Delete(int uid) : Clause(uid) {}
|
||||
explicit Delete(int uid) : Clause(uid) {}
|
||||
};
|
||||
|
||||
class SetProperty : public Clause {
|
||||
@ -1363,7 +1362,7 @@ class SetProperty : public Clause {
|
||||
Expression *expression_ = nullptr;
|
||||
|
||||
protected:
|
||||
SetProperty(int uid) : Clause(uid) {}
|
||||
explicit SetProperty(int uid) : Clause(uid) {}
|
||||
SetProperty(int uid, PropertyLookup *property_lookup, Expression *expression)
|
||||
: Clause(uid),
|
||||
property_lookup_(property_lookup),
|
||||
@ -1392,7 +1391,7 @@ class SetProperties : public Clause {
|
||||
bool update_ = false;
|
||||
|
||||
protected:
|
||||
SetProperties(int uid) : Clause(uid) {}
|
||||
explicit SetProperties(int uid) : Clause(uid) {}
|
||||
SetProperties(int uid, Identifier *identifier, Expression *expression,
|
||||
bool update = false)
|
||||
: Clause(uid),
|
||||
@ -1421,7 +1420,7 @@ class SetLabels : public Clause {
|
||||
std::vector<GraphDbTypes::Label> labels_;
|
||||
|
||||
protected:
|
||||
SetLabels(int uid) : Clause(uid) {}
|
||||
explicit SetLabels(int uid) : Clause(uid) {}
|
||||
SetLabels(int uid, Identifier *identifier,
|
||||
const std::vector<GraphDbTypes::Label> &labels)
|
||||
: Clause(uid), identifier_(identifier), labels_(labels) {}
|
||||
@ -1446,7 +1445,7 @@ class RemoveProperty : public Clause {
|
||||
PropertyLookup *property_lookup_ = nullptr;
|
||||
|
||||
protected:
|
||||
RemoveProperty(int uid) : Clause(uid) {}
|
||||
explicit RemoveProperty(int uid) : Clause(uid) {}
|
||||
RemoveProperty(int uid, PropertyLookup *property_lookup)
|
||||
: Clause(uid), property_lookup_(property_lookup) {}
|
||||
};
|
||||
@ -1471,7 +1470,7 @@ class RemoveLabels : public Clause {
|
||||
std::vector<GraphDbTypes::Label> labels_;
|
||||
|
||||
protected:
|
||||
RemoveLabels(int uid) : Clause(uid) {}
|
||||
explicit RemoveLabels(int uid) : Clause(uid) {}
|
||||
RemoveLabels(int uid, Identifier *identifier,
|
||||
const std::vector<GraphDbTypes::Label> &labels)
|
||||
: Clause(uid), identifier_(identifier), labels_(labels) {}
|
||||
@ -1522,7 +1521,7 @@ class Merge : public Clause {
|
||||
std::vector<Clause *> on_create_;
|
||||
|
||||
protected:
|
||||
Merge(int uid) : Clause(uid) {}
|
||||
explicit Merge(int uid) : Clause(uid) {}
|
||||
};
|
||||
|
||||
class Unwind : public Clause {
|
||||
|
@ -21,7 +21,7 @@ using query::Context;
|
||||
|
||||
class CypherMainVisitor : public antlropencypher::CypherBaseVisitor {
|
||||
public:
|
||||
CypherMainVisitor(Context &ctx) : ctx_(ctx) {}
|
||||
explicit CypherMainVisitor(Context &ctx) : ctx_(ctx) {}
|
||||
|
||||
private:
|
||||
Expression *CreateBinaryOperatorByToken(size_t token, Expression *e1,
|
||||
|
@ -18,12 +18,13 @@ namespace query {
|
||||
/// variable types.
|
||||
class SymbolGenerator : public HierarchicalTreeVisitor {
|
||||
public:
|
||||
SymbolGenerator(SymbolTable &symbol_table) : symbol_table_(symbol_table) {}
|
||||
explicit SymbolGenerator(SymbolTable &symbol_table)
|
||||
: symbol_table_(symbol_table) {}
|
||||
|
||||
using HierarchicalTreeVisitor::PreVisit;
|
||||
using typename HierarchicalTreeVisitor::ReturnType;
|
||||
using HierarchicalTreeVisitor::Visit;
|
||||
using HierarchicalTreeVisitor::PostVisit;
|
||||
using HierarchicalTreeVisitor::PreVisit;
|
||||
using HierarchicalTreeVisitor::Visit;
|
||||
using typename HierarchicalTreeVisitor::ReturnType;
|
||||
|
||||
// Clauses
|
||||
bool PreVisit(Create &) override;
|
||||
|
@ -50,6 +50,7 @@ class Symbol {
|
||||
|
||||
class SymbolTable {
|
||||
public:
|
||||
SymbolTable() {}
|
||||
Symbol CreateSymbol(const std::string &name, bool user_declared,
|
||||
Symbol::Type type = Symbol::Type::Any,
|
||||
int token_position = -1) {
|
||||
|
@ -18,7 +18,7 @@ namespace query {
|
||||
class Path {
|
||||
public:
|
||||
/** Creates the path starting with the given vertex. */
|
||||
Path(const VertexAccessor &vertex) { Expand(vertex); }
|
||||
explicit Path(const VertexAccessor &vertex) { Expand(vertex); }
|
||||
|
||||
/** Creates the path starting with the given vertex and containing all other
|
||||
* elements. */
|
||||
|
@ -206,8 +206,9 @@ void CreateExpand::CreateExpandCursor::CreateEdge(
|
||||
template <class TVerticesFun>
|
||||
class ScanAllCursor : public Cursor {
|
||||
public:
|
||||
ScanAllCursor(Symbol output_symbol, std::unique_ptr<Cursor> input_cursor,
|
||||
TVerticesFun get_vertices, GraphDbAccessor &db)
|
||||
explicit ScanAllCursor(Symbol output_symbol,
|
||||
std::unique_ptr<Cursor> &&input_cursor,
|
||||
TVerticesFun &&get_vertices, GraphDbAccessor &db)
|
||||
: output_symbol_(output_symbol),
|
||||
input_cursor_(std::move(input_cursor)),
|
||||
get_vertices_(std::move(get_vertices)),
|
||||
@ -1132,7 +1133,7 @@ bool Filter::FilterCursor::Pull(Frame &frame, Context &context) {
|
||||
void Filter::FilterCursor::Reset() { input_cursor_->Reset(); }
|
||||
|
||||
Produce::Produce(const std::shared_ptr<LogicalOperator> &input,
|
||||
const std::vector<NamedExpression *> named_expressions)
|
||||
const std::vector<NamedExpression *> &named_expressions)
|
||||
: input_(input ? input : std::make_shared<Once>()),
|
||||
named_expressions_(named_expressions) {}
|
||||
|
||||
@ -2160,9 +2161,9 @@ bool OrderBy::TypedValueVectorCompare::operator()(
|
||||
return (c1_it == c1.end()) && (c2_it != c2.end());
|
||||
}
|
||||
|
||||
Merge::Merge(const std::shared_ptr<LogicalOperator> input,
|
||||
const std::shared_ptr<LogicalOperator> merge_match,
|
||||
const std::shared_ptr<LogicalOperator> merge_create)
|
||||
Merge::Merge(const std::shared_ptr<LogicalOperator> &input,
|
||||
const std::shared_ptr<LogicalOperator> &merge_match,
|
||||
const std::shared_ptr<LogicalOperator> &merge_create)
|
||||
: input_(input ? input : std::make_shared<Once>()),
|
||||
merge_match_(merge_match),
|
||||
merge_create_(merge_create) {}
|
||||
|
@ -110,10 +110,10 @@ class HierarchicalLogicalOperatorVisitor
|
||||
: public LogicalOperatorCompositeVisitor,
|
||||
public LogicalOperatorLeafVisitor {
|
||||
public:
|
||||
using LogicalOperatorCompositeVisitor::PreVisit;
|
||||
using LogicalOperatorCompositeVisitor::PostVisit;
|
||||
using typename LogicalOperatorLeafVisitor::ReturnType;
|
||||
using LogicalOperatorCompositeVisitor::PreVisit;
|
||||
using LogicalOperatorLeafVisitor::Visit;
|
||||
using typename LogicalOperatorLeafVisitor::ReturnType;
|
||||
};
|
||||
|
||||
/** @brief Base class for logical operators.
|
||||
@ -160,6 +160,7 @@ class Once : public LogicalOperator {
|
||||
private:
|
||||
class OnceCursor : public Cursor {
|
||||
public:
|
||||
OnceCursor() {}
|
||||
bool Pull(Frame &, Context &) override;
|
||||
void Reset() override;
|
||||
|
||||
@ -727,7 +728,7 @@ class Filter : public LogicalOperator {
|
||||
class Produce : public LogicalOperator {
|
||||
public:
|
||||
Produce(const std::shared_ptr<LogicalOperator> &input,
|
||||
const std::vector<NamedExpression *> named_expressions);
|
||||
const std::vector<NamedExpression *> &named_expressions);
|
||||
bool Accept(HierarchicalLogicalOperatorVisitor &visitor) override;
|
||||
std::unique_ptr<Cursor> MakeCursor(GraphDbAccessor &db) const override;
|
||||
std::vector<Symbol> OutputSymbols(const SymbolTable &) const override;
|
||||
@ -1312,7 +1313,7 @@ class OrderBy : public LogicalOperator {
|
||||
class TypedValueVectorCompare {
|
||||
public:
|
||||
TypedValueVectorCompare() {}
|
||||
TypedValueVectorCompare(const std::vector<Ordering> &ordering)
|
||||
explicit TypedValueVectorCompare(const std::vector<Ordering> &ordering)
|
||||
: ordering_(ordering) {}
|
||||
bool operator()(const std::vector<TypedValue> &c1,
|
||||
const std::vector<TypedValue> &c2) const;
|
||||
@ -1370,9 +1371,9 @@ class OrderBy : public LogicalOperator {
|
||||
*/
|
||||
class Merge : public LogicalOperator {
|
||||
public:
|
||||
Merge(const std::shared_ptr<LogicalOperator> input,
|
||||
const std::shared_ptr<LogicalOperator> merge_match,
|
||||
const std::shared_ptr<LogicalOperator> merge_create);
|
||||
Merge(const std::shared_ptr<LogicalOperator> &input,
|
||||
const std::shared_ptr<LogicalOperator> &merge_match,
|
||||
const std::shared_ptr<LogicalOperator> &merge_create);
|
||||
bool Accept(HierarchicalLogicalOperatorVisitor &visitor) override;
|
||||
std::unique_ptr<Cursor> MakeCursor(GraphDbAccessor &db) const override;
|
||||
|
||||
|
@ -406,7 +406,7 @@ FilterInfo Filters::AnalyzeFilter(Expression *expr,
|
||||
if (auto *labels_test = dynamic_cast<LabelsTest *>(expr)) {
|
||||
// Since LabelsTest may contain any expression, we can only use the
|
||||
// simplest test on an identifier.
|
||||
if (auto *ident = dynamic_cast<Identifier *>(labels_test->expression_)) {
|
||||
if (dynamic_cast<Identifier *>(labels_test->expression_)) {
|
||||
filter.type = FilterInfo::Type::Label;
|
||||
filter.labels = labels_test->labels_;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ class Thread {
|
||||
static constexpr unsigned MAIN_THREAD = 0;
|
||||
|
||||
template <class F>
|
||||
Thread(F f) {
|
||||
explicit Thread(F f) {
|
||||
thread_id = thread_counter.fetch_add(1, std::memory_order_acq_rel);
|
||||
thread = std::thread([this, f]() { start_thread(f); });
|
||||
}
|
||||
|
@ -38,7 +38,8 @@ class CommitLog {
|
||||
COMMITTED = 1, // 01
|
||||
ABORTED = 2, // 10
|
||||
};
|
||||
Info(uint8_t flags) : flags_(flags) {}
|
||||
|
||||
explicit Info(uint8_t flags) : flags_(flags) {}
|
||||
|
||||
bool is_active() const { return flags_ == ACTIVE; }
|
||||
|
||||
@ -57,4 +58,4 @@ class CommitLog {
|
||||
private:
|
||||
DynamicBitset<uint8_t, 32768> log;
|
||||
};
|
||||
}
|
||||
} // namespace tx
|
||||
|
@ -41,8 +41,8 @@ class BasicException : public std::exception {
|
||||
*
|
||||
* @param message The error message.
|
||||
*/
|
||||
explicit BasicException(const std::string &message) noexcept : msg_(message) {
|
||||
}
|
||||
explicit BasicException(const std::string &message) noexcept
|
||||
: msg_(message) {}
|
||||
|
||||
/**
|
||||
* @brief Constructor with format string (C++ STL strings).
|
||||
@ -64,8 +64,8 @@ class BasicException : public std::exception {
|
||||
*/
|
||||
template <class... Args>
|
||||
explicit BasicException(const char *format, Args &&... args) noexcept
|
||||
: BasicException(fmt::format(std::string(format),
|
||||
std::forward<Args>(args)...)) {}
|
||||
: BasicException(
|
||||
fmt::format(std::string(format), std::forward<Args>(args)...)) {}
|
||||
|
||||
/**
|
||||
* @brief Virtual destructor to allow for subclassing.
|
||||
@ -111,10 +111,7 @@ class StacktraceException : public std::exception {
|
||||
* with the caller.
|
||||
*/
|
||||
explicit StacktraceException(const char *message) noexcept
|
||||
: message_(message) {
|
||||
Stacktrace stacktrace;
|
||||
stacktrace_ = stacktrace.dump();
|
||||
}
|
||||
: message_(message), stacktrace_(Stacktrace().dump()) {}
|
||||
|
||||
/**
|
||||
* @brief Constructor (C++ STL strings).
|
||||
@ -122,10 +119,7 @@ class StacktraceException : public std::exception {
|
||||
* @param message The error message.
|
||||
*/
|
||||
explicit StacktraceException(const std::string &message) noexcept
|
||||
: message_(message) {
|
||||
Stacktrace stacktrace;
|
||||
stacktrace_ = stacktrace.dump();
|
||||
}
|
||||
: message_(message), stacktrace_(Stacktrace().dump()) {}
|
||||
|
||||
/**
|
||||
* @brief Constructor with format string (C++ STL strings).
|
||||
@ -148,8 +142,8 @@ class StacktraceException : public std::exception {
|
||||
*/
|
||||
template <class... Args>
|
||||
explicit StacktraceException(const char *format, Args &&... args) noexcept
|
||||
: StacktraceException(fmt::format(std::string(format),
|
||||
std::forward<Args>(args)...)) {}
|
||||
: StacktraceException(
|
||||
fmt::format(std::string(format), std::forward<Args>(args)...)) {}
|
||||
|
||||
/**
|
||||
* @brief Virtual destructor to allow for subclassing.
|
||||
|
@ -13,7 +13,7 @@
|
||||
class Executor {
|
||||
public:
|
||||
template <typename TRep, typename TPeriod>
|
||||
Executor(const std::chrono::duration<TRep, TPeriod> pause) {
|
||||
explicit Executor(const std::chrono::duration<TRep, TPeriod> pause) {
|
||||
if (pause != pause.zero())
|
||||
scheduler_.Run(pause, std::bind(&Executor::Execute, this));
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ __attribute__((unused)) uint64_t fnv(const std::string &s) {
|
||||
|
||||
using HashType = uint64_t;
|
||||
|
||||
#elif
|
||||
#else
|
||||
|
||||
__attribute__((unused)) uint32_t fnv(const std::string &s) {
|
||||
return fnv1a32(s);
|
||||
|
@ -25,10 +25,11 @@ namespace utils {
|
||||
*/
|
||||
class OnScopeExit {
|
||||
public:
|
||||
OnScopeExit(const std::function<void()> function) : function_(function) {}
|
||||
explicit OnScopeExit(const std::function<void()> &function)
|
||||
: function_(function) {}
|
||||
~OnScopeExit() { function_(); }
|
||||
|
||||
private:
|
||||
std::function<void()> function_;
|
||||
};
|
||||
}
|
||||
} // namespace utils
|
||||
|
@ -11,6 +11,7 @@ class Stacktrace {
|
||||
public:
|
||||
class Line {
|
||||
public:
|
||||
// cppcheck-suppress noExplicitConstructor
|
||||
Line(const std::string &original) : original(original) {}
|
||||
|
||||
Line(const std::string &original, const std::string &function,
|
||||
|
@ -19,7 +19,26 @@ else
|
||||
files=src/
|
||||
flags="-j$THREADS -Isrc"
|
||||
fi
|
||||
cppcheck --enable=all --force --suppress=missingInclude --suppress=unusedFunction --suppress=unusedStructMember $flags $files 2>"$tmpfile"
|
||||
|
||||
cat > .cppcheck_suppressions <<EOF
|
||||
// supress all explicit constructor warnings since we use the implicit conversion all over the codebase
|
||||
noExplicitConstructor:src/storage/property_value.hpp
|
||||
noExplicitConstructor:src/query/typed_value.hpp
|
||||
noExplicitConstructor:src/communication/bolt/v1/decoder/decoded_value.hpp
|
||||
|
||||
// suppress antrl warnings
|
||||
variableScope:src/query/frontend/opencypher/generated/CypherParser.h
|
||||
variableScope:src/query/frontend/opencypher/generated/CypherLexer.h
|
||||
variableScope:src/query/frontend/opencypher/generated/CypherParser.cpp
|
||||
|
||||
// supress all warnings of this type in the codebase
|
||||
missingInclude
|
||||
unusedFunction
|
||||
unusedStructMember
|
||||
EOF
|
||||
|
||||
cppcheck --enable=all --inline-suppr --force --suppressions-list=.cppcheck_suppressions $flags $files 2>"$tmpfile"
|
||||
rm .cppcheck_suppressions
|
||||
|
||||
cat "$tmpfile" | grep -v "(information) Unmatched suppression" > "$errfile"
|
||||
rm $tmpfile
|
||||
|
Loading…
Reference in New Issue
Block a user