Skip to content

Commit 7796fdd

Browse files
committed
separate out BitfieldTypes
Update rules.csv, move 6-1 and 6-2 from Types.json to new file BitfieldTypes.json
1 parent 77a4c55 commit 7796fdd

File tree

3 files changed

+40
-36
lines changed

3 files changed

+40
-36
lines changed

rule_packages/c/BitfieldTypes.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"MISRA-C-2012": {
3+
"RULE-6-1": {
4+
"properties": {
5+
"obligation": "required"
6+
},
7+
"queries": [
8+
{
9+
"description": "Declaring bit-fields on types other than appropriate ones causes implementation-specific or undefined behavior.",
10+
"kind": "problem",
11+
"name": "Bit-fields shall only be declared with an appropriate type",
12+
"precision": "very-high",
13+
"severity": "error",
14+
"short_name": "BitFieldsShallOnlyBeDeclaredWithAnAppropriateType",
15+
"tags": []
16+
}
17+
],
18+
"title": "Bit-fields shall only be declared with an appropriate type"
19+
},
20+
"RULE-6-2": {
21+
"properties": {
22+
"obligation": "required"
23+
},
24+
"queries": [
25+
{
26+
"description": "Single-bit named bit fields carry no useful information and therefore should not be declared or used.",
27+
"kind": "problem",
28+
"name": "Single-bit named bit fields shall not be of a signed type",
29+
"precision": "very-high",
30+
"severity": "error",
31+
"short_name": "SingleBitNamedBitFieldsOfASignedType",
32+
"tags": []
33+
}
34+
],
35+
"title": "Single-bit named bit fields shall not be of a signed type"
36+
}
37+
}
38+
}

rule_packages/c/Types.json

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -461,40 +461,6 @@
461461
],
462462
"title": "The pointer arguments to the Standard Library function memcmp shall point to either a pointer type, an essentially signed type, an essentially unsigned type, an essentially Boolean type or an essentially enum type."
463463
},
464-
"RULE-6-1": {
465-
"properties": {
466-
"obligation": "required"
467-
},
468-
"queries": [
469-
{
470-
"description": "Declaring bit-fields on types other than appropriate ones causes implementation-specific or undefined behavior.",
471-
"kind": "problem",
472-
"name": "Bit-fields shall only be declared with an appropriate type",
473-
"precision": "very-high",
474-
"severity": "error",
475-
"short_name": "BitFieldsShallOnlyBeDeclaredWithAnAppropriateType",
476-
"tags": []
477-
}
478-
],
479-
"title": "Bit-fields shall only be declared with an appropriate type"
480-
},
481-
"RULE-6-2": {
482-
"properties": {
483-
"obligation": "required"
484-
},
485-
"queries": [
486-
{
487-
"description": "Single-bit named bit fields carry no useful information and therefore should not be declared or used.",
488-
"kind": "problem",
489-
"name": "Single-bit named bit fields shall not be of a signed type",
490-
"precision": "very-high",
491-
"severity": "error",
492-
"short_name": "SingleBitNamedBitFieldsOfASignedType",
493-
"tags": []
494-
}
495-
],
496-
"title": "Single-bit named bit fields shall not be of a signed type"
497-
},
498464
"RULE-7-4": {
499465
"properties": {
500466
"obligation": "required"

rules.csv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,8 +640,8 @@ c,MISRA-C-2012,RULE-5-6,Yes,Required,,,A typedef name shall be a unique identifi
640640
c,MISRA-C-2012,RULE-5-7,Yes,Required,,,A tag name shall be a unique identifier,,Declarations3,Easy,
641641
c,MISRA-C-2012,RULE-5-8,Yes,Required,,,Identifiers that define objects or functions with external linkage shall be unique,,Declarations6,Easy,
642642
c,MISRA-C-2012,RULE-5-9,Yes,Advisory,,,Identifiers that define objects or functions with internal linkage should be unique,,Declarations6,Easy,
643-
c,MISRA-C-2012,RULE-6-1,Yes,Required,,,Bit-fields shall only be declared with an appropriate type,M9-6-4,Types,Medium,
644-
c,MISRA-C-2012,RULE-6-2,Yes,Required,,,Single-bit named bit fields shall not be of a signed type,M9-6-4,Types,Import,
643+
c,MISRA-C-2012,RULE-6-1,Yes,Required,,,Bit-fields shall only be declared with an appropriate type,M9-6-4,BitfieldTypes,Medium,
644+
c,MISRA-C-2012,RULE-6-2,Yes,Required,,,Single-bit named bit fields shall not be of a signed type,M9-6-4,BitfieldTypes,Import,
645645
c,MISRA-C-2012,RULE-7-1,Yes,Required,,,Octal constants shall not be used,M2-13-2,Banned,Import,
646646
c,MISRA-C-2012,RULE-7-2,Yes,Required,,,A �u� or �U� suffix shall be applied to all integer constants that are represented in an unsigned type,M2-13-3,Syntax,Easy,
647647
c,MISRA-C-2012,RULE-7-3,Yes,Required,,,The lowercase character �l� shall not be used in a literal suffix,M2-13-4,Syntax,Easy,

0 commit comments

Comments
 (0)