Commit 23b2007 1 parent e34fc46 commit 23b2007 Copy full SHA for 23b2007
File tree 3 files changed +71
-34
lines changed
3 files changed +71
-34
lines changed Original file line number Diff line number Diff line change 15
15
import cpp
16
16
import codingstandards.c.misra
17
17
18
- from
18
+ from AsmStmt asm
19
19
where
20
- not isExcluded ( x , Language1Package:: languageNotEncapsulatedAndIsolatedQuery ( ) ) and
21
- select
20
+ not isExcluded ( asm , Language1Package:: languageNotEncapsulatedAndIsolatedQuery ( ) ) and
21
+ not exists ( asm .getEnclosingFunction ( ) )
22
+ or
23
+ // in concept statements within the body constitute intermingling assembly,
24
+ // rather than expressions and are more general.
25
+ exists ( Stmt sp | sp = asm .getEnclosingFunction ( ) .getEntryPoint ( ) .getASuccessor * ( ) |
26
+ not sp instanceof AsmStmt and not sp instanceof ReturnStmt and not sp instanceof BlockStmt
27
+ )
28
+ select asm , "Usage of non-isolated and non-encapsulated assembly language."
Original file line number Diff line number Diff line change 1
- No expected results have yet been specified
1
+ | test.c:6:3:6:5 | asm statement | Usage of non-isolated and non-encapsulated assembly language. |
2
+ | test.c:11:3:11:5 | asm statement | Usage of non-isolated and non-encapsulated assembly language. |
3
+ | test.c:32:3:32:5 | asm statement | Usage of non-isolated and non-encapsulated assembly language. |
4
+ | test.c:37:3:37:5 | asm statement | Usage of non-isolated and non-encapsulated assembly language. |
5
+ | test.c:58:3:58:5 | asm statement | Usage of non-isolated and non-encapsulated assembly language. |
Original file line number Diff line number Diff line change 1
- #define N1 asm("HCF")
2
- #define N2 __asm__("HCF")
1
+ #define N1 asm("HCF")
2
+ #define N2 __asm__("HCF")
3
3
4
- void f1 (){
5
- int a ;
6
- N1 ; // NON_COMPLIANT
4
+ void f1 () {
5
+ int a ;
6
+ N1 ; // NON_COMPLIANT
7
7
}
8
8
9
- void f2 (){
10
- int a ;
11
- N2 ; // NON_COMPLIANT
9
+ void f2 () {
10
+ int a ;
11
+ N2 ; // NON_COMPLIANT
12
12
}
13
13
14
- void f3 (){
15
- N1 ;
14
+ void f3 () {
15
+ N1 ; // COMPLIANT
16
16
}
17
17
18
- void f4 (){
19
- N2 ;
18
+ void f4 () {
19
+ N2 ; // COMPLIANT
20
20
}
21
21
22
- void f5 (){
23
- __asm__("HCF" );
22
+ void f5 () {
23
+ __asm__("HCF" ); // COMPLIANT
24
24
}
25
25
26
- void f6 (){
27
- asm("HCF" );
26
+ void f6 () {
27
+ asm("HCF" ); // COMPLIANT
28
28
}
29
29
30
- inline void f7 (){
31
- int a ;
32
- N1 ; // NON_COMPLIANT
30
+ inline void f7 () {
31
+ int a ;
32
+ N1 ; // NON_COMPLIANT
33
33
}
34
34
35
- inline void f8 (){
36
- int a ;
37
- N2 ; // NON_COMPLIANT
35
+ inline void f8 () {
36
+ int a ;
37
+ N2 ; // NON_COMPLIANT
38
38
}
39
39
40
- inline void f9 (){
41
- N1 ;
40
+ inline void f9 () {
41
+ N1 ; // COMPLIANT
42
42
}
43
43
44
- inline void f10 (){
45
- N2 ;
44
+ inline void f10 () {
45
+ N2 ; // COMPLIANT
46
46
}
47
47
48
- inline void f11 (){
49
- __asm__("HCF" );
48
+ inline void f11 () {
49
+ __asm__("HCF" ); // COMPLIANT
50
50
}
51
51
52
- inline void f12 (){
53
- asm("HCF" );
52
+ inline void f12 () {
53
+ asm("HCF" ); // COMPLIANT
54
+ }
55
+
56
+ inline int f13 () {
57
+ int a ;
58
+ N2 ; // NON_COMPLIANT
59
+ return 0 ;
60
+ }
61
+
62
+ inline int f14 () {
63
+ N1 ; // COMPLIANT
64
+ return 0 ;
65
+ }
66
+
67
+ inline int f15 () {
68
+ N2 ; // COMPLIANT
69
+ return 0 ;
70
+ }
71
+
72
+ inline int f16 () {
73
+ __asm__("HCF" ); // COMPLIANT
74
+ return 0 ;
75
+ }
76
+
77
+ inline int f17 () {
78
+ asm("HCF" ); // COMPLIANT
79
+ return 0 ;
54
80
}
You can’t perform that action at this time.
0 commit comments