-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
Description
We noticed false positives when testing SAL annotations.
These three should demonstrate the issue:
sal.h:
#define _SAL_VERSION 20
test.cpp:
#include "sal.h"
int method1() {
return _SAL_VERSION;
}
void method2();
test.ql:
import Microsoft.SAL
from SALAnnotation a
select a, a.getDeclaration()
Output from the query:
| test.cpp:3:12:3:23 | _SAL_VERSION | test.cpp:5:6:5:12 | method2 |
It seems the detection is based on "rank" and the fact that MacroInvocation _SAL_VERSION
is before DeclarationEntry method2
.
Not sure what is the best fix, can you please advise? Thank you.