adlint 2.4.6 → 2.4.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (306) hide show
  1. data/ChangeLog +163 -0
  2. data/MANIFEST +12 -0
  3. data/NEWS +20 -4
  4. data/etc/conf.d/x86_64-ubuntu_12.04/cinit-gcc_4.6.3.erb +2 -2
  5. data/etc/mesg.d/c_builtin/en_US/messages.yml +1 -1
  6. data/etc/mesg.d/c_builtin/ja_JP/messages.yml +1 -1
  7. data/etc/mesg.d/core/en_US/messages.yml +1 -1
  8. data/etc/mesg.d/core/ja_JP/messages.yml +1 -1
  9. data/features/code_check/E0013.feature +0 -2
  10. data/features/code_check/W0001.feature +0 -2
  11. data/features/code_check/W0002.feature +0 -2
  12. data/features/code_check/W0003.feature +0 -2
  13. data/features/code_check/W0007.feature +0 -2
  14. data/features/code_check/W0010.feature +1 -3
  15. data/features/code_check/W0013.feature +0 -2
  16. data/features/code_check/W0016.feature +0 -2
  17. data/features/code_check/W0017.feature +0 -2
  18. data/features/code_check/W0025.feature +0 -2
  19. data/features/code_check/W0026.feature +0 -2
  20. data/features/code_check/W0070.feature +0 -2
  21. data/features/code_check/W0071.feature +0 -2
  22. data/features/code_check/W0093.feature +0 -2
  23. data/features/code_check/W0104.feature +0 -2
  24. data/features/code_check/W0109.feature +0 -2
  25. data/features/code_check/W0119.feature +0 -2
  26. data/features/code_check/W0120.feature +0 -2
  27. data/features/code_check/W0121.feature +0 -2
  28. data/features/code_check/W0122.feature +0 -2
  29. data/features/code_check/W0123.feature +0 -2
  30. data/features/code_check/W0124.feature +0 -2
  31. data/features/code_check/W0125.feature +0 -2
  32. data/features/code_check/W0126.feature +0 -2
  33. data/features/code_check/W0127.feature +0 -2
  34. data/features/code_check/W0128.feature +0 -2
  35. data/features/code_check/W0129.feature +0 -2
  36. data/features/code_check/W0130.feature +0 -2
  37. data/features/code_check/W0131.feature +0 -2
  38. data/features/code_check/W0132.feature +0 -2
  39. data/features/code_check/W0133.feature +0 -2
  40. data/features/code_check/W0134.feature +0 -2
  41. data/features/code_check/W0135.feature +0 -2
  42. data/features/code_check/W0136.feature +0 -2
  43. data/features/code_check/W0137.feature +0 -2
  44. data/features/code_check/W0138.feature +0 -2
  45. data/features/code_check/W0139.feature +0 -2
  46. data/features/code_check/W0140.feature +0 -2
  47. data/features/code_check/W0141.feature +0 -2
  48. data/features/code_check/W0142.feature +0 -2
  49. data/features/code_check/W0143.feature +0 -2
  50. data/features/code_check/W0144.feature +0 -2
  51. data/features/code_check/W0145.feature +0 -2
  52. data/features/code_check/W0146.feature +0 -2
  53. data/features/code_check/W0147.feature +0 -2
  54. data/features/code_check/W0148.feature +0 -2
  55. data/features/code_check/W0149.feature +0 -2
  56. data/features/code_check/W0150.feature +0 -2
  57. data/features/code_check/W0151.feature +0 -2
  58. data/features/code_check/W0152.feature +0 -2
  59. data/features/code_check/W0153.feature +0 -2
  60. data/features/code_check/W0154.feature +0 -2
  61. data/features/code_check/W0155.feature +0 -2
  62. data/features/code_check/W0156.feature +0 -2
  63. data/features/code_check/W0157.feature +0 -2
  64. data/features/code_check/W0158.feature +0 -2
  65. data/features/code_check/W0159.feature +0 -2
  66. data/features/code_check/W0160.feature +0 -2
  67. data/features/code_check/W0161.feature +0 -2
  68. data/features/code_check/W0162.feature +0 -2
  69. data/features/code_check/W0163.feature +0 -2
  70. data/features/code_check/W0164.feature +0 -2
  71. data/features/code_check/W0165.feature +0 -2
  72. data/features/code_check/W0166.feature +0 -2
  73. data/features/code_check/W0167.feature +0 -2
  74. data/features/code_check/W0168.feature +0 -2
  75. data/features/code_check/W0169.feature +0 -2
  76. data/features/code_check/W0170.feature +0 -2
  77. data/features/code_check/W0171.feature +0 -2
  78. data/features/code_check/W0172.feature +0 -2
  79. data/features/code_check/W0173.feature +0 -2
  80. data/features/code_check/W0174.feature +0 -2
  81. data/features/code_check/W0175.feature +0 -2
  82. data/features/code_check/W0176.feature +0 -2
  83. data/features/code_check/W0177.feature +0 -2
  84. data/features/code_check/W0178.feature +0 -2
  85. data/features/code_check/W0179.feature +0 -2
  86. data/features/code_check/W0180.feature +0 -2
  87. data/features/code_check/W0181.feature +0 -2
  88. data/features/code_check/W0182.feature +0 -2
  89. data/features/code_check/W0183.feature +0 -2
  90. data/features/code_check/W0184.feature +0 -2
  91. data/features/code_check/W0185.feature +0 -2
  92. data/features/code_check/W0186.feature +0 -2
  93. data/features/code_check/W0187.feature +0 -2
  94. data/features/code_check/W0188.feature +0 -2
  95. data/features/code_check/W0189.feature +0 -2
  96. data/features/code_check/W0190.feature +0 -2
  97. data/features/code_check/W0191.feature +0 -2
  98. data/features/code_check/W0192.feature +0 -2
  99. data/features/code_check/W0193.feature +0 -2
  100. data/features/code_check/W0194.feature +0 -2
  101. data/features/code_check/W0195.feature +0 -2
  102. data/features/code_check/W0196.feature +0 -2
  103. data/features/code_check/W0197.feature +0 -2
  104. data/features/code_check/W0198.feature +0 -2
  105. data/features/code_check/W0199.feature +0 -2
  106. data/features/code_check/W0200.feature +0 -2
  107. data/features/code_check/W0201.feature +0 -2
  108. data/features/code_check/W0202.feature +0 -2
  109. data/features/code_check/W0203.feature +0 -2
  110. data/features/code_check/W0204.feature +0 -2
  111. data/features/code_check/W0205.feature +0 -2
  112. data/features/code_check/W0206.feature +0 -2
  113. data/features/code_check/W0207.feature +0 -2
  114. data/features/code_check/W0208.feature +0 -2
  115. data/features/code_check/W0209.feature +0 -2
  116. data/features/code_check/W0210.feature +0 -2
  117. data/features/code_check/W0211.feature +0 -2
  118. data/features/code_check/W0212.feature +0 -2
  119. data/features/code_check/W0213.feature +0 -2
  120. data/features/code_check/W0214.feature +0 -2
  121. data/features/code_check/W0215.feature +0 -2
  122. data/features/code_check/W0216.feature +0 -2
  123. data/features/code_check/W0217.feature +0 -2
  124. data/features/code_check/W0218.feature +0 -2
  125. data/features/code_check/W0219.feature +0 -2
  126. data/features/code_check/W0220.feature +0 -2
  127. data/features/code_check/W0221.feature +0 -2
  128. data/features/code_check/W0222.feature +0 -2
  129. data/features/code_check/W0223.feature +0 -2
  130. data/features/code_check/W0224.feature +0 -2
  131. data/features/code_check/W0225.feature +0 -2
  132. data/features/code_check/W0226.feature +0 -2
  133. data/features/code_check/W0227.feature +0 -2
  134. data/features/code_check/W0228.feature +0 -2
  135. data/features/code_check/W0229.feature +0 -2
  136. data/features/code_check/W0230.feature +0 -2
  137. data/features/code_check/W0231.feature +0 -2
  138. data/features/code_check/W0232.feature +0 -2
  139. data/features/code_check/W0233.feature +0 -2
  140. data/features/code_check/W0234.feature +0 -2
  141. data/features/code_check/W0235.feature +0 -2
  142. data/features/code_check/W0236.feature +0 -2
  143. data/features/code_check/W0237.feature +0 -2
  144. data/features/code_check/W0238.feature +0 -2
  145. data/features/code_check/W0239.feature +0 -2
  146. data/features/code_check/W0240.feature +0 -2
  147. data/features/code_check/W0241.feature +0 -2
  148. data/features/code_check/W0242.feature +0 -2
  149. data/features/code_check/W0243.feature +0 -2
  150. data/features/code_check/W0244.feature +0 -2
  151. data/features/code_check/W0245.feature +0 -2
  152. data/features/code_check/W0246.feature +0 -2
  153. data/features/code_check/W0247.feature +0 -2
  154. data/features/code_check/W0248.feature +0 -2
  155. data/features/code_check/W0249.feature +0 -2
  156. data/features/code_check/W0250.feature +0 -2
  157. data/features/code_check/W0251.feature +0 -2
  158. data/features/code_check/W0252.feature +0 -2
  159. data/features/code_check/W0253.feature +0 -2
  160. data/features/code_check/W0254.feature +0 -2
  161. data/features/code_check/W0425.feature +0 -2
  162. data/features/code_check/W0431.feature +0 -2
  163. data/features/code_check/W0432.feature +0 -2
  164. data/features/code_check/W0477.feature +0 -2
  165. data/features/code_check/W0478.feature +0 -2
  166. data/features/code_check/W0479.feature +0 -2
  167. data/features/code_check/W0480.feature +0 -2
  168. data/features/code_check/W0481.feature +0 -2
  169. data/features/code_check/W0482.feature +0 -2
  170. data/features/code_check/W0483.feature +0 -2
  171. data/features/code_check/W0488.feature +132 -0
  172. data/features/code_check/W0489.feature +78 -0
  173. data/features/code_check/W0490.feature +83 -0
  174. data/features/code_check/W0495.feature +60 -0
  175. data/features/code_check/W0496.feature +63 -0
  176. data/features/code_check/W0497.feature +65 -0
  177. data/features/code_check/W0498.feature +120 -0
  178. data/features/code_check/W0499.feature +63 -0
  179. data/features/code_check/W0500.feature +66 -0
  180. data/features/code_check/W0501.feature +69 -0
  181. data/features/code_check/W0502.feature +64 -0
  182. data/features/code_check/W0573.feature +0 -2
  183. data/features/code_check/W0583.feature +0 -2
  184. data/features/code_check/W0606.feature +0 -2
  185. data/features/code_check/W0635.feature +0 -2
  186. data/features/code_check/W0641.feature +0 -2
  187. data/features/code_check/W0643.feature +0 -2
  188. data/features/code_check/W0644.feature +0 -2
  189. data/features/code_check/W0645.feature +0 -2
  190. data/features/code_check/W0646.feature +0 -2
  191. data/features/code_check/W0649.feature +0 -2
  192. data/features/code_check/W0650.feature +0 -2
  193. data/features/code_check/W0655.feature +43 -0
  194. data/features/code_check/W0685.feature +0 -2
  195. data/features/code_check/W0686.feature +0 -2
  196. data/features/code_check/W0687.feature +0 -2
  197. data/features/code_check/W0688.feature +0 -2
  198. data/features/code_check/W0689.feature +0 -2
  199. data/features/code_check/W0690.feature +0 -2
  200. data/features/code_check/W0691.feature +0 -2
  201. data/features/code_check/W0692.feature +0 -2
  202. data/features/code_check/W0694.feature +0 -2
  203. data/features/code_check/W0695.feature +0 -2
  204. data/features/code_check/W0697.feature +0 -2
  205. data/features/code_check/W0698.feature +0 -2
  206. data/features/code_check/W0699.feature +0 -2
  207. data/features/code_check/W0700.feature +0 -2
  208. data/features/code_check/W0703.feature +0 -2
  209. data/features/code_check/W0705.feature +6 -2
  210. data/features/code_check/W0707.feature +4 -2
  211. data/features/code_check/W0711.feature +0 -2
  212. data/features/code_check/W0712.feature +0 -2
  213. data/features/code_check/W0713.feature +0 -2
  214. data/features/code_check/W0714.feature +0 -2
  215. data/features/code_check/W0715.feature +0 -2
  216. data/features/code_check/W0716.feature +0 -2
  217. data/features/code_check/W0717.feature +0 -2
  218. data/features/code_check/W0718.feature +0 -2
  219. data/features/code_check/W0719.feature +0 -2
  220. data/features/code_check/W0723.feature +0 -2
  221. data/features/code_check/W0726.feature +0 -2
  222. data/features/code_check/W0732.feature +0 -2
  223. data/features/code_check/W0733.feature +0 -2
  224. data/features/code_check/W0734.feature +0 -2
  225. data/features/code_check/W0735.feature +0 -2
  226. data/features/code_check/W0745.feature +1 -2
  227. data/features/code_check/W0747.feature +0 -2
  228. data/features/code_check/W0748.feature +0 -2
  229. data/features/code_check/W0749.feature +0 -2
  230. data/features/code_check/W0750.feature +0 -2
  231. data/features/code_check/W0751.feature +0 -2
  232. data/features/code_check/W0752.feature +0 -2
  233. data/features/code_check/W0753.feature +0 -2
  234. data/features/code_check/W0754.feature +0 -2
  235. data/features/code_check/W0755.feature +0 -2
  236. data/features/code_check/W0756.feature +0 -2
  237. data/features/code_check/W0757.feature +0 -2
  238. data/features/code_check/W0758.feature +0 -2
  239. data/features/code_check/W0759.feature +0 -2
  240. data/features/code_check/W0760.feature +0 -2
  241. data/features/code_check/W0761.feature +0 -2
  242. data/features/code_check/W0762.feature +0 -2
  243. data/features/code_check/W0763.feature +0 -2
  244. data/features/code_check/W0764.feature +0 -2
  245. data/features/code_check/W0765.feature +0 -2
  246. data/features/code_check/W0766.feature +0 -2
  247. data/features/code_check/W0767.feature +0 -2
  248. data/features/code_check/W0768.feature +0 -2
  249. data/features/code_check/W0769.feature +0 -2
  250. data/features/code_check/W0780.feature +0 -2
  251. data/features/code_check/W0781.feature +0 -2
  252. data/features/code_check/W0783.feature +0 -2
  253. data/features/code_check/W0787.feature +0 -2
  254. data/features/code_check/W0792.feature +0 -2
  255. data/features/code_check/W0793.feature +0 -2
  256. data/features/code_check/W0794.feature +0 -2
  257. data/features/code_check/W0801.feature +0 -2
  258. data/features/code_check/W0805.feature +0 -2
  259. data/features/code_check/W0806.feature +0 -2
  260. data/features/code_check/W0807.feature +0 -2
  261. data/features/code_check/W0808.feature +0 -2
  262. data/features/code_check/W0809.feature +0 -2
  263. data/features/code_check/W0811.feature +0 -2
  264. data/features/code_check/W0830.feature +0 -2
  265. data/features/code_check/W0833.feature +0 -2
  266. data/features/code_check/W0834.feature +1 -3
  267. data/features/code_check/W1026.feature +0 -2
  268. data/features/code_check/W1030.feature +0 -2
  269. data/features/code_check/W1031.feature +0 -2
  270. data/features/code_check/W1039.feature +0 -2
  271. data/features/code_check/W1040.feature +0 -2
  272. data/features/code_check/W1041.feature +0 -2
  273. data/features/code_check/W1046.feature +0 -2
  274. data/features/code_check/W1047.feature +0 -2
  275. data/features/code_check/W1052.feature +0 -2
  276. data/features/code_check/W1066.feature +0 -2
  277. data/features/code_check/W1067.feature +0 -2
  278. data/features/code_check/W1068.feature +0 -2
  279. data/features/code_check/W1069.feature +0 -2
  280. data/features/code_check/W1070.feature +0 -2
  281. data/features/code_check/W1071.feature +0 -2
  282. data/features/code_check/W1072.feature +0 -2
  283. data/features/code_check/W1073.feature +1 -3
  284. data/features/code_check/W1074.feature +3 -4
  285. data/features/code_check/W1075.feature +0 -2
  286. data/features/code_check/W1076.feature +0 -2
  287. data/features/code_check/W1077.feature +0 -2
  288. data/features/code_check/W9001.feature +0 -2
  289. data/features/code_check/W9003.feature +3 -3
  290. data/lib/adlint/c/branch.rb +2 -2
  291. data/lib/adlint/c/environ.rb +3 -3
  292. data/lib/adlint/c/expr.rb +67 -39
  293. data/lib/adlint/c/interp.rb +10 -1
  294. data/lib/adlint/c/object.rb +6 -4
  295. data/lib/adlint/c/parser.rb +1 -1
  296. data/lib/adlint/c/value.rb +27 -10
  297. data/lib/adlint/cpp/constexpr.rb +1 -1
  298. data/lib/adlint/exam/c_builtin/c_check.rb +502 -420
  299. data/lib/adlint/version.rb +2 -2
  300. data/share/doc/developers_guide_ja.html +3 -3
  301. data/share/doc/developers_guide_ja.texi +1 -1
  302. data/share/doc/users_guide_en.html +10 -10
  303. data/share/doc/users_guide_en.texi +8 -8
  304. data/share/doc/users_guide_ja.html +10 -10
  305. data/share/doc/users_guide_ja.texi +8 -8
  306. metadata +15 -3
@@ -150,5 +150,3 @@ Feature: W0241
150
150
  | W0834 | 1 | 1 |
151
151
  | W0834 | 3 | 13 |
152
152
  | W0628 | 1 | 11 |
153
-
154
- # vim:ts=2:sw=2:sts=2:et:
@@ -151,5 +151,3 @@ Feature: W0242
151
151
  | W0834 | 1 | 1 |
152
152
  | W0834 | 3 | 13 |
153
153
  | W0628 | 1 | 20 |
154
-
155
- # vim:ts=2:sw=2:sts=2:et:
@@ -150,5 +150,3 @@ Feature: W0243
150
150
  | W0834 | 1 | 1 |
151
151
  | W0834 | 3 | 13 |
152
152
  | W0628 | 1 | 11 |
153
-
154
- # vim:ts=2:sw=2:sts=2:et:
@@ -151,5 +151,3 @@ Feature: W0244
151
151
  | W0834 | 1 | 1 |
152
152
  | W0834 | 3 | 13 |
153
153
  | W0628 | 1 | 20 |
154
-
155
- # vim:ts=2:sw=2:sts=2:et:
@@ -143,5 +143,3 @@ Feature: W0245
143
143
  | W0117 | 1 | 7 |
144
144
  | W0104 | 1 | 25 |
145
145
  | W0628 | 1 | 7 |
146
-
147
- # vim:ts=2:sw=2:sts=2:et:
@@ -143,5 +143,3 @@ Feature: W0246
143
143
  | W0117 | 1 | 5 |
144
144
  | W0104 | 1 | 23 |
145
145
  | W0628 | 1 | 5 |
146
-
147
- # vim:ts=2:sw=2:sts=2:et:
@@ -143,5 +143,3 @@ Feature: W0247
143
143
  | W0117 | 1 | 6 |
144
144
  | W0104 | 1 | 24 |
145
145
  | W0628 | 1 | 6 |
146
-
147
- # vim:ts=2:sw=2:sts=2:et:
@@ -138,5 +138,3 @@ Feature: W0248
138
138
  | W0117 | 1 | 5 |
139
139
  | W0104 | 1 | 24 |
140
140
  | W0628 | 1 | 5 |
141
-
142
- # vim:ts=2:sw=2:sts=2:et:
@@ -138,5 +138,3 @@ Feature: W0249
138
138
  | W0117 | 1 | 6 |
139
139
  | W0104 | 1 | 25 |
140
140
  | W0628 | 1 | 6 |
141
-
142
- # vim:ts=2:sw=2:sts=2:et:
@@ -142,5 +142,3 @@ Feature: W0250
142
142
  | W1049 | 3 | 12 |
143
143
  | W0104 | 1 | 23 |
144
144
  | W0628 | 1 | 6 |
145
-
146
- # vim:ts=2:sw=2:sts=2:et:
@@ -155,5 +155,3 @@ Feature: W0251
155
155
  | W0834 | 1 | 1 |
156
156
  | W0834 | 3 | 13 |
157
157
  | W0628 | 1 | 11 |
158
-
159
- # vim:ts=2:sw=2:sts=2:et:
@@ -151,5 +151,3 @@ Feature: W0252
151
151
  | W0834 | 1 | 1 |
152
152
  | W0834 | 3 | 13 |
153
153
  | W0628 | 1 | 11 |
154
-
155
- # vim:ts=2:sw=2:sts=2:et:
@@ -150,5 +150,3 @@ Feature: W0253
150
150
  | W0834 | 1 | 1 |
151
151
  | W0834 | 3 | 13 |
152
152
  | W0628 | 1 | 11 |
153
-
154
- # vim:ts=2:sw=2:sts=2:et:
@@ -150,5 +150,3 @@ Feature: W0254
150
150
  | W0834 | 1 | 1 |
151
151
  | W0834 | 3 | 13 |
152
152
  | W0628 | 1 | 11 |
153
-
154
- # vim:ts=2:sw=2:sts=2:et:
@@ -275,5 +275,3 @@ Feature: W0425
275
275
  | W0425 | 2 | 24 |
276
276
  | W0425 | 3 | 26 |
277
277
  | W0425 | 4 | 25 |
278
-
279
- # vim:ts=2:sw=2:sts=2:et:
@@ -37,5 +37,3 @@ Feature: W0431
37
37
  | W0443 | 3 | 1 |
38
38
  | W0443 | 4 | 1 |
39
39
  | W0628 | 8 | 6 |
40
-
41
- # vim:ts=2:sw=2:sts=2:et:
@@ -37,5 +37,3 @@ Feature: W0432
37
37
  | W0443 | 3 | 1 |
38
38
  | W0443 | 4 | 1 |
39
39
  | W0628 | 8 | 6 |
40
-
41
- # vim:ts=2:sw=2:sts=2:et:
@@ -73,5 +73,3 @@ Feature: W0477
73
73
  Then the output should exactly match with:
74
74
  | mesg | line | column |
75
75
  | W0480 | 1 | 1 |
76
-
77
- # vim:ts=2:sw=2:sts=2:et:
@@ -99,5 +99,3 @@ Feature: W0478
99
99
  | mesg | line | column |
100
100
  | W0442 | 1 | 1 |
101
101
  | W0549 | 1 | 38 |
102
-
103
- # vim:ts=2:sw=2:sts=2:et:
@@ -61,5 +61,3 @@ Feature: W0479
61
61
  Then the output should exactly match with:
62
62
  | mesg | line | column |
63
63
  | W0483 | 1 | 1 |
64
-
65
- # vim:ts=2:sw=2:sts=2:et:
@@ -115,5 +115,3 @@ Feature: W0480
115
115
  | mesg | line | column |
116
116
  | W0442 | 1 | 1 |
117
117
  | W0478 | 1 | 1 |
118
-
119
- # vim:ts=2:sw=2:sts=2:et:
@@ -24,5 +24,3 @@ Feature: W0481
24
24
  Then the output should exactly match with:
25
25
  | mesg | line | column |
26
26
  | W0442 | 1 | 1 |
27
-
28
- # vim:ts=2:sw=2:sts=2:et:
@@ -60,5 +60,3 @@ Feature: W0482
60
60
  Then the output should exactly match with:
61
61
  | mesg | line | column |
62
62
  | W0479 | 1 | 1 |
63
-
64
- # vim:ts=2:sw=2:sts=2:et:
@@ -58,5 +58,3 @@ Feature: W0483
58
58
  Then the output should exactly match with:
59
59
  | mesg | line | column |
60
60
  | W0479 | 1 | 1 |
61
-
62
- # vim:ts=2:sw=2:sts=2:et:
@@ -0,0 +1,132 @@
1
+ Feature: W0488
2
+
3
+ W0488 detects that multiple function-call-expressions or
4
+ member-access-expressions or array-subscript-expressions appear in a
5
+ logical-and-expression or a logical-or-expression without appropriate
6
+ grouping.
7
+
8
+ Scenario: member-access-expression and array-subscript-expression and
9
+ function-call-expression as an operand of logical-and-expression
10
+ Given a target source named "fixture.c" with:
11
+ """
12
+ struct foo { int (*a[3])(void); };
13
+
14
+ static void foo(struct foo *p)
15
+ {
16
+ if (p) {
17
+ if (p->a[0]() && p->a[1]()) { /* W0488 */
18
+ return;
19
+ }
20
+ }
21
+ }
22
+ """
23
+ When I successfully run `adlint fixture.c` on noarch
24
+ Then the output should exactly match with:
25
+ | mesg | line | column |
26
+ | W1076 | 3 | 13 |
27
+ | W0104 | 3 | 29 |
28
+ | W0105 | 3 | 29 |
29
+ | W1071 | 3 | 13 |
30
+ | W0629 | 3 | 13 |
31
+ | W0488 | 6 | 13 |
32
+ | W0508 | 6 | 23 |
33
+ | W0114 | 5 | 5 |
34
+ | W0628 | 3 | 13 |
35
+
36
+ Scenario: member-access-expression and array-subscript-expression and
37
+ function-call-expression as an operand of logical-and-expression
38
+ with grouping
39
+ Given a target source named "fixture.c" with:
40
+ """
41
+ struct foo { int (*a[3])(void); };
42
+
43
+ static void foo(struct foo *p)
44
+ {
45
+ if (p) {
46
+ if (((p->a[0])()) && ((p->a[1])())) { /* OK */
47
+ return;
48
+ }
49
+ }
50
+ }
51
+ """
52
+ When I successfully run `adlint fixture.c` on noarch
53
+ Then the output should exactly match with:
54
+ | mesg | line | column |
55
+ | W1076 | 3 | 13 |
56
+ | W0104 | 3 | 29 |
57
+ | W0105 | 3 | 29 |
58
+ | W1071 | 3 | 13 |
59
+ | W0629 | 3 | 13 |
60
+ | W0508 | 6 | 27 |
61
+ | W0114 | 5 | 5 |
62
+ | W0628 | 3 | 13 |
63
+
64
+ Scenario: member-access-expression and array-subscript-expression and
65
+ function-call-expression as an operand of logical-and-expression
66
+ grouped entirely
67
+ Given a target source named "fixture.c" with:
68
+ """
69
+ struct foo { int (*a[3])(void); };
70
+
71
+ static void foo(struct foo *p)
72
+ {
73
+ if (p) {
74
+ if ((p->a[0]() && p->a[1]())) { /* W0488 */
75
+ return;
76
+ }
77
+ }
78
+ }
79
+ """
80
+ When I successfully run `adlint fixture.c` on noarch
81
+ Then the output should exactly match with:
82
+ | mesg | line | column |
83
+ | W1076 | 3 | 13 |
84
+ | W0104 | 3 | 29 |
85
+ | W0105 | 3 | 29 |
86
+ | W1071 | 3 | 13 |
87
+ | W0629 | 3 | 13 |
88
+ | W0488 | 6 | 13 |
89
+ | W0508 | 6 | 24 |
90
+ | W0114 | 5 | 5 |
91
+ | W0628 | 3 | 13 |
92
+
93
+ Scenario: ungrouped array-subscript-expression in a logical-and-expression
94
+ Given a target source named "fixture.c" with:
95
+ """
96
+ static void foo(int i, int a[])
97
+ {
98
+ if (i && a[0]) { /* W0488 */
99
+ return;
100
+ }
101
+ }
102
+ """
103
+ When I successfully run `adlint fixture.c` on noarch
104
+ Then the output should exactly match with:
105
+ | mesg | line | column |
106
+ | W1076 | 1 | 13 |
107
+ | W0104 | 1 | 21 |
108
+ | W0104 | 1 | 28 |
109
+ | W1071 | 1 | 13 |
110
+ | W0629 | 1 | 13 |
111
+ | W0488 | 3 | 9 |
112
+ | W0628 | 1 | 13 |
113
+
114
+ Scenario: grouped array-subscript-expression in a logical-and-expression
115
+ Given a target source named "fixture.c" with:
116
+ """
117
+ static void foo(int i, int a[])
118
+ {
119
+ if (i && (a[0])) { /* OK */
120
+ return;
121
+ }
122
+ }
123
+ """
124
+ When I successfully run `adlint fixture.c` on noarch
125
+ Then the output should exactly match with:
126
+ | mesg | line | column |
127
+ | W1076 | 1 | 13 |
128
+ | W0104 | 1 | 21 |
129
+ | W0104 | 1 | 28 |
130
+ | W1071 | 1 | 13 |
131
+ | W0629 | 1 | 13 |
132
+ | W0628 | 1 | 13 |
@@ -0,0 +1,78 @@
1
+ Feature: W0489
2
+
3
+ W0489 detects that multiple unary-expressions appear as an operand of a
4
+ logical-and-expression or a logical-or-expression without appropriate
5
+ grouping.
6
+
7
+ Scenario: unary-expressions appear as an operand of a logical-and-expression
8
+ Given a target source named "fixture.c" with:
9
+ """
10
+ static void foo(int i, int *p)
11
+ {
12
+ if (p) {
13
+ if (-i++ && !*p) { /* W0489 */
14
+ return;
15
+ }
16
+ }
17
+ }
18
+ """
19
+ When I successfully run `adlint fixture.c` on noarch
20
+ Then the output should exactly match with:
21
+ | mesg | line | column |
22
+ | W1076 | 1 | 13 |
23
+ | W0104 | 1 | 29 |
24
+ | W0105 | 1 | 29 |
25
+ | W1071 | 1 | 13 |
26
+ | W0629 | 1 | 13 |
27
+ | W0489 | 4 | 13 |
28
+ | W0114 | 3 | 5 |
29
+ | W0628 | 1 | 13 |
30
+
31
+ Scenario: unary-expressions appear as an operand of a logical-and-expression
32
+ with grouping
33
+ Given a target source named "fixture.c" with:
34
+ """
35
+ static void foo(int i, int *p)
36
+ {
37
+ if (p) {
38
+ if ((-i++) && (!*p)) { /* OK */
39
+ return;
40
+ }
41
+ }
42
+ }
43
+ """
44
+ When I successfully run `adlint fixture.c` on noarch
45
+ Then the output should exactly match with:
46
+ | mesg | line | column |
47
+ | W1076 | 1 | 13 |
48
+ | W0104 | 1 | 29 |
49
+ | W0105 | 1 | 29 |
50
+ | W1071 | 1 | 13 |
51
+ | W0629 | 1 | 13 |
52
+ | W0114 | 3 | 5 |
53
+ | W0628 | 1 | 13 |
54
+
55
+ Scenario: unary-expressions appear as an operand of a logical-and-expression
56
+ grouped entirely
57
+ Given a target source named "fixture.c" with:
58
+ """
59
+ static void foo(int i, int *p)
60
+ {
61
+ if (p) {
62
+ if ((-i++ && !*p)) { /* W0489 */
63
+ return;
64
+ }
65
+ }
66
+ }
67
+ """
68
+ When I successfully run `adlint fixture.c` on noarch
69
+ Then the output should exactly match with:
70
+ | mesg | line | column |
71
+ | W1076 | 1 | 13 |
72
+ | W0104 | 1 | 29 |
73
+ | W0105 | 1 | 29 |
74
+ | W1071 | 1 | 13 |
75
+ | W0629 | 1 | 13 |
76
+ | W0489 | 4 | 13 |
77
+ | W0114 | 3 | 5 |
78
+ | W0628 | 1 | 13 |
@@ -0,0 +1,83 @@
1
+ Feature: W0490
2
+
3
+ W0490 detects that multiple precedence binary-expressions appear as an
4
+ operand of a logical-and-expression or a logical-or-expression without
5
+ appropriate grouping.
6
+
7
+ Scenario: precedence binary-expressions appear as an operand of a
8
+ logical-and-expression
9
+ Given a target source named "fixture.c" with:
10
+ """
11
+ static void foo(int i, int j)
12
+ {
13
+ if (i + j && i * j) { /* W0490 */
14
+ return;
15
+ }
16
+ }
17
+ """
18
+ When I successfully run `adlint fixture.c` on noarch
19
+ Then the output should exactly match with:
20
+ | mesg | line | column |
21
+ | W1076 | 1 | 13 |
22
+ | W0723 | 3 | 11 |
23
+ | W0723 | 3 | 20 |
24
+ | W0104 | 1 | 21 |
25
+ | W0104 | 1 | 28 |
26
+ | W1071 | 1 | 13 |
27
+ | W0629 | 1 | 13 |
28
+ | W0490 | 3 | 9 |
29
+ | W0500 | 3 | 9 |
30
+ | W0502 | 3 | 9 |
31
+ | W0732 | 3 | 15 |
32
+ | W0628 | 1 | 13 |
33
+
34
+ Scenario: precedence binary-expressions appear as an operand of a
35
+ logical-and-expression with grouping
36
+ Given a target source named "fixture.c" with:
37
+ """
38
+ static void foo(int i, int j)
39
+ {
40
+ if ((i + j) && (i * j)) { /* OK */
41
+ return;
42
+ }
43
+ }
44
+ """
45
+ When I successfully run `adlint fixture.c` on noarch
46
+ Then the output should exactly match with:
47
+ | mesg | line | column |
48
+ | W1076 | 1 | 13 |
49
+ | W0723 | 3 | 12 |
50
+ | W0723 | 3 | 23 |
51
+ | W0104 | 1 | 21 |
52
+ | W0104 | 1 | 28 |
53
+ | W1071 | 1 | 13 |
54
+ | W0629 | 1 | 13 |
55
+ | W0732 | 3 | 17 |
56
+ | W0628 | 1 | 13 |
57
+
58
+ Scenario: precedence binary-expressions appear as an operand of a
59
+ logical-and-expression grouped entirely
60
+ Given a target source named "fixture.c" with:
61
+ """
62
+ static void foo(int i, int j)
63
+ {
64
+ if ((i + j && i * j)) { /* W0490 */
65
+ return;
66
+ }
67
+ }
68
+ """
69
+ When I successfully run `adlint fixture.c` on noarch
70
+ Then the output should exactly match with:
71
+ | mesg | line | column |
72
+ | W1076 | 1 | 13 |
73
+ | W0723 | 3 | 12 |
74
+ | W0723 | 3 | 21 |
75
+ | W0104 | 1 | 21 |
76
+ | W0104 | 1 | 28 |
77
+ | W1071 | 1 | 13 |
78
+ | W0629 | 1 | 13 |
79
+ | W0490 | 3 | 9 |
80
+ | W0500 | 3 | 9 |
81
+ | W0502 | 3 | 9 |
82
+ | W0732 | 3 | 16 |
83
+ | W0628 | 1 | 13 |
@@ -0,0 +1,60 @@
1
+ Feature: W0495
2
+
3
+ W0495 detects that different arithmetic operators appear with modulo operator
4
+ in an expression without appropriate grouping.
5
+
6
+ Scenario: without grouping
7
+ Given a target source named "fixture.c" with:
8
+ """
9
+ static int foo(int a, int b)
10
+ {
11
+ return a + b % 5; /* W0495 */
12
+ }
13
+ """
14
+ When I successfully run `adlint fixture.c` on noarch
15
+ Then the output should exactly match with:
16
+ | mesg | line | column |
17
+ | W1076 | 1 | 12 |
18
+ | W0723 | 3 | 14 |
19
+ | W0104 | 1 | 20 |
20
+ | W0104 | 1 | 27 |
21
+ | W0629 | 1 | 12 |
22
+ | W0495 | 3 | 12 |
23
+ | W0628 | 1 | 12 |
24
+
25
+ Scenario: with appropriate grouping
26
+ Given a target source named "fixture.c" with:
27
+ """
28
+ static int foo(int a, int b)
29
+ {
30
+ return (a + b) % 5; /* OK */
31
+ }
32
+ """
33
+ When I successfully run `adlint fixture.c` on noarch
34
+ Then the output should exactly match with:
35
+ | mesg | line | column |
36
+ | W1076 | 1 | 12 |
37
+ | W0723 | 3 | 15 |
38
+ | W0104 | 1 | 20 |
39
+ | W0104 | 1 | 27 |
40
+ | W0629 | 1 | 12 |
41
+ | W0628 | 1 | 12 |
42
+
43
+ Scenario: entirely grouped
44
+ Given a target source named "fixture.c" with:
45
+ """
46
+ static int foo(int a, int b)
47
+ {
48
+ return (a + b % 5); /* W0495 */
49
+ }
50
+ """
51
+ When I successfully run `adlint fixture.c` on noarch
52
+ Then the output should exactly match with:
53
+ | mesg | line | column |
54
+ | W1076 | 1 | 12 |
55
+ | W0723 | 3 | 15 |
56
+ | W0104 | 1 | 20 |
57
+ | W0104 | 1 | 27 |
58
+ | W0629 | 1 | 12 |
59
+ | W0495 | 3 | 12 |
60
+ | W0628 | 1 | 12 |
@@ -0,0 +1,63 @@
1
+ Feature: W0496
2
+
3
+ W0496 detects that multiple conditional-expressions appear in an expression
4
+ without appropriate grouping.
5
+
6
+ Scenario: without grouping
7
+ Given a target source named "fixture.c" with:
8
+ """
9
+ static int foo(int a, int b)
10
+ {
11
+ return a < 0 ? a : b > 0 ? a + b : b; /* W0496 */
12
+ }
13
+ """
14
+ When I successfully run `adlint fixture.c` on noarch
15
+ Then the output should exactly match with:
16
+ | mesg | line | column |
17
+ | W1076 | 1 | 12 |
18
+ | W0723 | 3 | 34 |
19
+ | W0104 | 1 | 20 |
20
+ | W0104 | 1 | 27 |
21
+ | W0629 | 1 | 12 |
22
+ | W0496 | 3 | 12 |
23
+ | W0501 | 3 | 18 |
24
+ | W0628 | 1 | 12 |
25
+
26
+ Scenario: with appropriate grouping
27
+ Given a target source named "fixture.c" with:
28
+ """
29
+ static int foo(int a, int b)
30
+ {
31
+ return a < 0 ? a : (b > 0 ? a + b : b); /* OK */
32
+ }
33
+ """
34
+ When I successfully run `adlint fixture.c` on noarch
35
+ Then the output should exactly match with:
36
+ | mesg | line | column |
37
+ | W1076 | 1 | 12 |
38
+ | W0723 | 3 | 35 |
39
+ | W0104 | 1 | 20 |
40
+ | W0104 | 1 | 27 |
41
+ | W0629 | 1 | 12 |
42
+ | W0501 | 3 | 18 |
43
+ | W0628 | 1 | 12 |
44
+
45
+ Scenario: entirely grouped
46
+ Given a target source named "fixture.c" with:
47
+ """
48
+ static int foo(int a, int b)
49
+ {
50
+ return (a < 0 ? a : b > 0 ? a + b : b); /* W0496 */
51
+ }
52
+ """
53
+ When I successfully run `adlint fixture.c` on noarch
54
+ Then the output should exactly match with:
55
+ | mesg | line | column |
56
+ | W1076 | 1 | 12 |
57
+ | W0723 | 3 | 35 |
58
+ | W0104 | 1 | 20 |
59
+ | W0104 | 1 | 27 |
60
+ | W0629 | 1 | 12 |
61
+ | W0496 | 3 | 13 |
62
+ | W0501 | 3 | 19 |
63
+ | W0628 | 1 | 12 |
@@ -0,0 +1,65 @@
1
+ Feature: W0497
2
+
3
+ W0497 detects that multiple shift-expressions or relational-expressions or
4
+ equality-expressions appear in an expression without appropriate grouping.
5
+
6
+ Scenario: without grouping
7
+ Given a target source named "fixture.c" with:
8
+ """
9
+ static int foo(unsigned int a, unsigned int b)
10
+ {
11
+ return a << 1 < b << 2; /* W0497 */
12
+ }
13
+ """
14
+ When I successfully run `adlint fixture.c` on noarch
15
+ Then the output should exactly match with:
16
+ | mesg | line | column |
17
+ | W1076 | 1 | 12 |
18
+ | W0116 | 3 | 14 |
19
+ | W0116 | 3 | 23 |
20
+ | W0104 | 1 | 29 |
21
+ | W0104 | 1 | 45 |
22
+ | W0629 | 1 | 12 |
23
+ | W0497 | 3 | 12 |
24
+ | W0502 | 3 | 12 |
25
+ | W0628 | 1 | 12 |
26
+
27
+ Scenario: with appropriate grouping
28
+ Given a target source named "fixture.c" with:
29
+ """
30
+ static int foo(unsigned int a, unsigned int b)
31
+ {
32
+ return (a << 1) < (b << 2); /* OK */
33
+ }
34
+ """
35
+ When I successfully run `adlint fixture.c` on noarch
36
+ Then the output should exactly match with:
37
+ | mesg | line | column |
38
+ | W1076 | 1 | 12 |
39
+ | W0116 | 3 | 15 |
40
+ | W0116 | 3 | 26 |
41
+ | W0104 | 1 | 29 |
42
+ | W0104 | 1 | 45 |
43
+ | W0629 | 1 | 12 |
44
+ | W0628 | 1 | 12 |
45
+
46
+ Scenario: entirely grouped
47
+ Given a target source named "fixture.c" with:
48
+ """
49
+ static int foo(unsigned int a, unsigned int b)
50
+ {
51
+ return (a << 1 < b << 2); /* W0497 */
52
+ }
53
+ """
54
+ When I successfully run `adlint fixture.c` on noarch
55
+ Then the output should exactly match with:
56
+ | mesg | line | column |
57
+ | W1076 | 1 | 12 |
58
+ | W0116 | 3 | 15 |
59
+ | W0116 | 3 | 24 |
60
+ | W0104 | 1 | 29 |
61
+ | W0104 | 1 | 45 |
62
+ | W0629 | 1 | 12 |
63
+ | W0497 | 3 | 12 |
64
+ | W0502 | 3 | 12 |
65
+ | W0628 | 1 | 12 |