VM_PROXY_ version testing

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

VM_PROXY_ version testing

alistairgrant
 
Hi All,

Recent versions of vmmaker are generating code similar to:

#if VM_PROXY_MAJOR > 1 || (VM_PROXY_MAJOR == 1 && VM_PROXY_MINOR >= 14)
extern sqInt primitiveFailForOSError(sqLong osError);
#else
# define primitiveFailForOSError(osError) 0
#endif


This seems quite dangerous as compiling with an earlier version of the
VM will succeed, but the plugin will behave in strange ways when run.
Forcing a compiler failure seems like the safer option, e.g. something
like:

#error "Not supported on VMs earlier than 1.14"

What do you think?

Thanks,
Alistair
Reply | Threaded
Open this post in threaded view
|

Re: VM_PROXY_ version testing

Eliot Miranda-2
 
Hi Alistair,


On Dec 30, 2018, at 9:29 AM, Alistair Grant <[hidden email]> wrote:


Hi All,

Recent versions of vmmaker are generating code similar to:

#if VM_PROXY_MAJOR > 1 || (VM_PROXY_MAJOR == 1 && VM_PROXY_MINOR >= 14)
extern sqInt primitiveFailForOSError(sqLong osError);
#else
# define primitiveFailForOSError(osError) 0
#endif


This seems quite dangerous as compiling with an earlier version of the
VM will succeed, but the plugin will behave in strange ways when run.
Forcing a compiler failure seems like the safer option, e.g. something
like:

#error "Not supported on VMs earlier than 1.14"

What do you think?

That’s one alternative.  Another is

#else
# define primitiveFailForOSError(osError) 
primitiveFailFor(PrimErrOSError)
#endif

or

#else
# define primitiveFailForOSError(osError) primitiveFailFor(PrimErrUnsupported)
#endif

Thanks,
Alistair
Reply | Threaded
Open this post in threaded view
|

Re: VM_PROXY_ version testing

alistairgrant
 
Hi Eliot,

On Sun, 30 Dec 2018 at 18:34, Eliot Miranda <[hidden email]> wrote:

>
>
> Hi Alistair,
>
>
> On Dec 30, 2018, at 9:29 AM, Alistair Grant <[hidden email]> wrote:
>
>
> Hi All,
>
> Recent versions of vmmaker are generating code similar to:
>
> #if VM_PROXY_MAJOR > 1 || (VM_PROXY_MAJOR == 1 && VM_PROXY_MINOR >= 14)
> extern sqInt primitiveFailForOSError(sqLong osError);
> #else
> # define primitiveFailForOSError(osError) 0
> #endif
>
>
> This seems quite dangerous as compiling with an earlier version of the
> VM will succeed, but the plugin will behave in strange ways when run.
> Forcing a compiler failure seems like the safer option, e.g. something
> like:
>
> #error "Not supported on VMs earlier than 1.14"
>
> What do you think?
>
>
> That’s one alternative.  Another is
>
> #else
> # define primitiveFailForOSError(osError) primitiveFailFor(PrimErrOSError)
> #endif

I thought of this one, but the smalltalk code is still going to behave
unexpectedly, and it won't be obvious to the user what the problem is.


> or
>
> #else
> # define primitiveFailForOSError(osError) primitiveFailFor(PrimErrUnsupported)
> #endif

This is much better.


Cheers,
Alistair