Avoid "variable might be clobbered by longjmp" warning.
authorTom Lane
Thu, 28 Mar 2013 17:19:49 +0000 (13:19 -0400)
committerTom Lane
Thu, 28 Mar 2013 17:19:49 +0000 (13:19 -0400)
On older-model gcc, the original coding of UTILITY_BEGIN_QUERY() can
draw this error because of multiple assignments to _needCleanup.
Rather than mark that variable volatile, we can suppress the warning
by arranging to have just one unconditional assignment before PG_TRY.

src/backend/tcop/utility.c

index 77b4e5368e7bab91690b8a668e3300aa333a539d..954040cfb85a59d0959da1a387a61d76d88d4531 100644 (file)
@@ -380,12 +380,9 @@ ProcessUtility(Node *parsetree,
  */
 #define UTILITY_BEGIN_QUERY(isComplete) \
    do { \
-       bool        _needCleanup = false; \
+       bool        _needCleanup; \
        \
-       if (isComplete) \
-       { \
-           _needCleanup = EventTriggerBeginCompleteQuery(); \
-       } \
+       _needCleanup = (isComplete) && EventTriggerBeginCompleteQuery(); \
        \
        PG_TRY(); \
        { \