[m-dev.] diff: cfloat.m: add #ifndef guard around typedef

Tyson Dowd trd at cs.mu.OZ.AU
Wed Dec 20 16:01:18 AEDT 2000


On the version-0_10_x branch this is fine, but we should fix the problem
automatically (as mentioned in the discussions of the review of the MC++
library changes I posted) on the main branch at some point.

It was mentioned here:
http://www.mercury.cs.mu.oz.au/mailing-lists/mercury-developers/mercury-developers.0012/0025.html

But this should wait until we full describe the rules about
foreign_proc, foreign_decl and foreign_code.

On 20-Dec-2000, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> I'll commit this on both the main branch and the
> version-0_10_x branch.
> 
> ----------
> 
> Estimated hours taken: 0.25
> 
> extras/clpr/cfloat.m:
> 	Add `#ifndef ... #define ... #endif' guards around the
> 	typedefs in `pragma c_header_code' declarations, to protect
> 	against multiple inclusion.  This is needed to get it to
> 	compile in hl* grades.
> 
> Workspace: /home/pgrad/fjh/ws/hg
> Index: extras/clpr/cfloat.m
> ===================================================================
> RCS file: /home/mercury1/repository/clpr/cfloat.m,v
> retrieving revision 1.31
> diff -u -d -r1.31 cfloat.m
> --- extras/clpr/cfloat.m	2000/12/15 03:38:37	1.31
> +++ extras/clpr/cfloat.m	2000/12/20 01:20:47
> @@ -378,6 +378,8 @@
>  ** Its entries store the values of the CLP(R) global variables, including
>  ** the `CLPR_trtop' variable, which points to the top of the CLP(R) trail.
>  */
> +#ifndef ML_CFLOAT_CHOICEPOINT_GUARD
> +#define ML_CFLOAT_CHOICEPOINT_GUARD
>  typedef struct ML_cfloat_choicepoint {
>  	int stamp;
>  	int slack_id;
> @@ -386,6 +388,7 @@
>  	NL_EQN_ptr nl_eqn_top;
>  	struct ML_cfloat_choicepoint *next;
>  } ML_cfloat_choicepoint;
> +#endif
>  
>  #define ML_cfloat_maybe_trail_solver()				\\
>  	( CLPR_stamp != MR_current_choicepoint_id() ? (		\\
> @@ -499,7 +502,10 @@
>  
>  :- pragma c_header_code("
>  
> +#ifndef ML_CFLOAT_SVAR_GUARD
> +#define ML_CFLOAT_SVAR_GUARD
>  typedef MR_Integer ML_svar;
> +#endif
>  
>  /*
>  ** The following ""functions"" are currently all implemented using macros.
> 
> -- 
> Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
>                                     |  of excellence is a lethal habit"
> WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- 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
> --------------------------------------------------------------------------

-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't everyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
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