How to correctly annotate with Prefast

I am trying to use WDK6001 PreFast to verify some of my drivers.

I have a wrapper functions around Acquire/Release spinlock and want PreFast to correctly help me identify forgoten spinlock releases.

My driver uses C++ (well I know what you think) but my problem is also visible on plain C with global variables.

struct CSpinLock {
KIRQL oldIrql;

void Lock() { KeAcquireSpinLock( &lock, &oldIrql ); }
void Unlock() { KeReleaseSpinLock( &lock, oldIrql ); }

How can I properly annotate Lock() and Unlock() functions? I have tried all possible combinations of __drv_savesIrqlGlobal( A, B ) and __drv_restoresIrqlGlobal( A, B ) but can not get any values for A and B that don’t generate PreFast annotation syntax error.


__drv_savesIrqlGlobal( SpinLock, oldIrql )
void Lock() { KeAcquireSpinLock( &lock, &oldIrql ); }

generates this error:
test.cpp(19) : warning 28260: A syntax error in the annotations was found for function CSpinLock::Lock, for property ‘saveIRQL’, while parsing symbol, beginning just before “oldIrql”.