C++: Disable results from the 5 queries.

This commit is contained in:
Geoffrey White
2026-04-02 10:51:31 +01:00
parent 83aa07b22c
commit 560b876d6d
5 changed files with 10 additions and 5 deletions

View File

@@ -220,7 +220,8 @@ where
// maximum (resp. minimum) number we can compute.
overflows(me, t1) and
// exclude cases where the expression type may not have been extracted accurately
not me.getParent().(Call).getTarget().hasAmbiguousReturnType()
not me.getParent().(Call).getTarget().hasAmbiguousReturnType() and
none()
select me,
"Multiplication result may overflow '" + me.getType().toString() + "' before it is converted to '"
+ me.getFullyConverted().getType().toString() + "'."

View File

@@ -175,7 +175,8 @@ where
not arg.getType().stripType().(RoutineType).getReturnType() instanceof ErroneousType and
not arg.(Call).mayBeFromImplicitlyDeclaredFunction() and
// Make sure that the format function definition is consistent
count(ffc.getTarget().getFormatParameterIndex()) = 1
count(ffc.getTarget().getFormatParameterIndex()) = 1 and
none()
select arg,
"This format specifier for type '" + expected.getName() + "' does not match the argument type '" +
actual.getUnspecifiedType().getName() + "'."

View File

@@ -45,5 +45,6 @@ where
sameLocation(fdeIm, fc) and
not mistypedFunctionArguments(fc, _, _) and
not tooFewArguments(fc, _) and
not tooManyArguments(fc, _)
not tooManyArguments(fc, _) and
none()
select fc, "Function call implicitly declares '" + fdeIm.getName() + "'."

View File

@@ -73,7 +73,8 @@ where
not getComparisonSize(large.(RShiftExpr).getLeftOperand().getExplicitlyConverted()) <=
getComparisonSize(small) and
// ignore loop-invariant smaller variables
loopVariant(small, l)
loopVariant(small, l) and
none()
select rel,
"Comparison between $@ of type " + small.getType().getName() + " and $@ of wider type " +
large.getType().getName() + ".", friendlyLoc(small), small.toString(), friendlyLoc(large),

View File

@@ -29,7 +29,8 @@ where
// the pointer expression to be `char*` or `void*`. Otherwise it
// is probably a mistake.
addWithSizeof(e, sizeofExpr, _) and
not isCharSzPtrExpr(e)
not isCharSzPtrExpr(e) and
none()
select sizeofExpr,
"Suspicious sizeof offset in a pointer arithmetic expression. The type of the pointer is $@.",
e.getFullyConverted().getType() as t, t.toString()