Gunnar Evermann <ge204(a)eng.cam.ac.uk> writes:
We could just inintialise LispObjects to NULL in the constructor.
Then
we can check in GCPRO (giving some false positives as they only need
to hold real LispObjects when the GC actually happens). Alternatively
we could have a special function that is always called when a GC could
happen (like always_gc) and then checks the gcprolist for NULLs.
I used GCC to find them. I replaced GCPRO like following
patch and tried to compile XEmacs. With that patch applied,
you can't build working XEmacs but GCC gives you much more
warning about uninitialized variables, clobbered variable by
setjmp and so on. If I didn't remove actuall GCPRO code,
GCC didn't warn about uninitialized variables. Perhaps it
is because GCPRO add alias to Lisp_Object but I don't know
about the detail. I love GCC for doing this kind of check.
I did it on only Linux. Windows folks should do the same.
Installation file is attached. Source code not compiled are
not checked.
--- /src/xemacs/src/lisp.h Wed Nov 15 19:50:00 2000
+++ /home/penny/lisp.h.gc-uninit-check Sun Nov 19 15:41:46 2000
@@ -1953,6 +1953,25 @@
#else /* ! DEBUG_GCPRO */
+#define GCPRO1(var1) Fcar (var1);
+#define GCPRO2(var1, var2) Fcar (var1); Fcar (var2);
+#define GCPRO3(var1, var2, var3) Fcar (var1); Fcar (var2); Fcar (var3);
+#define GCPRO4(var1, var2, var3, var4) Fcar (var1); Fcar (var2); Fcar (var3); Fcar
(var4);
+#define GCPRO5(var1, var2, var3, var4, var5) Fcar (var1); Fcar (var2); Fcar (var3); Fcar
(var4); Fcar (var5);
+#define UNGCPRO ((void) (gcprolist = gcpro1.next))
+#define NUNGCPRO ((void) 1)
+#define NNUNGCPRO ((void) (gcprolist = nngcpro1.next))
+#define NGCPRO1(var1) GCPRO1(var1)
+#define NGCPRO2(var1, var2) GCPRO2(var1, var2)
+#define NGCPRO3(var1, var2, var3) GCPRO3(var1, var2, var3)
+#define NGCPRO4(var1, var2, var3, var4) GCPRO4(var1, var2, var3, var4)
+#define NGCPRO5(var1, var2, var3, var4, var5) GCPRO5(var1, var2, var3, var4, var5)
+#define NNGCPRO1(var1) GCPRO1(var1)
+#define NNGCPRO2(var1, var2) GCPRO2(var1, var2)
+#define NNGCPRO3(var1, var2, var3) GCPRO3(var1, var2, var3)
+#define NNGCPRO4(var1, var2, var3, var4) GCPRO4(var1, var2, var3, var4)
+#define NNGCPRO5(var1, var2, var3, var4, var5) GCPRO5(var1, var2, var3, var4, var5)
+#if 0
#define GCPRO1(var1) ((void) ( \
gcpro1.next = gcprolist, gcpro1.var = &var1, gcpro1.nvars = 1, \
gcprolist = &gcpro1 ))
@@ -2046,6 +2065,7 @@
nngcpro4.next = &nngcpro3, nngcpro4.var = &var4, nngcpro4.nvars = 1, \
nngcpro5.next = &nngcpro4, nngcpro5.var = &var5, nngcpro5.nvars = 1, \
gcprolist = &nngcpro5 ))
+#endif
#define NNUNGCPRO ((void) (gcprolist = nngcpro1.next))
--
Yoshiki Hayashi