gcc: Add extra parens to quell warnings.

Even though we're not incorrect about operator precedence, let's add
some parens in some particularly confusing places to placate GCC 4.3
so that we don't have to turn the warning off.  Agreed that this is a
bit of a pain for those users who get the order of operations correct,
but it is likely to prevent bugs in certain cases.
This commit is contained in:
Nathan Binkert
2008-09-27 21:03:49 -07:00
parent cf7ddd8e8a
commit 80d9be86e6
21 changed files with 57 additions and 57 deletions

View File

@@ -208,7 +208,7 @@ CircleBuf::write(const char *b, int len)
_rollover = true;
}
if (old_start > old_stop && old_start < _stop ||
old_start < old_stop && _stop < old_stop)
if ((old_start > old_stop && old_start < _stop) ||
(old_start < old_stop && _stop < old_stop))
_start = _stop + 1;
}

View File

@@ -197,9 +197,9 @@ roundDown(T val, int align)
inline bool
isHex(char c)
{
return c >= '0' && c <= '9' ||
c >= 'A' && c <= 'F' ||
c >= 'a' && c <= 'f';
return (c >= '0' && c <= '9') ||
(c >= 'A' && c <= 'F') ||
(c >= 'a' && c <= 'f');
}
inline bool

View File

@@ -123,15 +123,15 @@ Random::genrand()
int kk;
for (kk = 0; kk < N - M; kk++) {
y = mt[kk] & UPPER_MASK | mt[kk+1] & LOWER_MASK;
y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
mt[kk] = mt[kk + M] ^ (y >> 1) ^ mag01[y & 0x1UL];
}
for (; kk < N - 1; kk++) {
y = mt[kk] & UPPER_MASK | mt[kk+1] & LOWER_MASK;
y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
mt[kk] = mt[kk + (M - N)] ^ (y >> 1) ^ mag01[y & 0x1UL];
}
y = mt[N - 1] & UPPER_MASK | mt[0] & LOWER_MASK;
y = (mt[N - 1] & UPPER_MASK) | (mt[0] & LOWER_MASK);
mt[N - 1] = mt[M - 1] ^ (y >> 1) ^ mag01[y & 0x1UL];
mti = 0;

View File

@@ -191,8 +191,8 @@ struct ScalarPrint
void
ScalarPrint::operator()(ostream &stream) const
{
if (flags & nozero && value == 0.0 ||
flags & nonan && isnan(value))
if ((flags & nozero && value == 0.0) ||
(flags & nonan && isnan(value)))
return;
stringstream pdfstr, cdfstr;
@@ -474,8 +474,8 @@ DistPrint::operator()(ostream &stream) const
print.flags = flags | __substat;
for (int i = 0; i < size; ++i) {
if (flags & nozero && vec[i] == 0.0 ||
flags & nonan && isnan(vec[i]))
if ((flags & nozero && vec[i] == 0.0) ||
(flags & nonan && isnan(vec[i])))
continue;
_min = i * bucket_size + min;