[m-rev.] for review: fix bad references to type_ctor_infos in table_builtin.m

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Sep 20 02:50:02 AEST 2002


On 12-Sep-2002, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> +++ runtime/mercury_builtin_types.h	12 Sep 2002 04:51:45 -0000
...
> @@ -27,29 +24,46 @@
>  */
>  
>  /* declare MR_TypeCtorInfo_Structs for the builtin types */
> -extern const MR_TypeCtorInfo_Struct
> -	mercury__builtin__builtin__type_ctor_info_int_0,
> -	mercury__builtin__builtin__type_ctor_info_string_0,
> -	mercury__builtin__builtin__type_ctor_info_float_0,
...
> +MR_DECLARE_TYPE_CTOR_INFO_STRUCT(
> +	MR_TYPE_CTOR_INFO_NAME(builtin, int, 0));
> +MR_DECLARE_TYPE_CTOR_INFO_STRUCT(
> +	MR_TYPE_CTOR_INFO_NAME(builtin, string, 0));
> +MR_DECLARE_TYPE_CTOR_INFO_STRUCT(
> +	MR_TYPE_CTOR_INFO_NAME(builtin, float, 0));

This patch is not fully namespace-clean.

In particular, if user code does something such as

	#define builtin ...
or
	#define string ...

and this code gets included before mercury_builtin_types.h,
then I'm pretty sure it will cause problems.

> +++ runtime/mercury_type_desc.h	11 Sep 2002 03:54:33 -0000
> @@ -11,9 +11,10 @@
> +		? &MR_TYPE_CTOR_INFO_NAME(builtin, pred, 0)		\
...
> +			? &MR_TYPE_CTOR_INFO_NAME(builtin, func, 0)	\
> +			: &MR_TYPE_CTOR_INFO_NAME(builtin, tuple, 0))) )

Likewise here.

This is difficult to fix, and currently mercury.h / mercury_imp.h
gets included first in the C code that we generate, so it would
only be a problem for C files that users write.  So perhaps it is
not worth worrying about for now.  But at very least it should
be mentioned in an XXX comment.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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