10000 compilation fixes for clang-10s more strict checking (#11316) · arangodb/arangodb@e4d5a5d · GitHub
[go: up one dir, main page]

Skip to content

Commit e4d5a5d

Browse files
authored
compilation fixes for clang-10s more strict checking (#11316)
1 parent bc13057 commit e4d5a5d

13 files changed

+92
-312
lines changed

CHANGELOG

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
devel
22
-----
33

4+
* Compilation issues with wrong cv-qualifiers and unnecessary
5+
temporary copying.
6+
47
* Add DTRACE points to track a request through the infrastructure.
58

69
* Fixed issue #11275: indexes backward compatibility broken in 3.5+.
710

811
* Updated snowball dependency to the latest version.
9-
More stemmers are available. Built-in analyzer list is unchanged.
12+
More stemmers are available. Built-in analyzer list is unchanged.
1013

1114
* Reactive REST API endpoint at `/_admin/auth/reload`, as it is called by DC2DC.
12-
15+
1316
* Fix an endless loop in FollowerInfo::persistInAgency which could trigger
1417
a hanger if a collection was dropped at the wrong time.
1518

@@ -57,7 +60,7 @@ devel
5760

5861
* Allow to override the detected total amount of memory via an environment
5962
variable ARANGODB_OVERRIDE_DETECTED_TOTAL_MEMORY.
60-
63+
6164
* `splice-subqueries` optimization is not limited by any type of operation within the
6265
subquery any more. It can now be applied on every subquery and will be by default.
6366
However they may be a performance impact on some queries where splice-subqueries

arangod/Agency/FailedLeader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ void FailedLeader::rollback() {
118118
VPackArrayBuilder a(payload.get());
119119
{ // opers
120120
VPackObjectBuilder b(payload.get());
121-
for (auto const c : cs) {
121+
for (auto const& c : cs) {
122122
payload->add(planColPrefix + _database + "/" + c.collection +
123123
"/shards/" + c.shard,
124124
rb.slice());

arangod/Cluster/ClusterMethods.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2294,7 +2294,7 @@ Future<OperationResult> modifyDocumentOnCoordinator(
22942294
VPackBuffer<uint8_t> buffer;
22952295
buffer.append(slice.begin(), slice.byteSize());
22962296

2297-
for (std::pair<ShardID, std::vector<ServerID>> const& shardServers : *shardIds) {
2297+
for (auto const& shardServers : *shardIds) {
22982298
ShardID const& shard = shardServers.first;
22992299
network::Headers headers;
23002300
addTransactionHeaderForShard(trx, *shardIds, shard, headers);

arangod/Pregel/Algos/DMID/DMID.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ struct DMIDComputation : public VertexComputation<DMIDValue, float, DMIDMessage>
511511
int64_t const* iterationCounter = getAggregatedValue<int64_t>(ITERATION_AGG);
512512

513513
size_t m = std::min(getEdgeCount(), messages.size());
514-
for (std::pair<PregelID, float> const& pair : membershipCounter) {
514+
for (auto const& pair : membershipCounter) {
515515
// FIXME
516516
// float const ttt = pair.second / getEdges().size();
517517
float const ttt = pair.second / m;
@@ -615,7 +615,7 @@ struct DMIDGraphFormat : public GraphFormat<DMIDValue, float> {
615615
} else {
616616
// Output for DMID modularity calculator
617617
b.add(_resultField, VPackValue(VPackValueType::Array));
618-
for (std::pair<PregelID, float> const& pair : ptr->membershipDegree) {
618+
for (auto const& pair : ptr->membershipDegree) {
619619
size_t i = arangodb::basics::StringUtils::uint64_trusted(pair.first.key.data(),
620620
pair.first.key.size());
621621
b.openArray();

arangod/Pregel/Algos/DMID/VertexSumAggregator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ struct VertexSumAggregator : public IAggregator {
4343
// if you use thi B41A s from a vertex I will end you
4444
void aggregate(void const* valuePtr) override {
4545
VertexMap const* map = (VertexMap const*)valuePtr;
46-
for (MyPair const& pair1 : *map) {
46+
for (auto const& pair1 : *map) {
4747
for (auto const& pair2 : pair1.second) {
4848
_entries[pair1.first][pair2.first] += pair2.second;
4949
}
@@ -129,7 +129,7 @@ struct VertexSumAggregator : public IAggregator {
129129
for (auto const& pair : _entries) {
130130
PregelShard shard = pair.first;
131131
std::unordered_map<std::string, double> const& vertexMap = pair.second;
132-
for (std::pair<std::string, double> const& vertexMessage : vertexMap) {
132+
for (auto const& vertexMessage : vertexMap) {
133133
func(PregelID(shard, vertexMessage.first), vertexMessage.second);
134134
}
135135
}

arangod/Pregel/Algos/SLPA.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ struct SLPAComputation : public VertexComputation<SLPAValue, int8_t, uint64_t> {
114114
uint64_t cumulativeSum = 0;
115115
// Randomly select a label with probability proportional to the
116116
// occurrence frequency of this label in its memory
117-
for (std::pair<uint64_t, uint64_t> const& e : val->memory) {
117+
for (auto const& e : val->memory) {
118118
cumulativeSum += e.second;
119119
if (cumulativeSum >= random) {
120120
sendMessageToAllNeighbours(e.first);
@@ -159,7 +159,7 @@ struct SLPAGraphFormat : public GraphFormat<SLPAValue, int8_t> {
159159
return false;
160160
} else {
161161
std::vector<std::pair<uint64_t, double>> vec;
162-
for (std::pair<uint64_t, uint64_t> pair : ptr->memory) {
162+
for (auto const& pair : ptr->memory) {
163163
double t = (double)pair.second / ptr->numCommunities;
164164
if (t >= threshold) {
165165
vec.emplace_back(pair.first, t);

arangod/RestServer/Metrics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ void Counter::store(uint64_t const& n) {
101101

102102
void Counter::toPrometheus(std::string& result) const {
103103
_b.push();
104-
result += "#TYPE " + name() + " counter\n";
104+
result += "\n#TYPE " + name() + " counter\n";
105105
result += "#HELP " + name() + " " + help() + "\n";
106106
result += name() + "{" + labels() + "} " + std::to_string(load()) + "\n";
107107
}

arangod/RestServer/Metrics.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ template<typename T> class Gauge : public Metric {
125125
return _g.load();
126126
};
127127
virtual void toPrometheus(std::string& result) const override {
128-
result += "#TYPE " + name() + " gauge\n";
128+
result += "\n#TYPE " + name() + " gauge\n";
129129
result += "#HELP " + name() + " " + help() + "\n";
130130
result += name() + "{" + labels() + "} " + std::to_string(load()) + "\n";
131131
};
@@ -396,7 +396,7 @@ template<typename Scale> class Histogram : public Metric {
396396
size_t size() const { return _c.size(); }
397397

398398
virtual void toPrometheus(std::string& result) const override {
399-
result += "#TYPE " + name() + " histogram\n";
399+
result += "\n#TYPE " + name() + " histogram\n";
400400
result += "#HELP " + name() + " " + help() + "\n";
401401
std::string lbs = labels();
402402
auto const haveLabels = !lbs.empty();

arangod/RestServer/counter.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ template< typename Integral > class strong_duplex
534534
private:
535535
void insert( broker_type* child );
536536
void erase( broker_type* child, Integral by );
537-
std::mutex serializer_;
537+
mutable std::mutex serializer_;
538538
typedef std::unordered_set< broker_type* > set_type;
539539
set_type children_;
540540
};
@@ -640,7 +640,7 @@ template< typename Integral > class weak_duplex
640640
private:
641641
void insert( broker_type* child );
642642
void erase( broker_type* child, Integral by );
643-
std::mutex serializer_;
643+
mutable std::mutex serializer_;
644644
typedef std::unordered_set< broker_type* > set_type;
645645
set_type children_;
646646
};
@@ -821,7 +821,7 @@ template< typename Integral > class strong_duplex_array
821821
private:
822822
void insert( broker_type* child );
823823
void erase( broker_type* child, Integral by );
824-
std::mutex serializer_;
824+
mutable std::mutex serializer_;
825825
typedef std::unordered_set< broker_type* > set_type;
826826
set_type children_;
827827
};
@@ -894,7 +894,7 @@ template< typename Integral > class weak_duplex_array
894894
private:
895895
void insert( broker_type* child );
896896
void erase( broker_type* child, Integral by );
897-
std::mutex serializer_;
897+
mutable std::mutex serializer_;
898898
typedef std::unordered_set< broker_type* > set_type;
899899
set_type children_;
900900
};

0 commit comments

Comments
 (0)
0