Suppress some "variable might be clobbered by longjmp" warnings.
authorTom Lane
Mon, 7 Mar 2011 02:15:48 +0000 (21:15 -0500)
committerTom Lane
Mon, 7 Mar 2011 02:15:48 +0000 (21:15 -0500)
Seen with an older gcc version.  I'm not sure these represent any real
risk factor, but still a bit scary.  Anyway we have lots of other
volatile-marked variables in this code, so a couple more won't hurt.

src/pl/plperl/Util.xs
src/pl/plpython/plpython.c

index eb1d15fc23e9cc0455a4f2affc5f3322f3b15256..7d0102b837f8bd0b5149180321019f4f5ba45a63 100644 (file)
 static void
 do_util_elog(int level, SV *msg)
 {
-    MemoryContext oldcontext = CurrentMemoryContext;
-   char *cmsg = NULL;
+   MemoryContext oldcontext = CurrentMemoryContext;
+   char       * volatile cmsg = NULL;
 
-    PG_TRY();
-    {
+   PG_TRY();
+   {
        cmsg = sv2cstr(msg);
-        elog(level, "%s", cmsg);
+       elog(level, "%s", cmsg);
        pfree(cmsg);
-    }
-    PG_CATCH();
-    {
-        ErrorData  *edata;
+   }
+   PG_CATCH();
+   {
+       ErrorData  *edata;
 
-        /* Must reset elog.c's state */
-        MemoryContextSwitchTo(oldcontext);
-        edata = CopyErrorData();
-        FlushErrorState();
+       /* Must reset elog.c's state */
+       MemoryContextSwitchTo(oldcontext);
+       edata = CopyErrorData();
+       FlushErrorState();
 
        if (cmsg)
            pfree(cmsg);
 
-        /* Punt the error to Perl */
-        croak("%s", edata->message);
-    }
-    PG_END_TRY();
+       /* Punt the error to Perl */
+       croak("%s", edata->message);
+   }
+   PG_END_TRY();
 }
 
 static text *
 sv2text(SV *sv)
 {
-   char *str = sv2cstr(sv);
+   char       *str = sv2cstr(sv);
+
    return cstring_to_text(str);
 }
 
index e415aa36f41c9a6cccc5f2729c5165bd3addb165..4a9e2a4f181507e66a3b701f9d09524222dea0c7 100644 (file)
@@ -1516,7 +1516,7 @@ static PLyProcedure *
 PLy_procedure_get(Oid fn_oid, bool is_trigger)
 {
    HeapTuple   procTup;
-   PLyProcedureEntry *entry;
+   PLyProcedureEntry * volatile entry;
    bool        found;
 
    procTup = SearchSysCache1(PROCOID, ObjectIdGetDatum(fn_oid));
@@ -3234,7 +3234,7 @@ PLy_spi_prepare(PyObject *self, PyObject *args)
    void       *tmpplan;
    volatile MemoryContext oldcontext;
    volatile ResourceOwner oldowner;
-   int         nargs;
+   volatile int nargs;
 
    if (!PyArg_ParseTuple(args, "s|O", &query, &list))
        return NULL;
@@ -3470,7 +3470,7 @@ PLy_spi_execute_plan(PyObject *ob, PyObject *list, long limit)
 
    PG_TRY();
    {
-       char       *nulls;
+       char  * volatile nulls;
        volatile int j;
 
        if (nargs > 0)