Suppress compiler warning about no function return value.

Compilers that don't know that ereport(ERROR) doesn't return
complained about the new coding in scanint8() introduced by
commit 101c7ee3e.  Tweak coding to avoid the warning.
Per buildfarm.
This commit is contained in:
Tom Lane 2017-12-17 00:41:41 -05:00
parent c04d35f442
commit b31a9d7dd3
1 changed files with 6 additions and 9 deletions

View File

@ -81,9 +81,7 @@ scanint8(const char *str, bool errorOK, int64 *result)
/* require at least one digit */ /* require at least one digit */
if (unlikely(!isdigit((unsigned char) *ptr))) if (unlikely(!isdigit((unsigned char) *ptr)))
{
goto invalid_syntax; goto invalid_syntax;
}
/* process digits */ /* process digits */
while (*ptr && isdigit((unsigned char) *ptr)) while (*ptr && isdigit((unsigned char) *ptr))
@ -108,26 +106,25 @@ scanint8(const char *str, bool errorOK, int64 *result)
goto out_of_range; goto out_of_range;
tmp = -tmp; tmp = -tmp;
} }
*result = tmp;
*result = tmp;
return true; return true;
out_of_range: out_of_range:
if (errorOK) if (!errorOK)
return false;
else
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
errmsg("value \"%s\" is out of range for type %s", errmsg("value \"%s\" is out of range for type %s",
str, "bigint"))); str, "bigint")));
invalid_syntax:
if (errorOK)
return false; return false;
else
invalid_syntax:
if (!errorOK)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("invalid input syntax for integer: \"%s\"", errmsg("invalid input syntax for integer: \"%s\"",
str))); str)));
return false;
} }
/* int8in() /* int8in()