From a63c84e59acf9f5e2b54aad4974a80e5075af646 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 4 Nov 2019 11:07:32 +0100 Subject: [PATCH] Fix some compiler warnings on older compilers Some older compilers appear to not understand the recently introduced PG_FINALLY code structure that well in some circumstances and complain about possibly uninitialized variables. So to fix, initialize the variables explicitly in the cases complained about. Discussion: https://www.postgresql.org/message-id/flat/95a822c3-728b-af0e-d7e5-71890507ae0c%402ndquadrant.com --- src/backend/utils/adt/xml.c | 2 +- src/pl/plperl/plperl.c | 2 +- src/pl/plpython/plpy_exec.c | 2 +- src/pl/plpython/plpy_typeio.c | 2 +- src/pl/tcl/pltcl.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c index c397461ad5..3a493dd6bf 100644 --- a/src/backend/utils/adt/xml.c +++ b/src/backend/utils/adt/xml.c @@ -3821,7 +3821,7 @@ SPI_sql_row_to_xmlelement(uint64 rownum, StringInfo result, char *tablename, static text * xml_xmlnodetoxmltype(xmlNodePtr cur, PgXmlErrorContext *xmlerrcxt) { - xmltype *result; + xmltype *result = NULL; if (cur->type != XML_ATTRIBUTE_NODE && cur->type != XML_TEXT_NODE) { diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c index f0fb308552..90f7cf169c 100644 --- a/src/pl/plperl/plperl.c +++ b/src/pl/plperl/plperl.c @@ -1840,7 +1840,7 @@ PG_FUNCTION_INFO_V1(plperl_call_handler); Datum plperl_call_handler(PG_FUNCTION_ARGS) { - Datum retval; + Datum retval = (Datum) 0; plperl_call_data *volatile save_call_data = current_call_data; plperl_interp_desc *volatile oldinterp = plperl_active_interp; plperl_call_data this_call_data; diff --git a/src/pl/plpython/plpy_exec.c b/src/pl/plpython/plpy_exec.c index 6994d7c10b..1aec1b27dd 100644 --- a/src/pl/plpython/plpy_exec.c +++ b/src/pl/plpython/plpy_exec.c @@ -1025,7 +1025,7 @@ plpython_trigger_error_callback(void *arg) static PyObject * PLy_procedure_call(PLyProcedure *proc, const char *kargs, PyObject *vargs) { - PyObject *rv; + PyObject *rv = NULL; int volatile save_subxact_level = list_length(explicit_subtransactions); PyDict_SetItemString(proc->globals, kargs, vargs); diff --git a/src/pl/plpython/plpy_typeio.c b/src/pl/plpython/plpy_typeio.c index 589c76e7a7..e1a0524496 100644 --- a/src/pl/plpython/plpy_typeio.c +++ b/src/pl/plpython/plpy_typeio.c @@ -901,7 +901,7 @@ PLyObject_ToBytea(PLyObToDatum *arg, PyObject *plrv, bool *isnull, bool inarray) { PyObject *volatile plrv_so = NULL; - Datum rv; + Datum rv = (Datum) 0; if (plrv == Py_None) { diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c index fccd22b4f5..73e12788fc 100644 --- a/src/pl/tcl/pltcl.c +++ b/src/pl/tcl/pltcl.c @@ -718,7 +718,7 @@ pltclu_call_handler(PG_FUNCTION_ARGS) static Datum pltcl_handler(PG_FUNCTION_ARGS, bool pltrusted) { - Datum retval; + Datum retval = (Datum) 0; pltcl_call_state current_call_state; pltcl_call_state *save_call_state;