cvs diff: void type bug fixes.

Tyson Richard DOWD trd at hydra.cs.mu.oz.au
Tue Apr 22 11:59:38 AEST 1997


Hi,

This change fixes two bugs in the code for the void type.

Anyone can review this.

===================================================================

Estimated hours taken: 0.2

Fix a few bugs in adding the void type.

library/mercury_builtin.m:
	- Add a declaration of mercury__unused_0_0 before it is used.
	  (If not here, there are problems compiling with --split-c-files).
	- Add a initializer for the code addresses in the base_type_info
	  for void (this avoids possible problems in grades without
	  static code addresses).

runtime/type_info.h:
	- Add a macro to initialize a base_type_info's code addresses
	  all to the same pred - used in particular to initilialize them
	  to `unused'.
	- Neaten some formatting of backslashes at the end of lines.

Index: library/mercury_builtin.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/mercury_builtin.m,v
retrieving revision 1.69
diff -u -r1.69 mercury_builtin.m
--- mercury_builtin.m	1997/04/21 08:32:34	1.69
+++ mercury_builtin.m	1997/04/22 01:41:02
@@ -749,6 +749,7 @@
 
 	/* The void type */
 
+Declare_entry(mercury__unused_0_0);
 MR_STATIC_CODE_CONST struct mercury_data___base_type_info_void_0_struct {
 	Integer f1;
 	Code *f2;
@@ -814,6 +815,8 @@
 		mercury_data___base_type_info_character_0, _character_);
 	MR_INIT_BUILTIN_BASE_TYPE_INFO(
 		mercury_data___base_type_info_string_0, _string_);
+	MR_INIT_BASE_TYPE_INFO_WITH_PRED(
+		mercury_data___base_type_info_void_0, mercury__unused_0_0);
 }
 
 #endif /* SHARED_ONE_OR_TWO_CELL_TYPE_INFO */
Index: runtime/type_info.h
===================================================================
RCS file: /home/staff/zs/imp/mercury/runtime/type_info.h,v
retrieving revision 1.22
diff -u -r1.22 type_info.h
--- type_info.h	1997/04/21 08:32:50	1.22
+++ type_info.h	1997/04/22 01:42:27
@@ -395,6 +395,12 @@
 **
 ** MR_INIT_BASE_TYPE_INFO(
 ** 	mercury_data_group__base_type_info_group_1, group__group_1_0);
+** 
+** MR_INIT_BASE_TYPE_INFO_WITH_PRED(
+** 	mercury_date__base_type_info_void_0, mercury__unused_0_0);
+**
+** This will initialize a base_type_info with a single code address.
+**
 **
 */
 
@@ -408,18 +414,27 @@
 
     #define	MR_INIT_BUILTIN_BASE_TYPE_INFO(B, T) \
     do {								\
-	MR_INIT_CODE_ADDR(B, mercury__builtin_unify##T##2_0, 	\
+	MR_INIT_CODE_ADDR(B, mercury__builtin_unify##T##2_0, 		\
 		OFFSET_FOR_UNIFY_PRED);					\
-	MR_INIT_CODE_ADDR(B, mercury__builtin_index##T##2_0, 	\
+	MR_INIT_CODE_ADDR(B, mercury__builtin_index##T##2_0, 		\
 		OFFSET_FOR_INDEX_PRED);					\
-	MR_INIT_CODE_ADDR(B, mercury__builtin_compare##T##3_0, 	\
+	MR_INIT_CODE_ADDR(B, mercury__builtin_compare##T##3_0, 		\
 		OFFSET_FOR_COMPARE_PRED);				\
-	MR_INIT_CODE_ADDR(B, mercury__builtin_type_to_term##T##2_0,\
+	MR_INIT_CODE_ADDR(B, mercury__builtin_type_to_term##T##2_0,	\
 		OFFSET_FOR_TYPE_TO_TERM_PRED);				\
-	MR_INIT_CODE_ADDR(B, mercury__builtin_term_to_type##T##2_0,\
+	MR_INIT_CODE_ADDR(B, mercury__builtin_term_to_type##T##2_0,	\
 		OFFSET_FOR_TERM_TO_TYPE_PRED);				\
     } while (0)
 
+    #define	MR_INIT_BASE_TYPE_INFO_WITH_PRED(B, P)			\
+    do {								\
+	MR_INIT_CODE_ADDR(B, P, OFFSET_FOR_UNIFY_PRED);			\
+	MR_INIT_CODE_ADDR(B, P, OFFSET_FOR_INDEX_PRED);			\
+	MR_INIT_CODE_ADDR(B, P, OFFSET_FOR_COMPARE_PRED);		\
+	MR_INIT_CODE_ADDR(B, P, OFFSET_FOR_TYPE_TO_TERM_PRED);		\
+	MR_INIT_CODE_ADDR(B, P, OFFSET_FOR_TERM_TO_TYPE_PRED);		\
+    } while (0)
+
     #define	MR_INIT_BASE_TYPE_INFO(B, T) \
     do {								\
 	MR_SPECIAL_PRED_INIT(B, T, OFFSET_FOR_UNIFY_PRED, Unify);	\
@@ -441,6 +456,13 @@
 		OFFSET_FOR_COMPARE_PRED);				\
     } while (0)
 
+    #define	MR_INIT_BASE_TYPE_INFO_WITH_PRED(B, P)			\
+    do {								\
+	MR_INIT_CODE_ADDR(B, P, OFFSET_FOR_UNIFY_PRED);			\
+	MR_INIT_CODE_ADDR(B, P, OFFSET_FOR_INDEX_PRED);			\
+	MR_INIT_CODE_ADDR(B, P, OFFSET_FOR_COMPARE_PRED);		\
+    } while (0)
+
     #define	MR_INIT_BASE_TYPE_INFO(B, T) \
     do {	\
 	MR_SPECIAL_PRED_INIT(B, T, OFFSET_FOR_UNIFY_PRED, Unify);     \
@@ -457,6 +479,9 @@
   #define MR_STATIC_CODE_CONST const
 
   #define MR_INIT_BUILTIN_BASE_TYPE_INFO(B, T) \
+	do { } while (0)
+
+  #define MR_INIT_BASE_TYPE_INFO_WITH_PRED(B, P) \
 	do { } while (0)
 
   #define MR_INIT_BASE_TYPE_INFO(B, T) \
-- 
       Tyson Dowd           #
                            #             Sign on refrigerator:
     trd at cs.mu.oz.au        #           Refrigerate after opening. 
http://www.cs.mu.oz.au/~trd #                  - C. J. Owen.



More information about the developers mailing list