Fix some compiler warnings

Some of the buildfarm members with some old gcc versions have been
complaining about an always-true test for a NULL pointer caused by a
combination of SOFT_ERROR_OCCURRED() and a local ErrorSaveContext
variable.

These warnings are taken care of by removing SOFT_ERROR_OCCURRED(),
switching to a direct variable check, like 56b1e88c80.

Oversights in e1405aa5e3 and 44eba8f06e.

Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/1341064.1764895052@sss.pgh.pa.us
pull/256/head
Michael Paquier 2 weeks ago
parent 83f2f8413e
commit 7bc88c3d6f
  1. 6
      src/backend/utils/adt/pg_dependencies.c
  2. 4
      src/backend/utils/adt/pg_ndistinct.c

@ -494,7 +494,7 @@ dependencies_scalar(void *state, char *token, JsonTokenType tokentype)
case DEPS_EXPECT_ATTNUM:
attnum = pg_strtoint16_safe(token, (Node *) &escontext);
if (SOFT_ERROR_OCCURRED(&escontext))
if (escontext.error_occurred)
{
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
@ -539,7 +539,7 @@ dependencies_scalar(void *state, char *token, JsonTokenType tokentype)
parse->dependency = (AttrNumber)
pg_strtoint16_safe(token, (Node *) &escontext);
if (SOFT_ERROR_OCCURRED(&escontext))
if (escontext.error_occurred)
{
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
@ -569,7 +569,7 @@ dependencies_scalar(void *state, char *token, JsonTokenType tokentype)
parse->degree = float8in_internal(token, NULL, "double",
token, (Node *) &escontext);
if (SOFT_ERROR_OCCURRED(&escontext))
if (escontext.error_occurred)
{
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),

@ -435,7 +435,7 @@ ndistinct_scalar(void *state, char *token, JsonTokenType tokentype)
case NDIST_EXPECT_ATTNUM:
attnum = pg_strtoint16_safe(token, (Node *) &escontext);
if (SOFT_ERROR_OCCURRED(&escontext))
if (escontext.error_occurred)
{
errsave(parse->escontext,
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
@ -485,7 +485,7 @@ ndistinct_scalar(void *state, char *token, JsonTokenType tokentype)
*/
parse->ndistinct = pg_strtoint32_safe(token, (Node *) &escontext);
if (!SOFT_ERROR_OCCURRED(&escontext))
if (!escontext.error_occurred)
{
parse->state = NDIST_EXPECT_KEY;
return JSON_SUCCESS;

Loading…
Cancel
Save