adlint 3.0.10 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. data/ChangeLog +67 -0
  2. data/MANIFEST +2 -0
  3. data/NEWS +10 -3
  4. data/etc/mesg.d/c_builtin/en_US/messages.yml +29 -1
  5. data/etc/mesg.d/c_builtin/ja_JP/messages.yml +29 -1
  6. data/etc/mesg.d/core/en_US/messages.yml +1 -1
  7. data/etc/mesg.d/core/ja_JP/messages.yml +1 -1
  8. data/features/code_check/W0003.feature +5 -0
  9. data/features/code_check/W0023.feature +32 -0
  10. data/features/code_check/W0024.feature +22 -0
  11. data/features/code_check/W0093.feature +71 -0
  12. data/features/code_check/W0097.feature +4 -0
  13. data/features/code_check/W0100.feature +10 -0
  14. data/features/code_check/W0119.feature +8 -0
  15. data/features/code_check/W0133.feature +8 -0
  16. data/features/code_check/W0134.feature +8 -0
  17. data/features/code_check/W0136.feature +8 -0
  18. data/features/code_check/W0138.feature +8 -0
  19. data/features/code_check/W0140.feature +8 -0
  20. data/features/code_check/W0142.feature +8 -0
  21. data/features/code_check/W0143.feature +8 -0
  22. data/features/code_check/W0144.feature +8 -0
  23. data/features/code_check/W0145.feature +8 -0
  24. data/features/code_check/W0146.feature +8 -0
  25. data/features/code_check/W0147.feature +8 -0
  26. data/features/code_check/W0148.feature +8 -0
  27. data/features/code_check/W0149.feature +8 -0
  28. data/features/code_check/W0150.feature +8 -0
  29. data/features/code_check/W0151.feature +8 -0
  30. data/features/code_check/W0152.feature +8 -0
  31. data/features/code_check/W0153.feature +8 -0
  32. data/features/code_check/W0154.feature +8 -0
  33. data/features/code_check/W0155.feature +8 -0
  34. data/features/code_check/W0156.feature +8 -0
  35. data/features/code_check/W0157.feature +8 -0
  36. data/features/code_check/W0158.feature +8 -0
  37. data/features/code_check/W0159.feature +8 -0
  38. data/features/code_check/W0160.feature +8 -0
  39. data/features/code_check/W0161.feature +8 -0
  40. data/features/code_check/W0162.feature +8 -0
  41. data/features/code_check/W0163.feature +8 -0
  42. data/features/code_check/W0164.feature +8 -0
  43. data/features/code_check/W0165.feature +8 -0
  44. data/features/code_check/W0166.feature +8 -0
  45. data/features/code_check/W0167.feature +8 -0
  46. data/features/code_check/W0168.feature +8 -0
  47. data/features/code_check/W0169.feature +8 -0
  48. data/features/code_check/W0170.feature +8 -0
  49. data/features/code_check/W0171.feature +8 -0
  50. data/features/code_check/W0172.feature +8 -0
  51. data/features/code_check/W0173.feature +8 -0
  52. data/features/code_check/W0174.feature +8 -0
  53. data/features/code_check/W0175.feature +8 -0
  54. data/features/code_check/W0176.feature +8 -0
  55. data/features/code_check/W0177.feature +8 -0
  56. data/features/code_check/W0178.feature +8 -0
  57. data/features/code_check/W0179.feature +8 -0
  58. data/features/code_check/W0180.feature +8 -0
  59. data/features/code_check/W0181.feature +8 -0
  60. data/features/code_check/W0250.feature +8 -0
  61. data/features/code_check/W0422.feature +194 -0
  62. data/features/code_check/W0459.feature +16 -0
  63. data/features/code_check/W0460.feature +342 -0
  64. data/features/code_check/W0461.feature +5 -0
  65. data/features/code_check/W0497.feature +12 -0
  66. data/features/code_check/W0499.feature +6 -0
  67. data/features/code_check/W0502.feature +6 -0
  68. data/features/code_check/W0570.feature +47 -0
  69. data/features/code_check/W0573.feature +8 -0
  70. data/features/code_check/W0582.feature +4 -0
  71. data/features/code_check/W0583.feature +4 -0
  72. data/features/code_check/W0584.feature +10 -0
  73. data/features/code_check/W0599.feature +10 -0
  74. data/features/code_check/W0644.feature +2 -0
  75. data/features/code_check/W0649.feature +14 -0
  76. data/features/code_check/W0650.feature +12 -0
  77. data/features/code_check/W0685.feature +10 -0
  78. data/features/code_check/W0686.feature +8 -0
  79. data/features/code_check/W0711.feature +2 -0
  80. data/features/code_check/W0712.feature +2 -0
  81. data/features/code_check/W0713.feature +2 -0
  82. data/features/code_check/W0714.feature +2 -0
  83. data/features/code_check/W0715.feature +2 -0
  84. data/features/code_check/W0718.feature +2 -0
  85. data/features/code_check/W0719.feature +8 -0
  86. data/features/code_check/W0732.feature +18 -0
  87. data/features/code_check/W0733.feature +18 -0
  88. data/features/code_check/W0734.feature +24 -0
  89. data/features/code_check/W0735.feature +24 -0
  90. data/features/code_check/W0747.feature +8 -0
  91. data/features/code_check/W0749.feature +8 -0
  92. data/features/code_check/W0750.feature +8 -0
  93. data/features/code_check/W0753.feature +8 -0
  94. data/features/code_check/W0754.feature +8 -0
  95. data/features/code_check/W0759.feature +8 -0
  96. data/features/code_check/W0760.feature +8 -0
  97. data/features/code_check/W0761.feature +8 -0
  98. data/features/code_check/W0762.feature +8 -0
  99. data/features/code_check/W0794.feature +6 -0
  100. data/features/code_check/W1050.feature +8 -0
  101. data/features/code_check/W1066.feature +8 -0
  102. data/features/code_check/W1067.feature +8 -0
  103. data/features/code_check/W1068.feature +8 -0
  104. data/features/code_check/W1071.feature +4 -0
  105. data/features/code_check/W9003.feature +2 -0
  106. data/lib/adlint/cc1.rb +1 -0
  107. data/lib/adlint/cc1/branch.rb +34 -13
  108. data/lib/adlint/cc1/conv.rb +3 -3
  109. data/lib/adlint/cc1/ctrlexpr.rb +12 -7
  110. data/lib/adlint/cc1/environ.rb +12 -2
  111. data/lib/adlint/cc1/expr.rb +10 -8
  112. data/lib/adlint/cc1/interp.rb +56 -49
  113. data/lib/adlint/cc1/mediator.rb +9 -5
  114. data/lib/adlint/cc1/object.rb +37 -34
  115. data/lib/adlint/cc1/trace.rb +287 -0
  116. data/lib/adlint/cc1/type.rb +15 -15
  117. data/lib/adlint/cc1/value.rb +823 -427
  118. data/lib/adlint/cpp/eval.rb +5 -2
  119. data/lib/adlint/cpp/source.rb +21 -22
  120. data/lib/adlint/exam/c_builtin/cc1_check.rb +1636 -1067
  121. data/lib/adlint/exam/c_builtin/cc1_check_shima.rb +28 -22
  122. data/lib/adlint/exam/c_builtin/cc1_code.rb +4 -4
  123. data/lib/adlint/exam/c_builtin/cc1_metric.rb +14 -14
  124. data/lib/adlint/location.rb +5 -7
  125. data/lib/adlint/metric.rb +2 -2
  126. data/lib/adlint/prelude.rb +6 -2
  127. data/lib/adlint/report.rb +2 -2
  128. data/lib/adlint/version.rb +3 -3
  129. data/share/doc/developers_guide_ja.html +10 -4
  130. data/share/doc/developers_guide_ja.texi +8 -2
  131. data/share/doc/users_guide_en.html +679 -72
  132. data/share/doc/users_guide_en.texi +557 -12
  133. data/share/doc/users_guide_ja.html +678 -74
  134. data/share/doc/users_guide_ja.texi +554 -13
  135. data/spec/adlint/cc1/ctrlexpr_spec.rb +20 -11
  136. data/spec/adlint/cc1/domain_spec.rb +9 -0
  137. metadata +4 -2
data/ChangeLog CHANGED
@@ -1,3 +1,70 @@
1
+ Wed Aug 28 10:51:30 2013 Yutaka Yanoh <yanoh@users.sourceforge.net>
2
+
3
+ * release.ga : 3.2.0
4
+ - Support experimental context-tracing feature so that the warning
5
+ message can be complemented with the context messages.
6
+
7
+ Tue Aug 27 19:35:30 2013 Yutaka Yanoh <yanoh@users.sourceforge.net>
8
+
9
+ * share/doc/users_guide_ja.texi : Add descriptions about newly added
10
+ context-messages supporting context-tracing.
11
+ * share/doc/users_guide_en.texi : Ditto.
12
+
13
+ Mon Aug 26 11:44:55 2013 Yutaka Yanoh <yanoh@users.sourceforge.net>
14
+
15
+ * release.rc : 3.1.0
16
+ - Support experimental context-tracing feature so that the warning
17
+ message can be complemented with the context messages.
18
+
19
+ Fri Aug 23 15:55:53 2013 Yutaka Yanoh <yanoh@users.sourceforge.net>
20
+
21
+ * lib/adlint/cc1/value.rb : Fix value version management degraded
22
+ during supporting context-tracing.
23
+
24
+ * features/code_check/W0460.feature : Add scenario to reproduce
25
+ false-positive of W0460 code check.
26
+
27
+ Thu Aug 22 14:17:54 2013 Yutaka Yanoh <yanoh@users.sourceforge.net>
28
+
29
+ * lib/adlint/cc1/interp.rb : Fix bad context-tracing during or after
30
+ evaluation of an iteration statement.
31
+ * lib/adlint/cc1/object.rb : Ditto.
32
+ * lib/adlint/cc1/value.rb : Ditto.
33
+
34
+ * lib/adlint/cc1/trace.rb : Revise context-tracing interface in order
35
+ not to output context messages about futural controlling-expressions.
36
+ * lib/adlint/exam/c_builtin/cc1_check.rb : Ditto.
37
+
38
+ Wed Aug 7 15:01:04 2013 Yutaka Yanoh <yanoh@users.sourceforge.net>
39
+
40
+ * lib/adlint/exam/c_builtin/cc1_check.rb : Fix bad W0570 code check
41
+ degraded during supporting context-tracing.
42
+
43
+ * features/code_check/W0570.feature : Add scenario to reproduce a known
44
+ bug.
45
+
46
+ Wed Aug 7 13:40:55 2013 Yutaka Yanoh <yanoh@users.sourceforge.net>
47
+
48
+ * lib/adlint/cc1/trace.rb : Fix bad context message emission of
49
+ undefinable variables.
50
+
51
+ * features/code_check/W0460.feature : Add scenario to reproduce bad
52
+ context message problem.
53
+
54
+ Wed Aug 7 10:28:42 2013 Yutaka Yanoh <yanoh@users.sourceforge.net>
55
+
56
+ * lib/adlint/**/* : Support context-tracing to improve readability of
57
+ warning messages.
58
+ * lib/adlint/cc1/trace.rb : Add new context tracing module.
59
+
60
+ * features/code_check/* : Add scenarios for testing context-tracing.
61
+
62
+ Wed Jul 10 15:14:43 2013 Yutaka Yanoh <yanoh@users.sourceforge.net>
63
+
64
+ * lib/adlint/cc1/value.rb : Refactor relationships between VersionGroup
65
+ object and its Version object in order to exactly represent a design
66
+ of the value version management.
67
+
1
68
  Fri Jun 28 10:23:30 2013 Yutaka Yanoh <yanoh@users.sourceforge.net>
2
69
 
3
70
  * release.ga : 3.0.10
data/MANIFEST CHANGED
@@ -222,6 +222,7 @@ features/code_check/W0501.feature
222
222
  features/code_check/W0502.feature
223
223
  features/code_check/W0534.feature
224
224
  features/code_check/W0542.feature
225
+ features/code_check/W0570.feature
225
226
  features/code_check/W0573.feature
226
227
  features/code_check/W0580.feature
227
228
  features/code_check/W0582.feature
@@ -386,6 +387,7 @@ lib/adlint/cc1/scanner.rb
386
387
  lib/adlint/cc1/scope.rb
387
388
  lib/adlint/cc1/seqp.rb
388
389
  lib/adlint/cc1/syntax.rb
390
+ lib/adlint/cc1/trace.rb
389
391
  lib/adlint/cc1/type.rb
390
392
  lib/adlint/cc1/util.rb
391
393
  lib/adlint/cc1/value.rb
data/NEWS CHANGED
@@ -21,6 +21,16 @@
21
21
 
22
22
  ++
23
23
 
24
+ === \AdLint 3.2.0 is released (2013-08-28)
25
+
26
+ ==== Changes since the 3.0.10 release
27
+
28
+ * Support experimental context-tracing feature so that the warning message can
29
+ be complemented with the context messages
30
+
31
+ See the file {ChangeLog}[https://github.com/yanoh/adlint/blob/master/ChangeLog]
32
+ for more details.
33
+
24
34
  === \AdLint 3.0.10 is released (2013-06-28)
25
35
 
26
36
  ==== Changes since the 3.0.8 release
@@ -43,9 +53,6 @@
43
53
  * Fix bypassing inner-variable's value mutation in order to correctly propagate
44
54
  mutation to the outer-variable
45
55
 
46
- See the file {ChangeLog}[https://github.com/yanoh/adlint/blob/master/ChangeLog]
47
- for more details.
48
-
49
56
  === \AdLint 3.0.8 is released (2013-05-31)
50
57
 
51
58
  ==== Changes since the 3.0.4 release
@@ -49,7 +49,7 @@
49
49
  # - "ERR:X99"
50
50
  # format: "Your custom message for the error of E9999."
51
51
 
52
- version: "3.0.10"
52
+ version: "3.2.0"
53
53
 
54
54
  message_definition:
55
55
  W0001:
@@ -2996,3 +2996,31 @@ message_definition:
2996
2996
  classes:
2997
2997
  - "INF:X99"
2998
2998
  format: "A warning is detected as a pair of this identifier `%s'."
2999
+ C1000:
3000
+ classes:
3001
+ - "INF:X99"
3002
+ format: "Warning above is detected in the following context."
3003
+ C1001:
3004
+ classes:
3005
+ - "INF:X99"
3006
+ format: "This controlling-expression is evaluated to be true."
3007
+ C1002:
3008
+ classes:
3009
+ - "INF:X99"
3010
+ format: "This controlling-expression is evaluated to be false."
3011
+ C1003:
3012
+ classes:
3013
+ - "INF:X99"
3014
+ format: "The problematic variable is defined here without initializer."
3015
+ C1004:
3016
+ classes:
3017
+ - "INF:X99"
3018
+ format: "NULL value is assigned to the the problematic variable."
3019
+ C1005:
3020
+ classes:
3021
+ - "INF:X99"
3022
+ format: "A value possibly be NULL is assigned to the problematic variable."
3023
+ C1006:
3024
+ classes:
3025
+ - "INF:X99"
3026
+ format: "New value is assigned to the problematic variable."
@@ -49,7 +49,7 @@
49
49
  # - "ERR:X99"
50
50
  # format: "Your custom message for the error of E9999."
51
51
 
52
- version: "3.0.10"
52
+ version: "3.2.0"
53
53
 
54
54
  message_definition:
55
55
  W0001:
@@ -2996,3 +2996,31 @@ message_definition:
2996
2996
  classes:
2997
2997
  - "INF:X99"
2998
2998
  format: "この識別名 `%s' で警告を検知しました。"
2999
+ C1000:
3000
+ classes:
3001
+ - "INF:X99"
3002
+ format: "次の実行パスで警告を検知しました。"
3003
+ C1001:
3004
+ classes:
3005
+ - "INF:X99"
3006
+ format: "この制御式を真として評価しました。"
3007
+ C1002:
3008
+ classes:
3009
+ - "INF:X99"
3010
+ format: "この制御式を偽として評価しました。"
3011
+ C1003:
3012
+ classes:
3013
+ - "INF:X99"
3014
+ format: "ここで該当変数が初期値を指定せずに定義されています。"
3015
+ C1004:
3016
+ classes:
3017
+ - "INF:X99"
3018
+ format: "ここで該当変数に NULL の値を割り当てました。"
3019
+ C1005:
3020
+ classes:
3021
+ - "INF:X99"
3022
+ format: "ここで該当変数に NULL の可能性がある値を割り当てました。"
3023
+ C1006:
3024
+ classes:
3025
+ - "INF:X99"
3026
+ format: "ここで該当変数に値を割り当てました。"
@@ -49,7 +49,7 @@
49
49
  # - "ERR:X99"
50
50
  # format: "Your custom message for the error of E9999."
51
51
 
52
- version: "3.0.10"
52
+ version: "3.2.0"
53
53
 
54
54
  message_definition:
55
55
  X0001:
@@ -49,7 +49,7 @@
49
49
  # - "ERR:X99"
50
50
  # format: "Your custom message for the error of E9999."
51
51
 
52
- version: "3.0.10"
52
+ version: "3.2.0"
53
53
 
54
54
  message_definition:
55
55
  X0001:
@@ -29,6 +29,11 @@ Feature: W0003
29
29
  | mesg | line | column |
30
30
  | W0117 | 1 | 5 |
31
31
  | W0460 | 17 | 12 |
32
+ | C1000 | | |
33
+ | C1003 | 3 | 9 |
34
+ | C1002 | 6 | 5 |
35
+ | C1002 | 9 | 5 |
36
+ | C1002 | 12 | 5 |
32
37
  | W0104 | 1 | 13 |
33
38
  | W0003 | 5 | 5 |
34
39
  | W0628 | 1 | 5 |
@@ -18,6 +18,8 @@ Feature: W0023
18
18
  | W9003 | 3 | 24 |
19
19
  | W0023 | 3 | 22 |
20
20
  | W0424 | 3 | 20 |
21
+ | C1000 | | |
22
+ | C1005 | 1 | 29 |
21
23
  | W9003 | 3 | 22 |
22
24
  | W0628 | 1 | 6 |
23
25
 
@@ -37,6 +39,8 @@ Feature: W0023
37
39
  | W9003 | 3 | 24 |
38
40
  | W0023 | 3 | 22 |
39
41
  | W0424 | 3 | 20 |
42
+ | C1000 | | |
43
+ | C1005 | 1 | 29 |
40
44
  | W9003 | 3 | 22 |
41
45
  | W0628 | 1 | 6 |
42
46
 
@@ -55,7 +59,11 @@ Feature: W0023
55
59
  | W0117 | 1 | 6 |
56
60
  | W0023 | 3 | 22 |
57
61
  | W0424 | 3 | 20 |
62
+ | C1000 | | |
63
+ | C1005 | 1 | 29 |
58
64
  | W0424 | 3 | 24 |
65
+ | C1000 | | |
66
+ | C1005 | 1 | 50 |
59
67
  | W1052 | 3 | 22 |
60
68
  | W9003 | 3 | 22 |
61
69
  | W0628 | 1 | 6 |
@@ -75,8 +83,14 @@ Feature: W0023
75
83
  | W0117 | 1 | 6 |
76
84
  | W0023 | 3 | 22 |
77
85
  | W0093 | 3 | 22 |
86
+ | C1000 | | |
87
+ | C1006 | 1 | 50 |
78
88
  | W0424 | 3 | 20 |
89
+ | C1000 | | |
90
+ | C1005 | 1 | 29 |
79
91
  | W0424 | 3 | 24 |
92
+ | C1000 | | |
93
+ | C1005 | 1 | 50 |
80
94
  | W9003 | 3 | 22 |
81
95
  | W0628 | 1 | 6 |
82
96
 
@@ -96,11 +110,17 @@ Feature: W0023
96
110
  | W0117 | 1 | 6 |
97
111
  | W0023 | 3 | 23 |
98
112
  | W0424 | 3 | 21 |
113
+ | C1000 | | |
114
+ | C1005 | 1 | 29 |
99
115
  | W0424 | 3 | 25 |
116
+ | C1000 | | |
117
+ | C1005 | 1 | 50 |
100
118
  | W1052 | 3 | 23 |
101
119
  | W0023 | 3 | 28 |
102
120
  | W0424 | 3 | 20 |
103
121
  | W0424 | 3 | 30 |
122
+ | C1000 | | |
123
+ | C1005 | 1 | 71 |
104
124
  | W1052 | 3 | 28 |
105
125
  | W9003 | 3 | 28 |
106
126
  | W0628 | 1 | 6 |
@@ -120,7 +140,11 @@ Feature: W0023
120
140
  | W0117 | 1 | 6 |
121
141
  | W0023 | 3 | 22 |
122
142
  | W0424 | 3 | 20 |
143
+ | C1000 | | |
144
+ | C1005 | 1 | 50 |
123
145
  | W0424 | 3 | 24 |
146
+ | C1000 | | |
147
+ | C1005 | 1 | 29 |
124
148
  | W1052 | 3 | 22 |
125
149
  | W9003 | 3 | 28 |
126
150
  | W0024 | 3 | 26 |
@@ -162,8 +186,14 @@ Feature: W0023
162
186
  | mesg | line | column |
163
187
  | W0117 | 1 | 6 |
164
188
  | W0116 | 3 | 22 |
189
+ | C1000 | | |
190
+ | C1006 | 1 | 29 |
165
191
  | W0424 | 3 | 20 |
192
+ | C1000 | | |
193
+ | C1005 | 1 | 29 |
166
194
  | W0424 | 3 | 25 |
195
+ | C1000 | | |
196
+ | C1005 | 1 | 50 |
167
197
  | W9003 | 3 | 22 |
168
198
  | W0628 | 1 | 6 |
169
199
 
@@ -199,5 +229,7 @@ Feature: W0023
199
229
  | W9003 | 4 | 5 |
200
230
  | W0023 | 4 | 7 |
201
231
  | W0424 | 4 | 10 |
232
+ | C1000 | | |
233
+ | C1005 | 1 | 29 |
202
234
  | W9003 | 4 | 5 |
203
235
  | W0628 | 1 | 6 |
@@ -32,6 +32,8 @@ Feature: W0024
32
32
  | W0117 | 1 | 12 |
33
33
  | W0024 | 3 | 12 |
34
34
  | W0424 | 3 | 14 |
35
+ | C1000 | | |
36
+ | C1005 | 1 | 28 |
35
37
  | W0628 | 1 | 12 |
36
38
 
37
39
  Scenario: a pointer variable as lhs of the additive-expression
@@ -49,6 +51,8 @@ Feature: W0024
49
51
  | W9003 | 3 | 16 |
50
52
  | W0024 | 3 | 14 |
51
53
  | W0424 | 3 | 12 |
54
+ | C1000 | | |
55
+ | C1005 | 1 | 35 |
52
56
  | W0628 | 1 | 12 |
53
57
 
54
58
  Scenario: a pointer variable as rhs of the additive-expression
@@ -66,6 +70,8 @@ Feature: W0024
66
70
  | W9003 | 3 | 12 |
67
71
  | W0024 | 3 | 14 |
68
72
  | W0424 | 3 | 16 |
73
+ | C1000 | | |
74
+ | C1005 | 1 | 35 |
69
75
  | W0628 | 1 | 12 |
70
76
 
71
77
  Scenario: a pointer variable as lhs of the additive-expression
@@ -84,6 +90,8 @@ Feature: W0024
84
90
  | W9003 | 3 | 14 |
85
91
  | W0024 | 3 | 12 |
86
92
  | W0424 | 3 | 10 |
93
+ | C1000 | | |
94
+ | C1005 | 1 | 28 |
87
95
  | W0628 | 1 | 12 |
88
96
 
89
97
  Scenario: postfix-decrement-expression with a pointer variable
@@ -100,6 +108,8 @@ Feature: W0024
100
108
  | W0117 | 1 | 12 |
101
109
  | W0024 | 3 | 13 |
102
110
  | W0424 | 3 | 12 |
111
+ | C1000 | | |
112
+ | C1005 | 1 | 28 |
103
113
  | W0628 | 1 | 12 |
104
114
 
105
115
  Scenario: prefix-decrement-expression with a pointer variable
@@ -116,6 +126,8 @@ Feature: W0024
116
126
  | W0117 | 1 | 12 |
117
127
  | W0024 | 3 | 12 |
118
128
  | W0424 | 3 | 14 |
129
+ | C1000 | | |
130
+ | C1005 | 1 | 28 |
119
131
  | W0628 | 1 | 12 |
120
132
 
121
133
  Scenario: a pointer variable as lhs of the additive-expression
@@ -133,6 +145,8 @@ Feature: W0024
133
145
  | W9003 | 3 | 16 |
134
146
  | W0024 | 3 | 14 |
135
147
  | W0424 | 3 | 12 |
148
+ | C1000 | | |
149
+ | C1005 | 1 | 35 |
136
150
  | W0628 | 1 | 12 |
137
151
 
138
152
  Scenario: a pointer variable as rhs of the additive-expression
@@ -150,6 +164,8 @@ Feature: W0024
150
164
  | W9003 | 3 | 12 |
151
165
  | W0024 | 3 | 14 |
152
166
  | W0424 | 3 | 16 |
167
+ | C1000 | | |
168
+ | C1005 | 1 | 35 |
153
169
  | W0628 | 1 | 12 |
154
170
 
155
171
  Scenario: pointer variables are incremented and decremented
@@ -167,6 +183,8 @@ Feature: W0024
167
183
  | W0024 | 3 | 13 |
168
184
  | W0024 | 3 | 19 |
169
185
  | W0424 | 3 | 18 |
186
+ | C1000 | | |
187
+ | C1005 | 1 | 42 |
170
188
  | W0424 | 3 | 13 |
171
189
  | W0424 | 3 | 19 |
172
190
  | W0628 | 1 | 12 |
@@ -206,6 +224,8 @@ Feature: W0024
206
224
  | W9003 | 3 | 16 |
207
225
  | W0023 | 3 | 14 |
208
226
  | W0424 | 3 | 12 |
227
+ | C1000 | | |
228
+ | C1005 | 1 | 35 |
209
229
  | W0628 | 1 | 12 |
210
230
 
211
231
  Scenario: pointer variable minus 2
@@ -223,4 +243,6 @@ Feature: W0024
223
243
  | W9003 | 3 | 16 |
224
244
  | W0023 | 3 | 14 |
225
245
  | W0424 | 3 | 12 |
246
+ | C1000 | | |
247
+ | C1005 | 1 | 35 |
226
248
  | W0628 | 1 | 12 |
@@ -27,7 +27,11 @@ Feature: W0093
27
27
  | mesg | line | column |
28
28
  | W1076 | 1 | 13 |
29
29
  | W0093 | 8 | 23 |
30
+ | C1000 | | |
31
+ | C1006 | 5 | 14 |
30
32
  | W0093 | 11 | 23 |
33
+ | C1000 | | |
34
+ | C1006 | 5 | 14 |
31
35
  | W0629 | 1 | 13 |
32
36
  | W0628 | 1 | 13 |
33
37
 
@@ -56,6 +60,8 @@ Feature: W0093
56
60
  | mesg | line | column |
57
61
  | W1076 | 1 | 13 |
58
62
  | W0093 | 11 | 23 |
63
+ | C1000 | | |
64
+ | C1006 | 5 | 14 |
59
65
  | W0629 | 1 | 13 |
60
66
  | W0628 | 1 | 13 |
61
67
 
@@ -86,3 +92,68 @@ Feature: W0093
86
92
  | W0093 | 8 | 23 |
87
93
  | W0629 | 1 | 13 |
88
94
  | W0628 | 1 | 13 |
95
+
96
+ Scenario: possible zero-devide because of an incomplete if-else-if statement
97
+ Given a target source named "fixture.c" with:
98
+ """
99
+ int foo(int i)
100
+ {
101
+ int j = 0;
102
+
103
+ if (i < 0) { /* false */
104
+ j = -i;
105
+ }
106
+ else if (i > 0) { /* false */
107
+ j = i;
108
+ }
109
+
110
+ return 5 / j; /* W0093 */
111
+ }
112
+ """
113
+ When I successfully run `adlint fixture.c` on noarch
114
+ Then the output should exactly match with:
115
+ | mesg | line | column |
116
+ | W0117 | 1 | 5 |
117
+ | W0093 | 12 | 14 |
118
+ | C1000 | | |
119
+ | C1006 | 3 | 9 |
120
+ | C1002 | 5 | 11 |
121
+ | C1002 | 8 | 16 |
122
+ | W0104 | 1 | 13 |
123
+ | W1069 | 5 | 5 |
124
+ | W0628 | 1 | 5 |
125
+
126
+ Scenario: possible zero-devide because of an incomplete if-else-if statement
127
+ Given a target source named "fixture.c" with:
128
+ """
129
+ int foo(int i)
130
+ {
131
+ int j;
132
+
133
+ if (i < 0) { /* false */
134
+ j = -i;
135
+ }
136
+ else if (i > 0) {
137
+ j = i; /* false */
138
+ }
139
+
140
+ return 5 / j; /* W0093 */
141
+ }
142
+ """
143
+ When I successfully run `adlint fixture.c` on noarch
144
+ Then the output should exactly match with:
145
+ | mesg | line | column |
146
+ | W0117 | 1 | 5 |
147
+ | W0460 | 12 | 14 |
148
+ | C1000 | | |
149
+ | C1003 | 3 | 9 |
150
+ | C1002 | 5 | 11 |
151
+ | C1002 | 8 | 16 |
152
+ | W0093 | 12 | 14 |
153
+ | C1000 | | |
154
+ | C1006 | 3 | 9 |
155
+ | C1002 | 5 | 11 |
156
+ | C1002 | 8 | 16 |
157
+ | W0104 | 1 | 13 |
158
+ | W1069 | 5 | 5 |
159
+ | W0628 | 1 | 5 |