trivial diff: clean up runtime/mercury_stacks.h
Fergus Henderson
fjh at cs.mu.OZ.AU
Wed Oct 28 03:20:27 AEDT 1998
Estimated hours taken: 0.25
Some minor source cleanups.
runtime/mercury_stacks.h:
Add some missing parentheses to various macro definitions,
so that they give the correct results even if the argument
is a complicated expression rather than just a single variable.
Also fix the layout in a few places by add whitespace around operators.
Index: runtime/mercury_stacks.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_stacks.h,v
retrieving revision 1.9
diff -u -r1.9 mercury_stacks.h
--- mercury_stacks.h 1998/08/02 06:37:00 1.9
+++ mercury_stacks.h 1998/10/27 16:16:42
@@ -108,7 +108,7 @@
#define MR_succip_slot(fr) LVALUE_CAST(Code *, ((Word *) (fr))[MR_SUCCIP])
#define MR_succfr_slot(fr) LVALUE_CAST(Word *, ((Word *) (fr))[MR_SUCCFR])
#define MR_detfr_slot(fr) LVALUE_CAST(Word *, ((Word *) (fr))[MR_DETFR])
-#define MR_based_framevar(fr,n) (((Word *) (fr))[MR_SAVEVAL+1-(n)])
+#define MR_based_framevar(fr,n) (((Word *) (fr))[MR_SAVEVAL + 1 - (n)])
#define bt_prevfr(fr) MR_prevfr_slot(fr)
#define bt_redoip(fr) MR_redoip_slot(fr)
@@ -116,7 +116,7 @@
#define bt_succip(fr) MR_succip_slot(fr)
#define bt_succfr(fr) MR_succfr_slot(fr)
#define bt_prednm(fr) MR_prednm_slot(fr)
-#define bt_var(fr,n) MR_based_framevar(fr,n+1)
+#define bt_var(fr,n) MR_based_framevar(fr, (n) + 1)
#define curprevfr bt_prevfr(MR_curfr)
#define curredoip bt_redoip(MR_curfr)
@@ -125,12 +125,12 @@
#define cursuccfr bt_succfr(MR_curfr)
#define curprednm bt_prednm(MR_curfr)
-#define MR_framevar(n) MR_based_framevar(MR_curfr,n)
-#define framevar(n) MR_framevar(n+1)
+#define MR_framevar(n) MR_based_framevar(MR_curfr, n)
+#define framevar(n) MR_framevar((n) + 1)
#define based_framevar(base_curfr, n) \
- MR_based_framevar(base_curfr, n+1)
+ MR_based_framevar(base_curfr, (n) + 1)
#define saved_framevar(save_area, n) \
- MR_based_framevar(MR_saved_curfr(save_area), n+1)
+ MR_based_framevar(MR_saved_curfr(save_area), (n) + 1)
/* DEFINITIONS FOR MANIPULATING THE NONDET STACK */
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
More information about the developers
mailing list