Bug 1365321 - remove warnings from faulty
MozReview-Commit-ID: C0ANd5Zpmes
--- a/ipc/glue/Faulty.cpp
+++ b/ipc/glue/Faulty.cpp
@@ -101,38 +101,44 @@ void FuzzIntegralType(T* v, bool largeVa
"T must be an integral type");
switch (random() % 6) {
case 0:
if (largeValues) {
(*v) = RandomIntegral<T>();
break;
}
// Fall through
+ MOZ_FALLTHROUGH;
+
case 1:
if (largeValues) {
(*v) = RandomNumericLimit<T>();
break;
}
// Fall through
+ MOZ_FALLTHROUGH;
+
case 2:
if (largeValues) {
(*v) = RandomIntegerRange<T>(std::numeric_limits<T>::min(),
std::numeric_limits<T>::max());
break;
}
// Fall through
+ MOZ_FALLTHROUGH;
default:
switch(random() % 2) {
case 0:
// Prevent underflow
if (*v != std::numeric_limits<T>::min()) {
(*v)--;
break;
}
// Fall through
+ MOZ_FALLTHROUGH;
case 1:
// Prevent overflow
if (*v != std::numeric_limits<T>::max()) {
(*v)++;
break;
}
}
}
@@ -149,41 +155,45 @@ void FuzzFloatingPointType(T* v, bool la
"T must be a floating point type");
switch (random() % 6) {
case 0:
if (largeValues) {
(*v) = RandomNumericLimit<T>();
break;
}
// Fall through
+ MOZ_FALLTHROUGH;
case 1:
if (largeValues) {
(*v) = RandomFloatingPointRange<T>(std::numeric_limits<T>::min(),
std::numeric_limits<T>::max());
break;
}
// Fall through
+ MOZ_FALLTHROUGH;
default:
(*v) = RandomFloatingPoint<T>();
}
}
/**
* FuzzStringType mutates an incercepted string type of a pickled message.
*/
template <typename T>
void FuzzStringType(T& v, const T& literal1, const T& literal2)
{
switch (random() % 5) {
case 4:
v = v + v;
// Fall through
+ MOZ_FALLTHROUGH;
case 3:
v = v + v;
// Fall through
+ MOZ_FALLTHROUGH;
case 2:
v = v + v;
break;
case 1:
v += literal1;
break;
case 0:
v = literal2;
@@ -517,17 +527,17 @@ Faulty::MutateUInt64(uint64_t* aValue)
void
Faulty::FuzzUInt64(uint64_t* aValue, unsigned int aProbability)
{
if (mIsValidProcessType) {
if (mFuzzPickle && GetChance(aProbability)) {
uint64_t oldValue = *aValue;
MutateUInt64(aValue);
- FAULTY_LOG("pickle field {UInt64} of value: %llu changed to: %llu",
+ FAULTY_LOG("pickle field {UInt64} of value: %" PRIu64 " changed to: %" PRIu64,
oldValue, *aValue);
}
}
}
void
Faulty::MutateInt64(int64_t* aValue)
{
@@ -536,17 +546,17 @@ Faulty::MutateInt64(int64_t* aValue)
void
Faulty::FuzzInt64(int64_t* aValue, unsigned int aProbability)
{
if (mIsValidProcessType) {
if (mFuzzPickle && GetChance(aProbability)) {
int64_t oldValue = *aValue;
MutateInt64(aValue);
- FAULTY_LOG("pickle field {Int64} of value: %lld changed to: %lld",
+ FAULTY_LOG("pickle field {UInt64} of value: %" PRIu64 " changed to: %" PRIu64,
oldValue, *aValue);
}
}
}
void
Faulty::MutateDouble(double* aValue)
{