Fix some compiler warnings on older compilers
authorPeter Eisentraut <[email protected]>
Mon, 4 Nov 2019 10:07:32 +0000 (11:07 +0100)
committerPeter Eisentraut <[email protected]>
Mon, 4 Nov 2019 10:07:32 +0000 (11:07 +0100)
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
src/pl/plperl/plperl.c
src/pl/plpython/plpy_exec.c
src/pl/plpython/plpy_typeio.c
src/pl/tcl/pltcl.c

index c397461ad5de1daf5da19b843d4fdb17f1d42bf9..3a493dd6bf70cec435c084b490140007607a5c1e 100644 (file)
@@ -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)
        {
index f0fb3085523ae87f50874ce41a9f796593d2c4a4..90f7cf169c791fa2b674468e9b83fed21af11267 100644 (file)
@@ -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;
index 6994d7c10b946d19a16b42dd07444590c51f47d6..1aec1b27ddda88a8db13e0f82924c87521f96c27 100644 (file)
@@ -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);
index 589c76e7a76ae1460235d49da8784983afb69f4a..e1a05244969fbc42f41a4260bda39a0df97397e5 100644 (file)
@@ -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)
        {
index fccd22b4f5152b79f048de739d830cbf6a85d712..73e12788fc00c8846a3cb6d1b675a79c687f62f6 100644 (file)
@@ -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;