[m-dev.] for review: bootstrap in none.gc with MSVC

Fergus Henderson fjh at cs.mu.OZ.AU
Sun Aug 6 17:34:42 AEST 2000


That looks fine.

On 04-Jul-2000, Peter Ross <petdr at cs.mu.OZ.AU> wrote:
> Hi,
> 
> Fergus my original change had some problems with the field_names being
> declared with different sizes (as at some points we need to recalculate
> the array size, and we end up with different answers), so for the moment
> I will submit this one and keep working on the other change.
> 
> Pete
> 
> ===================================================================
> 
> 
> Estimated hours taken: 4
> 
> Bootcheck in the none.gc grade using MSVC.
> 
> compiler/rtti_out.m:
>     ANSI/ISO C doesn't allow empty arrays so place a dummy value in the
>     array when necessary.
>     ANSI/ISO C doesn't allow forward declarations of static data with
>     incomplete types, so make the incomplete types extern.  The ideal
>     solution would be to output the actual sizes of the array, however
>     that is slightly more difficult then it seems.
> 
> runtime/mercury_type_info.h:
>     Create new macro MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_NOCM, which is the
>     same as MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_FULL but with no cm field.
>     
> library/builtin.m:
>     Use MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_NOCM instead of
>     MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_FULL when we have a blank cm field
>     as the MSVC CPP doesn't like blank fields.
>     
> trace/mercury_trace_vars.c:
>     Delete the local declarations of mercury_data___type_ctor_info_func_0
>     and mercury_data___type_ctor_info_pred_0 because the true
>     declarations from the header file are visibile.
> 
> Index: compiler/rtti_out.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/rtti_out.m,v
> retrieving revision 1.11
> diff -u -r1.11 rtti_out.m
> --- compiler/rtti_out.m	2000/05/10 18:07:05	1.11
> +++ compiler/rtti_out.m	2000/07/04 09:18:46
> @@ -88,9 +88,17 @@
>  		DeclSet0, DeclSet) -->
>  	output_generic_rtti_data_defn_start(RttiTypeId, exist_locns(Ordinal),
>  		DeclSet0, DeclSet),
> -	io__write_string(" = {\n"),
> -	output_exist_locns(Locns),
> -	io__write_string("};\n").
> +	(
> +			% ANSI/ISO C doesn't allow empty arrays, so
> +			% place a dummy value in the array if necessary.
> +		{ Locns = [] }
> +	->
> +		io__write_string("= { {0, 0} };\n")
> +	;
> +		io__write_string(" = {\n"),
> +		output_exist_locns(Locns),
> +		io__write_string("};\n")
> +	).
>  output_rtti_data_defn(exist_info(RttiTypeId, Ordinal, Plain, InTci, Tci,
>  		Locns), DeclSet0, DeclSet) -->
>  	output_rtti_addr_decls(RttiTypeId, Locns, "", "", 0, _,
> @@ -110,17 +118,33 @@
>  		DeclSet0, DeclSet) -->
>  	output_generic_rtti_data_defn_start(RttiTypeId, field_names(Ordinal),
>  		DeclSet0, DeclSet),
> -	io__write_string(" = {\n"),
> -	output_maybe_quoted_strings(MaybeNames),
> -	io__write_string("};\n").
> +	(
> +			% ANSI/ISO C doesn't allow empty arrays, so
> +			% place a dummy value in the array if necessary.
> +		{ MaybeNames = [] }
> +	->
> +		io__write_string("= { "" };\n")
> +	;
> +		io__write_string(" = {\n"),
> +		output_maybe_quoted_strings(MaybeNames),
> +		io__write_string("};\n")
> +	).
>  output_rtti_data_defn(field_types(RttiTypeId, Ordinal, Types),
>  		DeclSet0, DeclSet) -->
>  	output_rtti_datas_decls(Types, "", "", 0, _, DeclSet0, DeclSet1),
>  	output_generic_rtti_data_defn_start(RttiTypeId, field_types(Ordinal),
>  		DeclSet1, DeclSet),
> -	io__write_string(" = {\n"),
> -	output_addr_of_rtti_datas(Types),
> -	io__write_string("};\n").
> +	(
> +			% ANSI/ISO C doesn't allow empty arrays, so
> +			% place a dummy value in the array if necessary.
> +		{ Types = [] }
> +	->
> +		io__write_string("= { NULL };\n")
> +	;
> +		io__write_string(" = {\n"),
> +		output_addr_of_rtti_datas(Types),
> +		io__write_string("};\n")
> +	).
>  output_rtti_data_defn(enum_functor_desc(RttiTypeId, FunctorName, Ordinal),
>  		DeclSet0, DeclSet) -->
>  	output_generic_rtti_data_defn_start(RttiTypeId,
> @@ -929,9 +953,19 @@
>  pseudo_type_info_would_incl_code_addr(higher_order_type_info(_, _, _))	= no.
>  
>  rtti_name_linkage(RttiName, Linkage) :-
> -	Exported = rtti_name_is_exported(RttiName),
> -	( Exported = yes, Linkage = extern
> -	; Exported = no, Linkage = static
> +	(
> +			% ANSI/ISO C doesn't allow forward declarations
> +			% of static data with incomplete types (in this
> +			% case array types without an explicit array
> +			% size), so make the declarations extern.
> +		yes = rtti_name_has_array_type(RttiName)
> +	->
> +		Linkage = extern
> +	;
> +		Exported = rtti_name_is_exported(RttiName),
> +		( Exported = yes, Linkage = extern
> +		; Exported = no, Linkage = static
> +		)
>          ).
>  
>  rtti_name_c_type(exist_locns(_),           "MR_DuExistLocn", "[]").
> Index: library/builtin.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/library/builtin.m,v
> retrieving revision 1.36
> diff -u -r1.36 builtin.m
> --- library/builtin.m	2000/05/31 12:58:19	1.36
> +++ library/builtin.m	2000/07/04 09:18:50
> @@ -236,22 +236,22 @@
>  
>  #ifndef MR_HIGHLEVEL_CODE
>  
> -MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_FULL(builtin, , int, 0,
> +MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_NOCM(builtin, int, 0,
>  	MR_TYPECTOR_REP_INT,
>  	mercury__builtin_unify_int_2_0,
>  	mercury__builtin_compare_int_3_0);
>  
> -MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_FULL(builtin, , character, 0,
> +MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_NOCM(builtin, character, 0,
>  	MR_TYPECTOR_REP_CHAR,
>  	mercury__builtin_unify_character_2_0,
>  	mercury__builtin_compare_character_3_0);
>  
> -MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_FULL(builtin, , string, 0,
> +MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_NOCM(builtin, string, 0,
>  	MR_TYPECTOR_REP_STRING,
>  	mercury__builtin_unify_string_2_0,
>  	mercury__builtin_compare_string_3_0);
>  
> -MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_FULL(builtin, , float, 0,
> +MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_NOCM(builtin, float, 0,
>  	MR_TYPECTOR_REP_FLOAT,
>  	mercury__builtin_unify_float_2_0,
>  	mercury__builtin_compare_float_3_0);
> @@ -261,11 +261,11 @@
>  	** Note that they use the same three predicates.
>  	*/
>  
> -MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_FULL(builtin, , func, 0,
> +MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_NOCM(builtin, func, 0,
>  	MR_TYPECTOR_REP_PRED,
>  	mercury__builtin_unify_pred_2_0,
>  	mercury__builtin_compare_pred_3_0);
> -MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_FULL(builtin, , pred, 0,
> +MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_NOCM(builtin, pred, 0,
>  	MR_TYPECTOR_REP_PRED,
>  	mercury__builtin_unify_pred_2_0,
>  	mercury__builtin_compare_pred_3_0);
> Index: runtime/mercury_type_info.h
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/runtime/mercury_type_info.h,v
> retrieving revision 1.51
> diff -u -r1.51 mercury_type_info.h
> --- runtime/mercury_type_info.h	2000/05/05 10:14:49	1.51
> +++ runtime/mercury_type_info.h	2000/07/04 09:18:59
> @@ -808,10 +808,22 @@
>  */
>  
>  #define MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_FULL(m, cm, n, a, cr, u, c)    \
> +    MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_FULL_A(u, c)			\
> +    MR_PASTE6(mercury_data_, cm, __type_ctor_info_, n, _, a) = {        \
> +    MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_FULL_B(m, n, a, cr, u, c)
> +
> +	/* MSVC CPP doesn't like having an empty CM field. */
> +#define MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_NOCM(m, n, a, cr, u, c)	\
> +    MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_FULL_A(u, c)			\
> +    MR_PASTE5(mercury_data_, __type_ctor_info_, n, _, a) = {		\
> +    MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_FULL_B(m, n, a, cr, u, c)
> +
> +#define MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_FULL_A(u, c)			\
>      Declare_entry(u);                                                   \
>      Declare_entry(c);                                                   \
>      MR_STATIC_CODE_CONST struct MR_TypeCtorInfo_Struct                  \
> -    MR_PASTE6(mercury_data_, cm, __type_ctor_info_, n, _, a) = {        \
> +
> +#define MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_FULL_B(m, n, a, cr, u, c)	\
>          a,                                                              \
>          MR_MAYBE_STATIC_CODE(ENTRY(u)),                                 \
>          MR_MAYBE_STATIC_CODE(ENTRY(u)),                                 \
> @@ -837,7 +849,7 @@
>          MR_PASTE7(mercury____Compare___, m, __, n, _, a, _0))
>  
>  #define MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_UNUSED(n, a, cr)       \
> -    MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_FULL(builtin, , n, a, cr,  \
> +    MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_NOCM(builtin, n, a, cr,	\
>          mercury__unused_0_0,                                    \
>          mercury__unused_0_0)
>  
> Index: trace/mercury_trace_vars.c
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_vars.c,v
> retrieving revision 1.16
> diff -u -r1.16 mercury_trace_vars.c
> --- trace/mercury_trace_vars.c	2000/05/15 16:37:48	1.16
> +++ trace/mercury_trace_vars.c	2000/07/04 09:19:04
> @@ -138,8 +138,6 @@
>  	mercury_data_std_util__type_ctor_info_type_desc_0;
>  extern	struct MR_TypeCtorInfo_Struct
>  	mercury_data_std_util__type_ctor_info_type_ctor_desc_0;
> -extern	struct MR_TypeCtorInfo_Struct	mercury_data___type_ctor_info_func_0;
> -extern	struct MR_TypeCtorInfo_Struct	mercury_data___type_ctor_info_pred_0;
>  extern	struct MR_TypeCtorInfo_Struct	mercury_data___type_ctor_info_void_0;
>  
>  #ifdef	NATIVE_GC
> 
> --------------------------------------------------------------------------
> 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
> --------------------------------------------------------------------------

-- 
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