Suppress false positive warning for retriggering a Windows timer

781 views Asked by At

I wish to retrigger a Windows timer using a VCL6 TTimer object. I'm doing this by toggling the Enabled property, this of course can be confusing, but I added a comment about this. For Cppcheck I added a comment as well in its language:

m_pTimer->Enabled = false;
// die "doppelte Zuweisung" sorgt für einen Neustart des Timers
// cppcheck-suppress redundantAssignment
m_pTimer->Enabled = true;

...but it obviously doesn't help, I still see this style warning:

Variable 'Enabled' is reassigned a value before the old one has been used.

What am I doing wrong?

1

There are 1 answers

3
Jan Schatz On

For the command line version inline suppressions must be enabled through the command line switch --inline-suppr. For details refer to the manual.

For the GUI version you have to activate inline suppressions through the preferences dialog (Menu Edit->Preferences, tab General, Enable inline suppressions).