[m-dev.] Q: Declare_static?
Fergus Henderson
fjh at cs.mu.OZ.AU
Tue Nov 23 11:20:33 AEDT 1999
On 23-Nov-1999, Peter Ross <petdr at cs.mu.OZ.AU> wrote:
> In the following code, compiled in the grade none.gc
>
> ==================================
> Declare_static(mercury__exception__call_io_pred_4_0);
>
> void
> ML_exception_call_io_pred_det(Word Mercury__argument1, Word
> Mercury__argument2, Word * Mercury__argument3)
> {
> #if NUM_REAL_REGS > 0
> Word c_regs[NUM_REAL_REGS];
> #endif
>
> save_regs_to_mem(c_regs);
> restore_registers();
> r1 = Mercury__argument1;
> r2 = Mercury__argument2;
> save_transient_registers();
> {
> Declare_static(mercury__exception__call_io_pred_4_0);
> (void) MR_call_engine(ENTRY(mercury__exception__call_io_pred_4_0), FALSE);
> }
> restore_transient_registers();
> *Mercury__argument3 = r1;
> restore_regs_from_mem(c_regs);
> }
> ==================================
>
> the label mercury__exception__call_io_pred_4_0 is declared static twice,
> the second one results in the lcc compiler giving the following error
> message
>
> exception.c:4152: invalid storage class `static' for `pointer to void
> function(void) mercury__exception__call_io_pred_4_0'
>
> There is two fixes that work, but are they correct?
> * don't generate the second Declare_static
That fix should be fine. You just need to be sure that the first Declare_static
will be in scope.
> * or make it a Define_extern_entry
That would be wrong.
You could make it Declare_entry(), but that would be wrong too,
if it was defined with Define_static().
The first fix sounds like a better idea.
--
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