From bda6dedbea599209048bc51115ecb2062ceb976c Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 25 Mar 2020 11:57:36 -0400 Subject: Go back to returning int from ereport auxiliary functions. This reverts the parts of commit 17a28b03645e27d73bf69a95d7569b61e58f06eb that changed ereport's auxiliary functions from returning dummy integer values to returning void. It turns out that a minority of compilers complain (not entirely unreasonably) about constructs such as (condition) ? errdetail(...) : 0 if errdetail() returns void rather than int. We could update those call sites to say "(void) 0" perhaps, but the expectation for this patch set was that ereport callers would not have to change anything. And this aspect of the patch set was already the most invasive and least compelling part of it, so let's just drop it. Per buildfarm. Discussion: https://postgr.es/m/CA+fd4k6N8EjNvZpM8nme+y+05mz-SM8Z_BgkixzkA34R+ej0Kw@mail.gmail.com --- src/backend/parser/parse_node.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/backend/parser/parse_node.c') diff --git a/src/backend/parser/parse_node.c b/src/backend/parser/parse_node.c index 9a2fd924b67..6e98fe55fc4 100644 --- a/src/backend/parser/parse_node.c +++ b/src/backend/parser/parse_node.c @@ -106,21 +106,21 @@ free_parsestate(ParseState *pstate) * normal non-error case: computing character indexes would be much more * expensive than storing token offsets.) */ -void +int parser_errposition(ParseState *pstate, int location) { int pos; /* No-op if location was not provided */ if (location < 0) - return; + return 0; /* Can't do anything if source text is not available */ if (pstate == NULL || pstate->p_sourcetext == NULL) - return; + return 0; /* Convert offset to character number */ pos = pg_mbstrlen_with_len(pstate->p_sourcetext, location) + 1; /* And pass it to the ereport mechanism */ - errposition(pos); + return errposition(pos); } -- cgit v1.2.3