Skip to content

Commit 0ddb315

Browse files
committed
C++: Revert JPL rule changes, keep library change
1 parent 933ba89 commit 0ddb315

3 files changed

Lines changed: 5 additions & 12 deletions

File tree

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
lgtm,codescanning
2-
* The opt-in queries for JPL C coding standards Rule 24 now exclude macros from
3-
system headers.
2+
* The QL library `semmle.code.cpp.commons.Exclusions` now contains a predicate
3+
`isFromSystemMacroDefinition` for identifying code that originates from a
4+
macro outside the project being analyzed.

cpp/ql/src/JPL_C/LOC-4/Rule 24/MultipleStmtsPerLine.ql

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
*/
1111

1212
import cpp
13-
import semmle.code.cpp.commons.Exclusions
1413

1514
class OneLineStmt extends Stmt {
1615
OneLineStmt() {
@@ -35,8 +34,5 @@ where
3534
other.onLine(f, line) and toMin = other.getLocation().getStartColumn()
3635
|
3736
toMin
38-
) and
39-
// Exclude statements that are from invocations of system-header macros.
40-
// Example: FD_ISSET from glibc.
41-
not isFromSystemMacroDefinition(o)
37+
)
4238
select o, "This line contains " + cnt + " statements; only one is allowed."

cpp/ql/src/JPL_C/LOC-4/Rule 24/MultipleVarDeclsPerLine.ql

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,11 @@
1010
*/
1111

1212
import cpp
13-
import semmle.code.cpp.commons.Exclusions
1413

1514
from DeclStmt d
1615
where
1716
exists(Variable v1, Variable v2 | v1 = d.getADeclaration() and v2 = d.getADeclaration() |
1817
v1 != v2 and
1918
v1.getLocation().getStartLine() = v2.getLocation().getStartLine()
20-
) and
21-
// Exclude declarations that are from invocations of system-header macros.
22-
// Example: FD_ZERO from glibc.
23-
not isFromSystemMacroDefinition(d)
19+
)
2420
select d, "Multiple variable declarations on the same line."

0 commit comments

Comments
 (0)