2017-01-30 Martin Sebor <msebor@redhat.com>
+ * gimple-ssa-sprintf.c (fmtresult::adjust_for_width_or_precision):
+ Move constant to the right of a relational operator.
+ (get_mpfr_format_length, format_character, format_string): Ditto.
+ (should_warn_p, maybe_warn): Same.
+
* doc/invoke.texi (-Wformat-truncation=1): Fix typo.
2017-01-30 Maxim Ostapenko <m.ostapenko@samsung.com>
bool minadjusted = false;
/* Adjust the minimum and likely counters. */
- if (0 <= adjust[0])
+ if (adjust[0] >= 0)
{
if (range.min < (unsigned HOST_WIDE_INT)adjust[0])
{
knownrange = false;
/* Adjust the maximum counter. */
- if (0 < adjust[1])
+ if (adjust[1] > 0)
{
if (range.max < (unsigned HOST_WIDE_INT)adjust[1])
{
{
/* Cap precision arbitrarily at 1KB and add the difference
(if any) to the MPFR result. */
- if (1024 < prec)
+ if (prec > 1024)
p = 1024;
}
res.range.likely = 0;
res.range.unlikely = 0;
}
- else if (0 < min && min < 128)
+ else if (min > 0 && min < 128)
{
/* A wide character in the ASCII range most likely results
in a single byte, and only unlikely in up to MB_LEN_MAX. */
2 * wcslen (S).*/
res.range.likely = res.range.min * 2;
- if (0 <= dir.prec[1]
+ if (dir.prec[1] >= 0
&& (unsigned HOST_WIDE_INT)dir.prec[1] < res.range.max)
{
res.range.max = dir.prec[1];
if (dir.prec[0] < 0 && dir.prec[1] > -1)
res.range.min = 0;
- else if (0 <= dir.prec[0])
+ else if (dir.prec[0] >= 0)
res.range.likely = dir.prec[0];
/* Even a non-empty wide character string need not convert into
in mode 2, and the maximum is PRECISION or -1 to disable
tracking. */
- if (0 <= dir.prec[0])
+ if (dir.prec[0] >= 0)
{
if (slen.range.min >= target_int_max ())
slen.range.min = 0;
if (info.bounded)
{
- if (1 == warn_format_trunc && result.min <= avail.max
+ if (warn_format_trunc == 1 && result.min <= avail.max
&& info.retval_used ())
{
/* The likely amount of space remaining in the destination is big
return false;
}
- if (1 == warn_format_trunc && result.likely <= avail.likely
+ if (warn_format_trunc == 1 && result.likely <= avail.likely
&& !info.retval_used ())
{
/* The likely amount of space remaining in the destination is big
}
else
{
- if (1 == warn_level && result.likely <= avail.likely)
+ if (warn_level == 1 && result.likely <= avail.likely)
{
/* The likely amount of space remaining in the destination is big
enough for the likely output. */
navail);
}
- if (0 == res.min && res.max < maxbytes)
+ if (res.min == 0 && res.max < maxbytes)
{
const char* fmtstr
= (info.bounded
res.max, navail);
}
- if (0 == res.min && maxbytes <= res.max)
+ if (res.min == 0 && maxbytes <= res.max)
{
/* This is a special case to avoid issuing the potentially
confusing warning:
avail_range.min, avail_range.max);
}
- if (0 == res.min && res.max < maxbytes)
+ if (res.min == 0 && res.max < maxbytes)
{
const char* fmtstr
= (info.bounded
avail_range.min, avail_range.max);
}
- if (0 == res.min && maxbytes <= res.max)
+ if (res.min == 0 && maxbytes <= res.max)
{
/* This is a special case to avoid issuing the potentially confusing
warning: