Skip to content

Commit 0f8e39a

Browse files
committed
C++: Silence ExtractionRecoverableWarnings when BMN is active
1 parent 1a4f333 commit 0f8e39a

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

cpp/ql/src/Diagnostics/ExtractionProblems.qll

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ private newtype TExtractionProblem =
5050
/**
5151
* Superclass for the extraction problem hierarchy.
5252
*/
53-
class ExtractionProblem extends TExtractionProblem {
53+
abstract class ExtractionProblem extends TExtractionProblem {
5454
/** Gets the string representation of the problem. */
5555
string toString() { none() }
5656

@@ -65,6 +65,9 @@ class ExtractionProblem extends TExtractionProblem {
6565

6666
/** Gets the SARIF severity of this problem. */
6767
int getSeverity() { none() }
68+
69+
/** Gets the `Compilation` the problem is associated with. */
70+
abstract Compilation getCompilation();
6871
}
6972

7073
/**
@@ -96,6 +99,8 @@ class ExtractionUnrecoverableError extends ExtractionProblem, TCompilationFailed
9699
// [errors](https://docs.oasis-open.org/sarif/sarif/v2.1.0/csprd01/sarif-v2.1.0-csprd01.html#_Toc10541338).
97100
result = 2
98101
}
102+
103+
override Compilation getCompilation() { result = c }
99104
}
100105

101106
/**
@@ -122,6 +127,8 @@ class ExtractionRecoverableWarning extends ExtractionProblem, TReportableWarning
122127
// [warnings](https://docs.oasis-open.org/sarif/sarif/v2.1.0/csprd01/sarif-v2.1.0-csprd01.html#_Toc10541338).
123128
result = 1
124129
}
130+
131+
override Compilation getCompilation() { result = err.getCompilation() }
125132
}
126133

127134
/**
@@ -148,4 +155,6 @@ class ExtractionUnknownProblem extends ExtractionProblem, TUnknownProblem {
148155
// [warnings](https://docs.oasis-open.org/sarif/sarif/v2.1.0/csprd01/sarif-v2.1.0-csprd01.html#_Toc10541338).
149156
result = 1
150157
}
158+
159+
override Compilation getCompilation() { result = err.getCompilation() }
151160
}

cpp/ql/src/Diagnostics/ExtractionWarnings.ql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ import ExtractionProblems
1010

1111
from ExtractionProblem warning
1212
where
13-
warning instanceof ExtractionRecoverableWarning and exists(warning.getFile().getRelativePath())
13+
warning instanceof ExtractionRecoverableWarning and
14+
exists(warning.getFile().getRelativePath()) and
15+
not warning.getCompilation().buildModeNone()
1416
or
1517
warning instanceof ExtractionUnknownProblem
1618
select warning,

0 commit comments

Comments
 (0)