1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-21 05:21:08 +03:00

Go back to returning int from ereport auxiliary functions.

This reverts the parts of commit 17a28b0364
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
This commit is contained in:
Tom Lane
2020-03-25 11:57:36 -04:00
parent f5817595a7
commit bda6dedbea
14 changed files with 108 additions and 74 deletions

View File

@@ -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);