[m-dev.] diff: another fix for --high-level-data
Fergus Henderson
fjh at cs.mu.OZ.AU
Mon Jun 5 12:42:25 AEST 2000
Estimated hours taken: 0.5
Another fix for --high-level-data.
compiler/mlds_to_c.m:
Add `_s' at the end of struct tag names and `_e' at the end of
enum tag names. When using abstract enum types, the type will
be declared as a struct in the importing module, but as an enum
in the defining module; this change ensures that we don't get
errors due to the same name being used for both a struct and
an enum (ANSI C uses a single namespace for struct, union,
and enum tags). Of course we still get some warnings from gcc
when calling procedures whose arguments are abstract enum types,
since the types in the caller and callee don't match, but those
can be safely ignored for now.
runtime/mercury.h:
Update to reflect the new names for structs.
Workspace: /home/pgrad/fjh/ws/hg
Index: compiler/mlds_to_c.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_c.m,v
retrieving revision 1.36
diff -u -d -r1.36 mlds_to_c.m
--- compiler/mlds_to_c.m 2000/05/31 12:58:14 1.36
+++ compiler/mlds_to_c.m 2000/06/05 00:28:45
@@ -571,11 +571,14 @@
mlds_output_class_decl(_Indent, Name, ClassDefn) -->
( { ClassDefn^kind = mlds__enum } ->
- io__write_string("enum ")
+ io__write_string("enum "),
+ mlds_output_fully_qualified_name(Name),
+ io__write_string("_e")
;
- io__write_string("struct ")
- ),
- mlds_output_fully_qualified_name(Name).
+ io__write_string("struct "),
+ mlds_output_fully_qualified_name(Name),
+ io__write_string("_s")
+ ).
:- pred mlds_output_class(indent, mlds__qualified_entity_name, mlds__context,
mlds__class_defn, io__state, io__state).
@@ -1155,7 +1158,7 @@
%
io__write_string("MR_Integer /* actually `enum "),
mlds_output_fully_qualified(Name, io__write_string),
- io__format("_%d", [i(Arity)]),
+ io__format("_%d_e", [i(Arity)]),
io__write_string("' */")
;
% For struct types it's OK to output an incomplete type,
@@ -1163,7 +1166,7 @@
% use pointers to them.
io__write_string("struct "),
mlds_output_fully_qualified(Name, io__write_string),
- io__format("_%d", [i(Arity)])
+ io__format("_%d_s", [i(Arity)])
).
mlds_output_type_prefix(mlds__ptr_type(Type)) -->
mlds_output_type(Type),
Index: runtime/mercury.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury.h,v
retrieving revision 1.12
diff -u -d -r1.12 mercury.h
--- runtime/mercury.h 2000/05/31 12:58:24 1.12
+++ runtime/mercury.h 2000/06/05 00:41:41
@@ -92,17 +92,17 @@
#ifdef MR_HIGHLEVEL_DATA
typedef MR_Integer /* really `enum mercury__builtin__comparison_result_0' */
MR_Comparison_Result;
- typedef struct mercury__builtin__void_0 * MR_Void;
- typedef struct mercury__builtin__c_pointer_0 * MR_C_Pointer;
+ typedef struct mercury__builtin__void_0_s * MR_Void;
+ typedef struct mercury__builtin__c_pointer_0_s * MR_C_Pointer;
typedef MR_ClosurePtr MR_Pred;
typedef MR_ClosurePtr MR_Func;
- typedef struct mercury__array__array_1 * MR_Array;
- typedef struct mercury__std_util__univ_0 * MR_Univ;
- typedef struct mercury__std_util__type_desc_0 * MR_Type_Desc;
- typedef struct mercury__private_builtin__type_info_1 * MR_Type_Info;
- typedef struct mercury__private_builtin__type_ctor_info_1 * MR_Type_Ctor_Info;
- typedef struct mercury__private_builtin__typeclass_info_1 * MR_TypeClass_Info;
- typedef struct mercury__private_builtin__base_typeclass_info_1 *
+ typedef struct mercury__array__array_1_s * MR_Array;
+ typedef struct mercury__std_util__univ_0_s * MR_Univ;
+ typedef struct mercury__std_util__type_desc_0_s * MR_Type_Desc;
+ typedef struct mercury__private_builtin__type_info_1_s * MR_Type_Info;
+ typedef struct mercury__private_builtin__type_ctor_info_1_s * MR_Type_Ctor_Info;
+ typedef struct mercury__private_builtin__typeclass_info_1_s * MR_TypeClass_Info;
+ typedef struct mercury__private_builtin__base_typeclass_info_1_s *
MR_Base_TypeClass_Info;
#else
/* for --no-high-level-data, they're all just `MR_Word' */
--
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.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list