Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e49bcd6

Browse filesBrowse files
committed
update test.c for RULE-6-1 to differ from given examples
1 parent 5f30b77 commit e49bcd6
Copy full SHA for e49bcd6

File tree

2 files changed

+12
-14
lines changed
Filter options

2 files changed

+12
-14
lines changed
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
| test.c:8:7:8:8 | b3 | Bit-field b3 is declared on type b3. |
2-
| test.c:11:15:11:16 | b5 | Bit-field b5 is declared on type b5. |
3-
| test.c:13:15:13:16 | b6 | Bit-field b6 is declared on type b6. |
4-
| test.c:14:14:14:15 | b7 | Bit-field b7 is declared on type b7. |
1+
| test.c:6:7:6:8 | x1 | Bit-field x1 is declared on type x1. |
2+
| test.c:10:15:10:16 | x5 | Bit-field x5 is declared on type x5. |
3+
| test.c:11:15:11:16 | x6 | Bit-field x6 is declared on type x6. |
4+
| test.c:12:14:12:15 | x7 | Bit-field x7 is declared on type x7. |

‎c/misra/test/rules/RULE-6-1/test.c

Copy file name to clipboard
+8-10Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
typedef unsigned int UINT_16;
1+
typedef unsigned int UINT16;
22

33
enum Color { R, G, B };
44

55
struct SampleStruct {
6-
unsigned int b1 : 2; // COMPILANT - explicitly unsigned (example in the doc)
7-
signed int b2 : 2; // COMPILANT - explicitly signed
8-
int b3 : 2; // NON_COMPLIANT - plain int not permitted (example in the doc)
9-
UINT_16 b4 : 2; // COMPLIANT - typedef designating unsigned int (example in
10-
// the doc)
11-
signed long b5 : 2; // NON_COMPLIANT - even if long and int are the same size
12-
// (example in the doc)
13-
signed char b6 : 2; // NON_COMPILANT - cannot declare bit field for char
14-
enum Color b7 : 3; // NON_COMPILANT - cannot declare bit field for enum
6+
int x1 : 2; // NON_COMPLIANT - not explicitly signed or unsigned
7+
unsigned int x2 : 2; // COMPILANT - explicitly unsigned (example in the doc)
8+
signed int x3 : 2; // COMPILANT - explicitly signed
9+
UINT16 x4 : 2; // COMPLIANT - type alias resolves to a compliant type
10+
signed long x5 : 2; // NON_COMPLIANT - cannot declare bit field for long, even if it's signed
11+
signed char x6 : 2; // NON_COMPILANT - cannot declare bit field for char, even if it's signed
12+
enum Color x7 : 3; // NON_COMPILANT - cannot declare bit field for enum
1513
} sample_struct;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.