shithub: libmujs

Download patch

ref: 269960707037bcc7999c918cfe2e28c94351cd82
parent: 17019d29e5494d4b0ae148a3043a940be78e3215
author: Tor Andersson <tor.andersson@artifex.com>
date: Mon Sep 28 11:27:15 EDT 2015

Rework try macros to simplify setjmp expression.

According to spec, setjmp is only allowed to be called in very restricted
contexts. A comma expression is not one of them; which puts it in danger
of compiler optimizations going wrong.

--- a/jsi.h
+++ b/jsi.h
@@ -120,10 +120,10 @@
 void js_savetry(js_State *J, js_Instruction *pc);
 
 #define js_trypc(J, PC) \
-	(js_savetry(J, PC), setjmp(J->trybuf[J->trytop++].buf))
+	setjmp((js_savetry(J, PC), J->trybuf[J->trytop++].buf))
 
 #define js_try(J) \
-	(js_savetry(J, NULL), setjmp(J->trybuf[J->trytop++].buf))
+	setjmp((js_savetry(J, NULL), J->trybuf[J->trytop++].buf))
 
 #define js_endtry(J) \
 	(--J->trytop)