Merge pull request #1303 from ajbeamon/fix-compiler-warnings
Fix various compiler warnings
This commit is contained in:
commit
0010d500c5
|
@ -65,7 +65,7 @@ void parse( std::vector<RegionInfo>* regions, ValueRef const& v ) {
|
|||
RegionInfo info;
|
||||
json_spirit::mArray datacenters;
|
||||
dc.get("datacenters", datacenters);
|
||||
int nonSatelliteDatacenters = 0;
|
||||
bool foundNonSatelliteDatacenter = false;
|
||||
for (StatusObjectReader s : datacenters) {
|
||||
std::string idStr;
|
||||
if (s.has("satellite") && s.last().get_int() == 1) {
|
||||
|
@ -75,15 +75,15 @@ void parse( std::vector<RegionInfo>* regions, ValueRef const& v ) {
|
|||
s.get("priority", satInfo.priority);
|
||||
info.satellites.push_back(satInfo);
|
||||
} else {
|
||||
if (nonSatelliteDatacenters > 0) throw invalid_option();
|
||||
nonSatelliteDatacenters++;
|
||||
if (foundNonSatelliteDatacenter) throw invalid_option();
|
||||
foundNonSatelliteDatacenter = true;
|
||||
s.get("id", idStr);
|
||||
info.dcId = idStr;
|
||||
s.get("priority", info.priority);
|
||||
}
|
||||
}
|
||||
std::sort(info.satellites.begin(), info.satellites.end(), SatelliteInfo::sort_by_priority() );
|
||||
if (nonSatelliteDatacenters != 1) throw invalid_option();
|
||||
if (!foundNonSatelliteDatacenter) throw invalid_option();
|
||||
dc.tryGet("satellite_logs", info.satelliteDesiredTLogCount);
|
||||
std::string satelliteReplication;
|
||||
if(dc.tryGet("satellite_redundancy_mode", satelliteReplication)) {
|
||||
|
@ -133,7 +133,7 @@ void parse( std::vector<RegionInfo>* regions, ValueRef const& v ) {
|
|||
regions->push_back(info);
|
||||
}
|
||||
std::sort(regions->begin(), regions->end(), RegionInfo::sort_by_priority() );
|
||||
} catch( Error &e ) {
|
||||
} catch (Error&) {
|
||||
regions->clear();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -88,8 +88,8 @@ struct CommitTransactionRequest : TimedRequest {
|
|||
FLAG_FIRST_IN_BATCH = 0x2
|
||||
};
|
||||
|
||||
bool isLockAware() const { return flags & FLAG_IS_LOCK_AWARE; }
|
||||
bool firstInBatch() const { return flags & FLAG_FIRST_IN_BATCH; }
|
||||
bool isLockAware() const { return (flags & FLAG_IS_LOCK_AWARE) != 0; }
|
||||
bool firstInBatch() const { return (flags & FLAG_FIRST_IN_BATCH) != 0; }
|
||||
|
||||
Arena arena;
|
||||
CommitTransactionRef transaction;
|
||||
|
|
|
@ -1436,7 +1436,7 @@ THREAD_FUNC releaseMem(void *arg) {
|
|||
// Must get for releaseMemory to work
|
||||
((ThreadSingleAssignmentVar<int>*)arg)->get();
|
||||
}
|
||||
catch(Error &e) {
|
||||
catch(Error&) {
|
||||
// Swallow
|
||||
}
|
||||
try {
|
||||
|
|
|
@ -2505,7 +2505,7 @@ void Transaction::setupWatches() {
|
|||
|
||||
watches.clear();
|
||||
}
|
||||
catch(Error &e) {
|
||||
catch(Error&) {
|
||||
ASSERT(false); // The above code must NOT throw because commit has already occured.
|
||||
throw internal_error();
|
||||
}
|
||||
|
|
|
@ -220,7 +220,7 @@ void JSONDoc::mergeValueInto(json_spirit::mValue &dst, const json_spirit::mValue
|
|||
try {
|
||||
dst = mergeOperator<json_spirit::mValue>(op, aObj, bObj, a, b);
|
||||
return;
|
||||
} catch(std::exception &e) {
|
||||
} catch(std::exception&) {
|
||||
}
|
||||
|
||||
// Now try type and type pair specific operators
|
||||
|
@ -441,7 +441,7 @@ StatusObject getClientDatabaseStatus(StatusObjectReader client, StatusObjectRead
|
|||
|| !client.at("cluster_file.up_to_date").get_bool());
|
||||
}
|
||||
}
|
||||
catch(std::exception &e)
|
||||
catch(std::exception&)
|
||||
{
|
||||
// As documented above, exceptions leave isAvailable and isHealthy in the right state
|
||||
}
|
||||
|
|
|
@ -524,7 +524,7 @@ public:
|
|||
|
||||
// Check all available priorities for keys
|
||||
state std::vector<Future<Standalone<RangeResultRef>>> resultFutures;
|
||||
for(unsigned int pri = 0; pri <= CLIENT_KNOBS->TASKBUCKET_MAX_PRIORITY; ++pri)
|
||||
for(int pri = 0; pri <= CLIENT_KNOBS->TASKBUCKET_MAX_PRIORITY; ++pri)
|
||||
resultFutures.push_back(tr->getRange(taskBucket->getAvailableSpace(pri).range(), 1));
|
||||
|
||||
// If any priority levels have any keys then the taskbucket is not empty so return false
|
||||
|
@ -547,7 +547,7 @@ public:
|
|||
|
||||
// Check all available priorities for emptiness
|
||||
state std::vector<Future<Standalone<RangeResultRef>>> resultFutures;
|
||||
for(unsigned int pri = 0; pri <= CLIENT_KNOBS->TASKBUCKET_MAX_PRIORITY; ++pri)
|
||||
for(int pri = 0; pri <= CLIENT_KNOBS->TASKBUCKET_MAX_PRIORITY; ++pri)
|
||||
resultFutures.push_back(tr->getRange(taskBucket->getAvailableSpace(pri).range(), 1));
|
||||
|
||||
// If any priority levels have any keys then return true as the level is 'busy'
|
||||
|
|
|
@ -1111,7 +1111,7 @@ int FlowTransport::getEndpointCount() {
|
|||
}
|
||||
|
||||
bool FlowTransport::incompatibleOutgoingConnectionsPresent() {
|
||||
return self->numIncompatibleConnections;
|
||||
return self->numIncompatibleConnections > 0;
|
||||
}
|
||||
|
||||
void FlowTransport::createInstance( uint64_t transportId )
|
||||
|
|
|
@ -79,7 +79,7 @@ struct IReplicationPolicy : public ReferenceCounted<IReplicationPolicy> {
|
|||
|
||||
template <class Archive>
|
||||
inline void load( Archive& ar, Reference<IReplicationPolicy>& value ) {
|
||||
bool present = (value.getPtr());
|
||||
bool present;
|
||||
ar >> present;
|
||||
if (present) {
|
||||
serializeReplicationPolicy(ar, value);
|
||||
|
@ -91,7 +91,7 @@ inline void load( Archive& ar, Reference<IReplicationPolicy>& value ) {
|
|||
|
||||
template <class Archive>
|
||||
inline void save( Archive& ar, const Reference<IReplicationPolicy>& value ) {
|
||||
bool present = (value.getPtr());
|
||||
bool present = (value.getPtr() != nullptr);
|
||||
ar << present;
|
||||
if (present) {
|
||||
serializeReplicationPolicy(ar, (Reference<IReplicationPolicy>&) value);
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "flow/flow.h"
|
||||
#include "fdbrpc/Locality.h"
|
||||
|
||||
class LocalityData;
|
||||
struct LocalityData;
|
||||
struct LocalitySet;
|
||||
struct LocalityGroup;
|
||||
struct KeyValueMap;
|
||||
|
|
|
@ -38,8 +38,7 @@ double ratePolicy(
|
|||
std::map<LocalityEntry, int> counterMap;
|
||||
std::vector<LocalityEntry> results;
|
||||
|
||||
for (auto testIndex = 0; testIndex < nTestTotal; testIndex ++)
|
||||
{
|
||||
for (auto testIndex = 0u; testIndex < nTestTotal; testIndex++) {
|
||||
results.clear();
|
||||
if (!policy->selectReplicas(localitySet, results)) {
|
||||
printf("Failed to apply policy: %s to %d entries\n", policy->info().c_str(), localitySet->size());
|
||||
|
@ -101,8 +100,7 @@ bool findBestPolicySet(
|
|||
localitySet->DisplayEntries();
|
||||
}
|
||||
|
||||
for (auto policyTest=0; policyTest < nPolicyTests; policyTest ++)
|
||||
{
|
||||
for (auto policyTest = 0u; policyTest < nPolicyTests; policyTest++) {
|
||||
results.clear();
|
||||
if (!policy->selectReplicas(localitySet, results)) {
|
||||
bSucceeded = false;
|
||||
|
@ -179,8 +177,7 @@ bool findBestUniquePolicySet(
|
|||
localitySet->DisplayEntries();
|
||||
}
|
||||
|
||||
for (auto policyTest=0; policyTest < nPolicyTests; policyTest ++)
|
||||
{
|
||||
for (auto policyTest = 0u; policyTest < nPolicyTests; policyTest++) {
|
||||
results.clear();
|
||||
if (!policy->selectReplicas(localitySet, results)) {
|
||||
bSucceeded = false;
|
||||
|
@ -377,7 +374,7 @@ Reference<LocalitySet> createTestLocalityMap(std::vector<repTestType>& indexes,
|
|||
{
|
||||
Reference<LocalitySet> buildServer(new LocalityMap<repTestType>());
|
||||
LocalityMap<repTestType>* serverMap = (LocalityMap<repTestType>*) buildServer.getPtr();
|
||||
int serverValue, dcLoop, szLoop, rackLoop, slotLoop;
|
||||
int serverValue;
|
||||
std::string dcText, szText, rackText, slotText, independentName, independentText;
|
||||
|
||||
// Determine the total size
|
||||
|
@ -465,7 +462,6 @@ bool testPolicy(
|
|||
std::string outputText, includeText;
|
||||
std::vector<LocalityEntry> entryResults;
|
||||
std::vector<repTestType*> results;
|
||||
int resultsTotal;
|
||||
bool valid, solved;
|
||||
|
||||
if (g_replicationdebug > 1) {
|
||||
|
@ -513,7 +509,7 @@ bool testPolicy(
|
|||
outputText = policy->info() + includeText + ((solved) ? " -> None" : " -> No solution");
|
||||
}
|
||||
|
||||
printf("%-5s:%3d %s\n", (valid) ? "Valid" : "Error", resultsTotal, outputText.c_str());
|
||||
printf("%-5s:%3d %s\n", (valid) ? "Valid" : "Error", 0, outputText.c_str());
|
||||
}
|
||||
|
||||
return valid;
|
||||
|
|
|
@ -256,7 +256,7 @@ ACTOR Future<Void> leaderRegister(LeaderElectionRegInterface interf, Key key) {
|
|||
LeaderInfo newInfo;
|
||||
newInfo.forward = true;
|
||||
newInfo.serializedInfo = req.conn.toString();
|
||||
for(int i=0; i<notify.size(); i++)
|
||||
for(unsigned int i=0; i<notify.size(); i++)
|
||||
notify[i].send( newInfo );
|
||||
notify.clear();
|
||||
req.reply.send( Void() );
|
||||
|
@ -294,7 +294,7 @@ ACTOR Future<Void> leaderRegister(LeaderElectionRegInterface interf, Key key) {
|
|||
if ( !nextNominee.present() || !foundCurrentNominee || currentNominee.get().leaderChangeRequired(nextNominee.get()) ) {
|
||||
TraceEvent("NominatingLeader").detail("Nominee", nextNominee.present() ? nextNominee.get().changeID : UID())
|
||||
.detail("Changed", nextNominee != currentNominee).detail("Key", printable(key));
|
||||
for(int i=0; i<notify.size(); i++)
|
||||
for(unsigned int i=0; i<notify.size(); i++)
|
||||
notify[i].send( nextNominee );
|
||||
notify.clear();
|
||||
currentNominee = nextNominee;
|
||||
|
|
|
@ -525,7 +525,7 @@ public:
|
|||
return r;
|
||||
}
|
||||
StringRef eat(const char *sep) {
|
||||
return eat(StringRef((const uint8_t *)sep, strlen(sep)));
|
||||
return eat(StringRef((const uint8_t *)sep, (int)strlen(sep)));
|
||||
}
|
||||
// Return StringRef of bytes from begin() up to but not including the first byte matching any byte in sep,
|
||||
// and remove that sequence (including the sep byte) from *this
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
uint64_t v = (gen64() % range);
|
||||
int i;
|
||||
if (min < 0 && ((unsigned int) -min) > v)
|
||||
i = -(((unsigned int) -min) - v);
|
||||
i = -(int)(((unsigned int) -min) - v);
|
||||
else
|
||||
i = v + min;
|
||||
if (randLog && g_random==this) fprintf(randLog, "Rint %d\n", i);
|
||||
|
@ -83,7 +83,7 @@ public:
|
|||
uint64_t v = (gen64() % range);
|
||||
int64_t i;
|
||||
if (min < 0 && ((uint64_t) -min) > v)
|
||||
i = -(((uint64_t) -min) - v);
|
||||
i = -(int64_t)(((uint64_t) -min) - v);
|
||||
else
|
||||
i = v + min;
|
||||
if (randLog && g_random==this) fprintf(randLog, "Rint64 %" PRId64 "\n", i);
|
||||
|
|
|
@ -170,7 +170,7 @@ void FileTraceLogWriter::cleanupTraceFiles() {
|
|||
// reverse sort, so we preserve the most recent files and delete the oldest
|
||||
std::sort(existingTraceFiles.begin(), existingTraceFiles.end(), FileTraceLogWriter::reverseCompareTraceFileName);
|
||||
|
||||
int64_t runningTotal = 0;
|
||||
uint64_t runningTotal = 0;
|
||||
std::vector<std::string>::iterator fileListIterator = existingTraceFiles.begin();
|
||||
|
||||
while(runningTotal < maxLogsSize && fileListIterator != existingTraceFiles.end()) {
|
||||
|
|
|
@ -735,7 +735,7 @@ void Net2::checkForSlowTask(int64_t tscBegin, int64_t tscEnd, double duration, i
|
|||
if (elapsed > FLOW_KNOBS->TSC_YIELD_TIME && tscBegin > 0) {
|
||||
int i = std::min<double>(NetworkMetrics::SLOW_EVENT_BINS-1, log( elapsed/1e6 ) / log(2.));
|
||||
int s = ++networkMetrics.countSlowEvents[i];
|
||||
uint64_t warnThreshold = g_network->isSimulated() ? 10e9 : 500e6;
|
||||
int64_t warnThreshold = g_network->isSimulated() ? 10e9 : 500e6;
|
||||
|
||||
//printf("SlowTask: %d, %d yields\n", (int)(elapsed/1e6), numYields);
|
||||
|
||||
|
|
|
@ -1578,7 +1578,7 @@ void setAffinity(int proc) {
|
|||
printf("Set affinity mask\n");
|
||||
else
|
||||
printf("Failed to set affinity mask: error %d\n", GetLastError());*/
|
||||
SetThreadAffinityMask( GetCurrentThread(), 1UL<<proc );
|
||||
SetThreadAffinityMask( GetCurrentThread(), 1ULL<<proc );
|
||||
#elif defined(__linux__)
|
||||
cpu_set_t set;
|
||||
CPU_ZERO(&set);
|
||||
|
|
|
@ -245,7 +245,7 @@ struct SystemStatistics {
|
|||
|
||||
struct SystemStatisticsState;
|
||||
|
||||
class IPAddress;
|
||||
struct IPAddress;
|
||||
|
||||
SystemStatistics getSystemStatistics(std::string dataFolder, const IPAddress* ip, SystemStatisticsState **statState);
|
||||
|
||||
|
|
Loading…
Reference in New Issue