[m-rev.] for review: fix samples/c_interface/cplusplus_calls_mercury
Ian MacLarty
maclarty at cs.mu.OZ.AU
Wed Apr 20 16:56:24 AEST 2005
On Wed, Apr 20, 2005 at 04:46:34PM +1000, Ian MacLarty wrote:
> On Tue, Apr 19, 2005 at 02:03:32PM +1000, Ian MacLarty wrote:
> > I'm not sure at all if this is the right fix, but the compiler passes a
> > bootcheck and all the tests with the following two lines in
> > runtime/mercury_types.h removed.
> >
>
> Apparently that wasn't the right fix. Here's a new fix:
>
Sorry, forgot to include the diff. Here it is with the diff:
For review by Zoltan.
Estimated hours taken: 3
Branches: main and 0.12
Move the typedefs defined in runtime/mercury_typeclass_info.h to
runtime/mercury_types.h. Rename the typedefs and structs to follow the
convention in mercury_types.h.
This fixes the following error which occured when trying to build
samples/c_interface/cplusplus_calls_mercury:
mgnuc --grade asm_fast.gc -g -- -DMR_MACHDEPS_ALPHA_REGS_H -DMR_MACHDEPS_MIPS_REGS_H -DMR_MACHDEPS_SPARC_REGS_H -DMR_MACHDEPS_I386_REGS_H -DMR_MACHDEPS_PA_REGS_H -DMR_MACHDEPS_RS6000_REGS_H -g -c cpp_main.cc
In file included from /home/jupiter/public/mercury-latest/i686-pc-linux-gnu/lib/mercury/inc/mercury_imp.h:76,
from cpp_main.cc:1:
/home/jupiter/public/mercury-latest/i686-pc-linux-gnu/lib/mercury/inc/mercury_typeclass_info.h:314: conflicting
types for `typedef struct MR_Dictionary_Struct MR_Dictionary_Struct'
/home/jupiter/public/mercury-latest/i686-pc-linux-gnu/lib/mercury/inc/mercury_types.h:197: previous
declaration as `struct MR_Dictionary_Struct'
gmake: *** [cpp_main.o] Error 1
compiler/rtti.m:
Use the new typedefs TypeClassIdStruct and TypeClassMethodStruct
instead of TypeClassId and TypeClassMethod.
runtime/mercury_type_tables.c:
Use the new typedef TypeClassId.
runtime/mercury_typeclass_info.h:
Remove the typedefs and give the structs tags ending in `_Struct'.
runtime/mercury_types.h:
Declare typedefs for the above structs, following the current
convention in mercury_types.h.
Index: compiler/rtti.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rtti.m,v
retrieving revision 1.57
diff -u -r1.57 rtti.m
--- compiler/rtti.m 22 Mar 2005 06:40:24 -0000 1.57
+++ compiler/rtti.m 20 Apr 2005 04:49:31 -0000
@@ -1837,9 +1837,9 @@
:- pred tc_rtti_name_type(tc_rtti_name::in, string::out, bool::out) is det.
tc_rtti_name_type(base_typeclass_info(_, _), "BaseTypeclassInfo", yes).
-tc_rtti_name_type(type_class_id, "TypeClassId", no).
+tc_rtti_name_type(type_class_id, "TypeClassIdStruct", no).
tc_rtti_name_type(type_class_id_var_names, "ConstString", yes).
-tc_rtti_name_type(type_class_id_method_ids, "TypeClassMethod", yes).
+tc_rtti_name_type(type_class_id_method_ids, "TypeClassMethodStruct", yes).
tc_rtti_name_type(type_class_decl, "TypeClassDeclStruct", no).
tc_rtti_name_type(type_class_decl_super(_, N), TypeName, no) :-
TypeName = tc_constraint_type_name(N).
Index: runtime/mercury_type_tables.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_type_tables.c,v
retrieving revision 1.10
diff -u -r1.10 mercury_type_tables.c
--- runtime/mercury_type_tables.c 24 Feb 2004 08:49:55 -0000 1.10
+++ runtime/mercury_type_tables.c 19 Apr 2005 05:35:38 -0000
@@ -111,9 +111,9 @@
MR_Dlist *element_ptr;
MR_TypeClassDeclInfo *cur_type_class_decl_info;
MR_TypeClassDecl cur_type_class_decl;
- const MR_TypeClassId *cur_type_class_id;
+ MR_TypeClassId cur_type_class_id;
MR_TypeClassDeclInfo *type_class_decl_info;
- const MR_TypeClassId *type_class_id;
+ MR_TypeClassId type_class_id;
MR_assert(type_class_decl != NULL);
type_class_id = type_class_decl->MR_tc_decl_id;
@@ -214,7 +214,7 @@
MR_Dlist *element_ptr;
MR_TypeClassDeclInfo *cur_type_class_decl_info;
MR_TypeClassDecl cur_type_class_decl;
- const MR_TypeClassId *cur_type_class_id;
+ MR_TypeClassId cur_type_class_id;
slot = MR_string_hash_lookup_or_add(&MR_type_class_decl_info_table,
class_name);
Index: runtime/mercury_typeclass_info.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_typeclass_info.h,v
retrieving revision 1.4
diff -u -r1.4 mercury_typeclass_info.h
--- runtime/mercury_typeclass_info.h 3 Feb 2004 05:40:05 -0000 1.4
+++ runtime/mercury_typeclass_info.h 19 Apr 2005 05:54:26 -0000
@@ -109,11 +109,11 @@
** of a given type class.
*/
-typedef struct {
+struct MR_TypeClassMethod_Struct {
MR_ConstString MR_tc_method_name;
const MR_int_least8_t MR_tc_method_arity;
const MR_PredFunc MR_tc_method_pred_func;
-} MR_TypeClassMethod;
+};
/*
** MR_TypeClassId structures are intended to provide a printable representation
@@ -139,15 +139,15 @@
** to method descriptors, one for each method.
*/
-typedef struct {
- MR_ConstString MR_tc_id_module_name;
- MR_ConstString MR_tc_id_name;
- const MR_int_least8_t MR_tc_id_arity;
- const MR_int_least8_t MR_tc_id_num_type_vars;
- const MR_int_least16_t MR_tc_id_num_methods;
- const MR_ConstString *MR_tc_id_type_var_names;
- const MR_TypeClassMethod *MR_tc_id_methods;
-} MR_TypeClassId;
+struct MR_TypeClassId_Struct {
+ MR_ConstString MR_tc_id_module_name;
+ MR_ConstString MR_tc_id_name;
+ const MR_int_least8_t MR_tc_id_arity;
+ const MR_int_least8_t MR_tc_id_num_type_vars;
+ const MR_int_least16_t MR_tc_id_num_methods;
+ const MR_ConstString *MR_tc_id_type_var_names;
+ MR_TypeClassMethod MR_tc_id_methods;
+};
/*
** We generate one static MR_TypeClassDecl structure for each typeclass
@@ -173,7 +173,7 @@
*/
struct MR_TypeClassDecl_Struct {
- const MR_TypeClassId *MR_tc_decl_id;
+ MR_TypeClassId MR_tc_decl_id;
const MR_int_least8_t MR_tc_decl_version_number;
const MR_int_least8_t MR_tc_decl_num_supers;
const MR_TypeClassConstraint *MR_tc_decl_supers;
@@ -281,12 +281,12 @@
** of this design at runtime, just as we do for type_ctor_infos.
*/
-typedef struct {
+struct MR_ClassDict_Struct {
MR_Integer MR_class_dict_version_number;
MR_TypeClassDecl MR_class_dict_class;
MR_TypeInfo *MR_class_dict_type_binding;
MR_Code *MR_class_dict_methods;
-} MR_ClassDict;
+};
/*
** A MR_Dictionary_Struct structure corresponds to a fully solved type class
@@ -307,10 +307,10 @@
** (The +1 is because array numbering starts at 0.)
*/
-typedef struct {
+struct MR_Dictionary_Struct {
MR_Instance *MR_dict_top_instance;
- MR_ClassDict *MR_dict_class_methods;
- MR_ClassDict **MR_dict_superclass_dicts;
-} MR_Dictionary_Struct;
+ MR_ClassDictStruct *MR_dict_class_methods;
+ MR_ClassDictStruct **MR_dict_superclass_dicts;
+};
#endif /* not MERCURY_TYPECLASS_INFO_H */
Index: runtime/mercury_types.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_types.h,v
retrieving revision 1.40
diff -u -r1.40 mercury_types.h
--- runtime/mercury_types.h 14 Dec 2004 01:07:25 -0000 1.40
+++ runtime/mercury_types.h 19 Apr 2005 05:54:16 -0000
@@ -188,14 +188,20 @@
typedef MR_Code *MR_BaseTypeclassInfo;
#endif
-typedef struct MR_TypeClassDecl_Struct MR_TypeClassDeclStruct;
-typedef const struct MR_TypeClassDecl_Struct *MR_TypeClassDecl;
-typedef struct MR_Instance_Struct MR_InstanceStruct;
-typedef const struct MR_Instance_Struct *MR_Instance;
-typedef struct MR_DictId_Struct MR_DictIdStruct;
-typedef const struct MR_DictId_Struct *MR_DictId;
-typedef struct MR_Dictionary_Struct MR_DictionaryStruct;
-typedef const struct MR_Dictionary_Struct *MR_Dictionary;
+typedef struct MR_TypeClassDecl_Struct MR_TypeClassDeclStruct;
+typedef const struct MR_TypeClassDecl_Struct *MR_TypeClassDecl;
+typedef struct MR_Instance_Struct MR_InstanceStruct;
+typedef const struct MR_Instance_Struct *MR_Instance;
+typedef struct MR_DictId_Struct MR_DictIdStruct;
+typedef const struct MR_DictId_Struct *MR_DictId;
+typedef struct MR_Dictionary_Struct MR_DictionaryStruct;
+typedef const struct MR_Dictionary_Struct *MR_Dictionary;
+typedef struct MR_TypeClassId_Struct MR_TypeClassIdStruct;
+typedef const struct MR_TypeClassId_Struct *MR_TypeClassId;
+typedef struct MR_TypeClassMethod_Struct MR_TypeClassMethodStruct;
+typedef const struct MR_TypeClassMethod_Struct *MR_TypeClassMethod;
+typedef struct MR_ClassDict_Struct MR_ClassDictStruct;
+typedef const struct MR_ClassDict_Struct *MR_ClassDict;
typedef struct MR_TrailEntry_Struct MR_TrailEntry;
typedef struct MR_TrailEntry_Struct *MR_TrailEntryPtr;
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list