Hi Mac,
Bugger!!!!
will not work either, very close though.
Will depend in what you are doing in the code as to how you would implement the use.
To explain, One of the uses I had in mind was to protect a global variables value whilst reading it or writing it, either in an IRQ or in a background access.
int read_x( int x )
{
return x;
}
This produces code, LDD x; RTS.
With our solution
int read_x( int x )
{
_critical
_critical_return (x)
}
produces
PSHC
SEI
PULC
LDD x
RTS
A pointless operation huh!
We would have to try and maybe load a local with x and return the local and then ensure the compiler
does not optimize out our uae of the local.
I have contacted CodeWarrior and they tell me they will look at it and put it on the requested functionality
list. So no immediate nice solution, if there ever will be.
I might try and see if I can do some sort of macro function call and embedd our solution in there, maybe!!
regards
Phil