Skip to content

Commit 0d86495

Browse files
committed
Merge commit 'b9b508e47b3aa62481e30b792a3c1d91f1848081' into codeql/upgrade-to-2.15.5
2 parents c9a7b05 + b9b508e commit 0d86495

File tree

8 files changed

+15
-36
lines changed

8 files changed

+15
-36
lines changed

c/misra/src/rules/RULE-10-1/OperandsOfAnInappropriateEssentialType.ql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import cpp
1616
import codingstandards.c.misra
1717
import codingstandards.c.misra.EssentialTypes
18-
import codingstandards.cpp.Bitwise
1918

2019
/**
2120
* Holds if the operator `operator` has an operand `child` that is of an inappropriate essential type
@@ -179,7 +178,7 @@ predicate isInappropriateEssentialType(
179178
child =
180179
[
181180
operator.(BinaryBitwiseOperation).getAnOperand(),
182-
operator.(Bitwise::AssignBitwiseOperation).getAnOperand(),
181+
operator.(AssignBitwiseOperation).getAnOperand(),
183182
operator.(ComplementExpr).getAnOperand()
184183
] and
185184
not operator instanceof LShiftExpr and

c/misra/src/rules/RULE-8-2/FunctionTypesNotInPrototypeForm.ql

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,9 @@ where
4949
msg = "Function " + f + " does not specify void for no parameters present."
5050
or
5151
//parameters declared in declaration list (not in function signature)
52-
//have placeholder file location associated only
53-
exists(Parameter p |
54-
p.getFunction() = f and
55-
not p.getFile() = f.getFile() and
56-
msg = "Function " + f + " declares parameter in unsupported declaration list."
57-
)
52+
//have no prototype
53+
not f.isPrototyped() and
54+
not hasZeroParamDecl(f) and
55+
msg = "Function " + f + " declares parameter in unsupported declaration list."
5856
)
5957
select f, msg

cpp/autosar/src/rules/M5-0-20/BitwiseOperatorOperandsHaveDifferentUnderlyingType.ql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,14 @@
1616

1717
import cpp
1818
import codingstandards.cpp.autosar
19-
import codingstandards.cpp.Bitwise
2019
import codingstandards.cpp.Conversion
2120

2221
predicate isBinaryBitwiseOperation(Operation o, VariableAccess l, VariableAccess r) {
2322
exists(BinaryBitwiseOperation bbo | bbo = o |
2423
l = bbo.getLeftOperand() and r = bbo.getRightOperand()
2524
)
2625
or
27-
exists(Bitwise::AssignBitwiseOperation abo | abo = o |
26+
exists(AssignBitwiseOperation abo | abo = o |
2827
l = abo.getLValue() and
2928
r = abo.getRValue()
3029
)

cpp/autosar/src/rules/M5-0-21/BitwiseOperatorAppliedToSignedTypes.ql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,14 @@
1717

1818
import cpp
1919
import codingstandards.cpp.autosar
20-
import codingstandards.cpp.Bitwise
2120

2221
from Operation o, VariableAccess va
2322
where
2423
not isExcluded(o, ExpressionsPackage::bitwiseOperatorAppliedToSignedTypesQuery()) and
2524
(
2625
o instanceof UnaryBitwiseOperation or
2726
o instanceof BinaryBitwiseOperation or
28-
o instanceof Bitwise::AssignBitwiseOperation
27+
o instanceof AssignBitwiseOperation
2928
) and
3029
o.getAnOperand() = va and
3130
va.getTarget().getUnderlyingType().(IntegralType).isSigned()

cpp/autosar/src/rules/M5-8-1/RightBitShiftOperandIsNegativeOrTooWide.ql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import cpp
1919
import codingstandards.cpp.autosar
20-
import codingstandards.cpp.Bitwise
2120

2221
class ShiftOperation extends Operation {
2322
Expr leftOperand;
@@ -34,7 +33,7 @@ class ShiftOperation extends Operation {
3433
rightOperand = o.getRightOperand()
3534
)
3635
or
37-
exists(Bitwise::AssignBitwiseOperation o | this = o |
36+
exists(AssignBitwiseOperation o | this = o |
3837
(
3938
o instanceof AssignLShiftExpr
4039
or

cpp/cert/test/rules/MEM53-CPP/MissingConstructorCallForManuallyManagedObject.expected

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
edges
2+
| test.cpp:65:21:65:34 | call to operator new | test.cpp:67:26:67:32 | call to realloc |
23
nodes
34
| test.cpp:16:26:16:31 | call to malloc | semmle.label | call to malloc |
45
| test.cpp:17:38:17:43 | call to malloc | semmle.label | call to malloc |
@@ -9,6 +10,8 @@ nodes
910
| test.cpp:47:26:47:39 | call to operator new | semmle.label | call to operator new |
1011
| test.cpp:49:29:49:42 | call to operator new | semmle.label | call to operator new |
1112
| test.cpp:51:29:51:42 | call to operator new | semmle.label | call to operator new |
13+
| test.cpp:65:21:65:34 | call to operator new | semmle.label | call to operator new |
14+
| test.cpp:67:26:67:32 | call to realloc | semmle.label | call to realloc |
1215
subpaths
1316
#select
1417
| test.cpp:16:26:16:31 | call to malloc | test.cpp:16:26:16:31 | call to malloc | test.cpp:16:26:16:31 | call to malloc | Allocation to cast without constructor call |
@@ -20,3 +23,4 @@ subpaths
2023
| test.cpp:47:26:47:39 | call to operator new | test.cpp:47:26:47:39 | call to operator new | test.cpp:47:26:47:39 | call to operator new | Allocation to cast without constructor call |
2124
| test.cpp:49:29:49:42 | call to operator new | test.cpp:49:29:49:42 | call to operator new | test.cpp:49:29:49:42 | call to operator new | Allocation to cast without constructor call |
2225
| test.cpp:51:29:51:42 | call to operator new | test.cpp:51:29:51:42 | call to operator new | test.cpp:51:29:51:42 | call to operator new | Allocation to cast without constructor call |
26+
| test.cpp:67:26:67:32 | call to realloc | test.cpp:65:21:65:34 | call to operator new | test.cpp:67:26:67:32 | call to realloc | Allocation to cast without constructor call |

cpp/cert/test/rules/MEM53-CPP/test.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ void test_no_constructor_but_has_destructor() {
6363

6464
void test_realloc() {
6565
void *goodAlloc = ::operator new(sizeof(ClassA));
66-
ClassA *a1 = new (goodAlloc) ClassA{1}; // COMPLIANT
67-
ClassA *a2 = (ClassA *)realloc(goodAlloc, sizeof(ClassA) * 2); // COMPLIANT
66+
ClassA *a1 = new (goodAlloc) ClassA{1}; // COMPLIANT
67+
ClassA *a2 = (ClassA *)realloc(
68+
goodAlloc, sizeof(ClassA) * 2); // COMPLIANT [FALSE_POSITIVE]
6869
}

cpp/common/src/codingstandards/cpp/Bitwise.qll

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)