emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-25 95f69f2: Fix reindent-introduced typo in module c


From: Paul Eggert
Subject: [Emacs-diffs] emacs-25 95f69f2: Fix reindent-introduced typo in module code
Date: Fri, 20 Nov 2015 20:15:57 +0000

branch: emacs-25
commit 95f69f2c5999be4b9444861b6d4ae1bd3ab87f83
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Fix reindent-introduced typo in module code
    
    * src/emacs-module.c (MODULE_SETJMP_1): Fix typo that I
    introduced while reindenting the code earlier, and add a
    comment explaining the unusual use of do-while here.
---
 src/emacs-module.c |   39 ++++++++++++++++++++++-----------------
 1 files changed, 22 insertions(+), 17 deletions(-)

diff --git a/src/emacs-module.c b/src/emacs-module.c
index 09b09d0..84072b9 100644
--- a/src/emacs-module.c
+++ b/src/emacs-module.c
@@ -192,24 +192,29 @@ static void module_wrong_type (emacs_env *, Lisp_Object, 
Lisp_Object);
 /* It is very important that pushing the handler doesn't itself raise
    a signal.  Install the cleanup only after the handler has been
    pushed.  Use __attribute__ ((cleanup)) to avoid
-   non-local-exit-prone manual cleanup.  */
+   non-local-exit-prone manual cleanup.
+
+   The do-while forces uses of the macro to be followed by a semicolon.
+   This macro cannot enclose its entire body inside a do-while, as the
+   code after the macro may longjmp back into the macro, which means
+   its local variable C must stay live in later code.  */
+
 #define MODULE_SETJMP_1(handlertype, handlerfunc, retval, c, dummy)    \
-  do {                                                                 \
-    eassert (module_non_local_exit_check (env) == emacs_funcall_exit_return); \
-    struct handler *c = push_handler_nosignal (Qt, handlertype);       \
-    if (!c)                                                            \
-      {                                                                        
\
-       module_out_of_memory (env);                                     \
-       return retval;                                                  \
-      }                                                                        
\
-    verify (module_has_cleanup);                                       \
-    int dummy __attribute__ ((cleanup (module_reset_handlerlist)));    \
-    if (sys_setjmp (c->jmp))                                           \
-      {                                                                        
\
-       (handlerfunc) (env, c->val);                                    \
-       return retval;                                                  \
-      }                                                                        
\
-  } while (false)
+  eassert (module_non_local_exit_check (env) == emacs_funcall_exit_return); \
+  struct handler *c = push_handler_nosignal (Qt, handlertype);         \
+  if (!c)                                                              \
+    {                                                                  \
+      module_out_of_memory (env);                                      \
+      return retval;                                                   \
+    }                                                                  \
+  verify (module_has_cleanup);                                         \
+  int dummy __attribute__ ((cleanup (module_reset_handlerlist)));      \
+  if (sys_setjmp (c->jmp))                                             \
+    {                                                                  \
+      (handlerfunc) (env, c->val);                                     \
+      return retval;                                                   \
+    }                                                                  \
+  do { } while (false)
 
 
 /* Function environments.  */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]