mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Merge pull request #18980 from LeStarch/jpl-c-basic-integral-types-fix
Fixing BasicIntTypes to allow C Standard Integers and 'bool'
This commit is contained in:
@@ -12,7 +12,11 @@
|
||||
import cpp
|
||||
|
||||
predicate allowedTypedefs(TypedefType t) {
|
||||
t.getName() = ["I64", "U64", "I32", "U32", "I16", "U16", "I8", "U8", "F64", "F32"]
|
||||
t.getName() =
|
||||
[
|
||||
"I64", "U64", "I32", "U32", "I16", "U16", "I8", "U8", "F64", "F32", "int64_t", "uint64_t",
|
||||
"int32_t", "uint32_t", "int16_t", "uint16_t", "int8_t", "uint8_t"
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,6 +50,8 @@ from Declaration d, Type usedType
|
||||
where
|
||||
usedType = getAUsedType*(getAnImmediateUsedType(d)) and
|
||||
problematic(usedType) and
|
||||
// Allow uses of boolean types where defined by the language.
|
||||
not usedType instanceof BoolType and
|
||||
// Ignore violations for which we do not have a valid location.
|
||||
not d.getLocation() instanceof UnknownLocation
|
||||
select d,
|
||||
|
||||
4
cpp/ql/src/change-notes/2025-03-11-basic-int-types.md
Normal file
4
cpp/ql/src/change-notes/2025-03-11-basic-int-types.md
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
category: minorAnalysis
|
||||
---
|
||||
* The query "Use of basic integral type" (`cpp/jpl-c/basic-int-types`) no longer produces alerts for the standard fixed width integer types (`int8_t`, `uint8_t`, etc.), and the `_Bool` and `bool` types.
|
||||
@@ -1,3 +1 @@
|
||||
| test.c:6:26:6:26 | x | x uses the basic integral type unsigned char rather than a typedef with size and signedness. |
|
||||
| test.c:7:20:7:20 | x | x uses the basic integral type unsigned char rather than a typedef with size and signedness. |
|
||||
| test.c:10:16:10:20 | test7 | test7 uses the basic integral type unsigned char rather than a typedef with size and signedness. |
|
||||
|
||||
Reference in New Issue
Block a user