diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2020-03-25 11:57:36 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2020-03-25 11:57:36 -0400 |
commit | bda6dedbea599209048bc51115ecb2062ceb976c (patch) | |
tree | 978a9e7efd646601f82780c6dcd41eb274f29acc /src/include | |
parent | f5817595a7f194d25bc9be5b035eb1f7f60cd1fa (diff) | |
download | postgresql-bda6dedbea599209048bc51115ecb2062ceb976c.tar.gz postgresql-bda6dedbea599209048bc51115ecb2062ceb976c.zip |
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
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/executor/executor.h | 2 | ||||
-rw-r--r-- | src/include/parser/parse_coerce.h | 2 | ||||
-rw-r--r-- | src/include/parser/parse_node.h | 2 | ||||
-rw-r--r-- | src/include/parser/scanner.h | 2 | ||||
-rw-r--r-- | src/include/utils/elog.h | 44 |
5 files changed, 26 insertions, 26 deletions
diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h index cd0e6439cde..94890512dc8 100644 --- a/src/include/executor/executor.h +++ b/src/include/executor/executor.h @@ -546,7 +546,7 @@ exec_rt_fetch(Index rti, EState *estate) extern Relation ExecGetRangeTableRelation(EState *estate, Index rti); -extern void executor_errposition(EState *estate, int location); +extern int executor_errposition(EState *estate, int location); extern void RegisterExprContextCallback(ExprContext *econtext, ExprContextCallbackFunction function, diff --git a/src/include/parser/parse_coerce.h b/src/include/parser/parse_coerce.h index a3295b3fa45..8686eaacbc9 100644 --- a/src/include/parser/parse_coerce.h +++ b/src/include/parser/parse_coerce.h @@ -61,7 +61,7 @@ extern Node *coerce_to_specific_type_typmod(ParseState *pstate, Node *node, Oid targetTypeId, int32 targetTypmod, const char *constructName); -extern void parser_coercion_errposition(ParseState *pstate, +extern int parser_coercion_errposition(ParseState *pstate, int coerce_location, Node *input_expr); diff --git a/src/include/parser/parse_node.h b/src/include/parser/parse_node.h index b223b595423..d25819aa28b 100644 --- a/src/include/parser/parse_node.h +++ b/src/include/parser/parse_node.h @@ -307,7 +307,7 @@ typedef struct ParseCallbackState extern ParseState *make_parsestate(ParseState *parentParseState); extern void free_parsestate(ParseState *pstate); -extern void parser_errposition(ParseState *pstate, int location); +extern int parser_errposition(ParseState *pstate, int location); extern void setup_parser_errposition_callback(ParseCallbackState *pcbstate, ParseState *pstate, int location); diff --git a/src/include/parser/scanner.h b/src/include/parser/scanner.h index 02ae10a2250..a27352afc14 100644 --- a/src/include/parser/scanner.h +++ b/src/include/parser/scanner.h @@ -140,7 +140,7 @@ extern core_yyscan_t scanner_init(const char *str, extern void scanner_finish(core_yyscan_t yyscanner); extern int core_yylex(core_YYSTYPE *lvalp, YYLTYPE *llocp, core_yyscan_t yyscanner); -extern void scanner_errposition(int location, core_yyscan_t yyscanner); +extern int scanner_errposition(int location, core_yyscan_t yyscanner); extern void setup_scanner_errposition_callback(ScannerCallbackState *scbstate, core_yyscan_t yyscanner, int location); diff --git a/src/include/utils/elog.h b/src/include/utils/elog.h index d244b1c0ac5..1e09ee05418 100644 --- a/src/include/utils/elog.h +++ b/src/include/utils/elog.h @@ -149,30 +149,30 @@ extern bool errstart(int elevel, const char *domain); extern void errfinish(const char *filename, int lineno, const char *funcname); -extern void errcode(int sqlerrcode); +extern int errcode(int sqlerrcode); -extern void errcode_for_file_access(void); -extern void errcode_for_socket_access(void); +extern int errcode_for_file_access(void); +extern int errcode_for_socket_access(void); -extern void errmsg(const char *fmt,...) pg_attribute_printf(1, 2); -extern void errmsg_internal(const char *fmt,...) pg_attribute_printf(1, 2); +extern int errmsg(const char *fmt,...) pg_attribute_printf(1, 2); +extern int errmsg_internal(const char *fmt,...) pg_attribute_printf(1, 2); -extern void errmsg_plural(const char *fmt_singular, const char *fmt_plural, +extern int errmsg_plural(const char *fmt_singular, const char *fmt_plural, unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4); -extern void errdetail(const char *fmt,...) pg_attribute_printf(1, 2); -extern void errdetail_internal(const char *fmt,...) pg_attribute_printf(1, 2); +extern int errdetail(const char *fmt,...) pg_attribute_printf(1, 2); +extern int errdetail_internal(const char *fmt,...) pg_attribute_printf(1, 2); -extern void errdetail_log(const char *fmt,...) pg_attribute_printf(1, 2); +extern int errdetail_log(const char *fmt,...) pg_attribute_printf(1, 2); -extern void errdetail_log_plural(const char *fmt_singular, +extern int errdetail_log_plural(const char *fmt_singular, const char *fmt_plural, unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4); -extern void errdetail_plural(const char *fmt_singular, const char *fmt_plural, +extern int errdetail_plural(const char *fmt_singular, const char *fmt_plural, unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4); -extern void errhint(const char *fmt,...) pg_attribute_printf(1, 2); +extern int errhint(const char *fmt,...) pg_attribute_printf(1, 2); /* * errcontext() is typically called in error context callback functions, not @@ -184,22 +184,22 @@ extern void errhint(const char *fmt,...) pg_attribute_printf(1, 2); */ #define errcontext set_errcontext_domain(TEXTDOMAIN), errcontext_msg -extern void set_errcontext_domain(const char *domain); +extern int set_errcontext_domain(const char *domain); -extern void errcontext_msg(const char *fmt,...) pg_attribute_printf(1, 2); +extern int errcontext_msg(const char *fmt,...) pg_attribute_printf(1, 2); -extern void errhidestmt(bool hide_stmt); -extern void errhidecontext(bool hide_ctx); +extern int errhidestmt(bool hide_stmt); +extern int errhidecontext(bool hide_ctx); -extern void errbacktrace(void); +extern int errbacktrace(void); -extern void errfunction(const char *funcname); -extern void errposition(int cursorpos); +extern int errfunction(const char *funcname); +extern int errposition(int cursorpos); -extern void internalerrposition(int cursorpos); -extern void internalerrquery(const char *query); +extern int internalerrposition(int cursorpos); +extern int internalerrquery(const char *query); -extern void err_generic_string(int field, const char *str); +extern int err_generic_string(int field, const char *str); extern int geterrcode(void); extern int geterrposition(void); |