Skip to content

Commit 6496bf8

Browse files
MrAnnoMathiasVP
authored andcommitted
C++: relax ambiguously-signed-bit-field by allowing GLib's gboolean
The gboolean type of GLib (a widely used C library) is a typedef to int. It is meant to represent a simple true/false value. Resolves #7491
1 parent bfb573c commit 6496bf8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

cpp/ql/src/Likely Bugs/AmbiguouslySignedBitField.ql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ where
2626
// At least for C programs on Windows, BOOL is a common typedef for a type
2727
// representing BoolType.
2828
not bf.getType().hasName("BOOL") and
29+
// GLib's gboolean is a typedef for a type representing BoolType.
30+
not bf.getType().hasName("gboolean") and
2931
// If this is true, then there cannot be unsigned sign extension or overflow.
3032
not bf.getDeclaredNumBits() = bf.getType().getSize() * 8 and
3133
not bf.isAnonymous() and

0 commit comments

Comments
 (0)