[Vm-dev] TMethod>>outputConditionalDefineFor:on: proposed modification

Alistair Grant akgrant0710 at gmail.com
Thu Mar 22 18:32:58 UTC 2018


Hi Everyone,

VMMaker plugin C generation allows the option: pragma to be used to
conditionally compile methods in specific VMs, e.g.:


primitiveForPharoOnWin32
    <option: #_WIN32>
    <option: #PharoVM>

    ^self doStuff



will generate C code along the lines of:

#if _WIN32 && PharoVM
sqInt primitiveForPharoOnWin32()
{ ... }
#endif


The problem is that on non Win32 platforms this will cause a compiler
error as _WIN32 isn't defined, and the resulting directive is invalid.

Modifying TMethod>>outputConditionalDefineFor:on: to generate:

#if defined(_WIN32) && defined(PharoVM)
sqInt primitiveForPharoOnWin32()
{ ... }
#endif


avoids the problem.

Any comment or opposition to me submitting this change?

Thanks,
Alistair


More information about the Vm-dev mailing list