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/utils/adt/jsonfuncs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/backend/utils/adt/jsonfuncs.c') diff --git a/src/backend/utils/adt/jsonfuncs.c b/src/backend/utils/adt/jsonfuncs.c index 321ab9a0db9..4b5007e0d6f 100644 --- a/src/backend/utils/adt/jsonfuncs.c +++ b/src/backend/utils/adt/jsonfuncs.c @@ -329,7 +329,7 @@ typedef struct JsObject hash_destroy((jso)->val.json_hash); \ } while (0) -static void report_json_context(JsonLexContext *lex); +static int report_json_context(JsonLexContext *lex); /* semantic action functions for json_object_keys */ static void okeys_object_field_start(void *state, char *fname, bool isnull); @@ -631,7 +631,7 @@ json_ereport_error(JsonParseErrorType error, JsonLexContext *lex) * The return value isn't meaningful, but we make it non-void so that this * can be invoked inside ereport(). */ -static void +static int report_json_context(JsonLexContext *lex) { const char *context_start; @@ -689,8 +689,8 @@ report_json_context(JsonLexContext *lex) prefix = (context_start > line_start) ? "..." : ""; suffix = (lex->token_type != JSON_TOKEN_END && context_end - lex->input < lex->input_length && *context_end != '\n' && *context_end != '\r') ? "..." : ""; - errcontext("JSON data, line %d: %s%s%s", - line_number, prefix, ctxt, suffix); + return errcontext("JSON data, line %d: %s%s%s", + line_number, prefix, ctxt, suffix); } -- cgit v1.2.3