Skip to content

Commit 831cf03

Browse files
committed
format qldoc comment (indentation)
1 parent c079a14 commit 831cf03

File tree

2 files changed

+35
-31
lines changed

2 files changed

+35
-31
lines changed
Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/**
2-
* @id c/misra/bit-fields-shall-only-be-declared-with-an-appropriate-type
3-
* @name RULE-6-1: Bit-fields shall only be declared with an appropriate type
4-
* @description Declaring bit-fields on types other than appropriate ones causes
5-
* implementation-specific or undefined behavior.
6-
* @kind problem
7-
* @precision very-high
8-
* @problem.severity error
9-
* @tags external/misra/id/rule-6-1
10-
* external/misra/obligation/required
11-
*/
2+
* @id c/misra/bit-fields-shall-only-be-declared-with-an-appropriate-type
3+
* @name RULE-6-1: Bit-fields shall only be declared with an appropriate type
4+
* @description Declaring bit-fields on types other than appropriate ones causes
5+
* implementation-specific or undefined behavior.
6+
* @kind problem
7+
* @precision very-high
8+
* @problem.severity error
9+
* @tags external/misra/id/rule-6-1
10+
* external/misra/obligation/required
11+
*/
1212

1313
import cpp
1414
import codingstandards.c.misra
@@ -17,20 +17,20 @@ predicate isAppropriatePrimitive(Type type) {
1717
/* An appropriate primitive types to which a bit-field can be declared. */
1818
type instanceof IntType and
1919
(
20-
type.(IntegralType).isExplicitlySigned() or
21-
type.(IntegralType).isExplicitlyUnsigned()
22-
)
20+
type.(IntegralType).isExplicitlySigned() or
21+
type.(IntegralType).isExplicitlyUnsigned()
22+
)
2323
or
2424
type instanceof BoolType
2525
}
2626

2727
from BitField bitField
2828
where
29-
not isExcluded(bitField,
30-
BitfieldTypesPackage::bitFieldsShallOnlyBeDeclaredWithAnAppropriateTypeQuery()) and
29+
not isExcluded(bitField,
30+
BitfieldTypesPackage::bitFieldsShallOnlyBeDeclaredWithAnAppropriateTypeQuery()) and
3131
/* A violation would neither an appropriate primitive type nor an appropriate typedef. */
32-
not (
33-
isAppropriatePrimitive(bitField.getType()) or
34-
isAppropriatePrimitive(bitField.getType().resolveTypedefs())
35-
)
32+
not (
33+
isAppropriatePrimitive(bitField.getType()) or
34+
isAppropriatePrimitive(bitField.getType().resolveTypedefs())
35+
)
3636
select bitField, "Bit-field " + bitField + " is declared on type " + bitField.getType() + "."

c/misra/src/rules/RULE-6-2/SingleBitNamedBitFieldsOfASignedType.ql

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,22 @@
1313
import cpp
1414
import codingstandards.c.misra
1515

16-
/* Check if the DECLARED bit-fields is a single bit, because Rule 6.2 also intends to catch confusion on the programmers' part. Consider:
17-
18-
struct S {
19-
int32_t x: 1;
20-
}
21-
22-
In this case, field x is essentially of 32 bits, but is declared as 1 bit and its type int32_t is signed. Therefore, it indicates confusion by the programmer, which is exactly what this rule intends to find. */
16+
/*
17+
* Check if the DECLARED bit-fields is a single bit, because Rule 6.2 also intends to catch confusion on the programmers' part. Consider:
18+
*
19+
* struct S {
20+
* int32_t x: 1;
21+
* }
22+
*
23+
* In this case, field x is essentially of 32 bits, but is declared as 1 bit and its type int32_t is signed. Therefore, it indicates confusion by the programmer, which is exactly what this rule intends to find.
24+
*/
2325

2426
from BitField bitField
2527
where
26-
not isExcluded(bitField, BitfieldTypesPackage::singleBitNamedBitFieldsOfASignedTypeQuery()) and
27-
bitField.getDeclaredNumBits() = 1 and // Single-bit,
28-
not bitField.isAnonymous() and // named,
29-
bitField.getType().(IntegralType).isSigned() // but its type is signed.
30-
select bitField, "Single-bit bit-field named " + bitField.toString() + " has a signed type " + bitField.getType() + "."
28+
not isExcluded(bitField, BitfieldTypesPackage::singleBitNamedBitFieldsOfASignedTypeQuery()) and
29+
bitField.getDeclaredNumBits() = 1 and // Single-bit,
30+
not bitField.isAnonymous() and // named,
31+
bitField.getType().(IntegralType).isSigned() // but its type is signed.
32+
select bitField,
33+
"Single-bit bit-field named " + bitField.toString() + " has a signed type " + bitField.getType() +
34+
"."

0 commit comments

Comments
 (0)