]> granicus.if.org Git - postgresql/commitdiff
Suppress volatile-related warning seen in some compilers.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 21 Jul 2012 23:39:03 +0000 (19:39 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 21 Jul 2012 23:39:03 +0000 (19:39 -0400)
Antique versions of gcc complain about vars that are initialized outside
PG_TRY and then modified within it.  Rather than marking the var volatile,
expend one more line of code.

src/pl/plpgsql/src/pl_handler.c

index 905fff0b31d6785c4a5b33875a21175acef432b0..63c3abd9b0bb6d613a3852882c1f23ea4b0b84d1 100644 (file)
@@ -91,7 +91,7 @@ plpgsql_call_handler(PG_FUNCTION_ARGS)
 {
        PLpgSQL_function *func;
        PLpgSQL_execstate *save_cur_estate;
-       Datum           retval = 0;             /* make compiler happy */
+       Datum           retval;
        int                     rc;
 
        /*
@@ -119,8 +119,11 @@ plpgsql_call_handler(PG_FUNCTION_ARGS)
                        retval = PointerGetDatum(plpgsql_exec_trigger(func,
                                                                                   (TriggerData *) fcinfo->context));
                else if (CALLED_AS_EVENT_TRIGGER(fcinfo))
+               {
                        plpgsql_exec_event_trigger(func,
                                                                           (EventTriggerData *) fcinfo->context);
+                       retval = (Datum) 0;
+               }
                else
                        retval = plpgsql_exec_function(func, fcinfo);
        }