[m-dev.] for review: fix for linkage mismatch bug

Tyson Dowd trd at cs.mu.OZ.AU
Thu Sep 3 19:34:44 AEST 1998


On 03-Sep-1998, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> Tyson, could you please review this one?
> 
> Index: compiler/llds_out.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/llds_out.m,v
> retrieving revision 1.87
> diff -u -r1.87 llds_out.m
> --- llds_out.m	1998/07/29 08:53:20	1.87
> +++ llds_out.m	1998/09/03 08:07:41
> @@ -484,6 +484,24 @@
>  	io__write_string("\n"),
>  	{ DataAddr = data_addr(data_addr(ModuleName, VarName)) },
>  	output_cons_arg_decls(ArgVals, "", "", 0, _, DeclSet0, DeclSet1),
> +
> +	%
> +	% sanity check: check that the (redundant) ExportedFromModule field
> +	% in the c_data, which we use for the definition, matches the linkage
> +	% computed by linkage/2 from the dataname, which we use for any
> +	% prior declarations.
> +	%
> +	{ linkage(VarName, Linkage) },
> +	{
> +		( Linkage = extern, ExportedFromModule = yes
> +		; Linkage = static, ExportedFromModule = no
> +		)
> +	->
> +		true
> +	;
> +		error("linkage mismatch")
> +	},
> +	

This is an excellent use of the redundant information.

The change looks good.  As long as it bootchecks ok, it should
be fine to commit.

-- 
Those who would give up essential liberty to purchase a little temporary
safety deserve neither liberty nor safety.     - Benjamin Franklin

Tyson Dowd   <tyson at tyse.net>   http://tyse.net



More information about the developers mailing list