adlint 2.4.6 → 2.4.10

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 (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
@@ -0,0 +1,120 @@
1
+ Feature: W0498
2
+
3
+ W0498 detects that different operators of the same priority appear in an
4
+ expression without appropriate grouping.
5
+
6
+ Scenario: multiple additive-expressions in an expression
7
+ Given a target source named "fixture.c" with:
8
+ """
9
+ static int foo(int a, int b)
10
+ {
11
+ return a + b - 5; /* W0498 */
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
+ | W0723 | 3 | 18 |
20
+ | W0104 | 1 | 20 |
21
+ | W0104 | 1 | 27 |
22
+ | W0629 | 1 | 12 |
23
+ | W0498 | 3 | 12 |
24
+ | W0628 | 1 | 12 |
25
+
26
+ Scenario: multiple additive-expressions in an expression with grouping
27
+ Given a target source named "fixture.c" with:
28
+ """
29
+ static int foo(int a, int b)
30
+ {
31
+ return a + (b - 5); /* 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 | 19 |
39
+ | W0723 | 3 | 14 |
40
+ | W0104 | 1 | 20 |
41
+ | W0104 | 1 | 27 |
42
+ | W0629 | 1 | 12 |
43
+ | W0628 | 1 | 12 |
44
+
45
+ Scenario: multiple additive-expressions in an expression with large grouping
46
+ Given a target source named "fixture.c" with:
47
+ """
48
+ static int foo(int a, int b)
49
+ {
50
+ return (a + b - 5); /* W0498 */
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 | 15 |
58
+ | W0723 | 3 | 19 |
59
+ | W0104 | 1 | 20 |
60
+ | W0104 | 1 | 27 |
61
+ | W0629 | 1 | 12 |
62
+ | W0498 | 3 | 12 |
63
+ | W0628 | 1 | 12 |
64
+
65
+ Scenario: multiple multiplicative-expressions in an expression
66
+ Given a target source named "fixture.c" with:
67
+ """
68
+ static int foo(int a, int b)
69
+ {
70
+ return a * b / 5; /* W0498 */
71
+ }
72
+ """
73
+ When I successfully run `adlint fixture.c` on noarch
74
+ Then the output should exactly match with:
75
+ | mesg | line | column |
76
+ | W1076 | 1 | 12 |
77
+ | W0723 | 3 | 14 |
78
+ | W0104 | 1 | 20 |
79
+ | W0104 | 1 | 27 |
80
+ | W0629 | 1 | 12 |
81
+ | W0498 | 3 | 12 |
82
+ | W0628 | 1 | 12 |
83
+
84
+ Scenario: multiple multiplicative-expressions in an expression with grouping
85
+ Given a target source named "fixture.c" with:
86
+ """
87
+ static int foo(int a, int b)
88
+ {
89
+ return a * (b / 5); /* OK */
90
+ }
91
+ """
92
+ When I successfully run `adlint fixture.c` on noarch
93
+ Then the output should exactly match with:
94
+ | mesg | line | column |
95
+ | W1076 | 1 | 12 |
96
+ | W0723 | 3 | 14 |
97
+ | W0104 | 1 | 20 |
98
+ | W0104 | 1 | 27 |
99
+ | W0629 | 1 | 12 |
100
+ | W0628 | 1 | 12 |
101
+
102
+ Scenario: multiple multiplicative-expressions in an expression grouped
103
+ entirely
104
+ Given a target source named "fixture.c" with:
105
+ """
106
+ static int foo(int a, int b)
107
+ {
108
+ return (a * b / 5); /* W0498 */
109
+ }
110
+ """
111
+ When I successfully run `adlint fixture.c` on noarch
112
+ Then the output should exactly match with:
113
+ | mesg | line | column |
114
+ | W1076 | 1 | 12 |
115
+ | W0723 | 3 | 15 |
116
+ | W0104 | 1 | 20 |
117
+ | W0104 | 1 | 27 |
118
+ | W0629 | 1 | 12 |
119
+ | W0498 | 3 | 12 |
120
+ | W0628 | 1 | 12 |
@@ -0,0 +1,63 @@
1
+ Feature: W0499
2
+
3
+ W0499 detects that different operators of the same priority except for `+',
4
+ `-', `*', `/' and `%' appear in an expression without appropriate grouping.
5
+
6
+ Scenario: multiple shift-expressions in an expression
7
+ Given a target source named "fixture.c" with:
8
+ """
9
+ static unsigned int foo(unsigned int a, unsigned int b, unsigned int c)
10
+ {
11
+ return a << b >> c; /* W0499 */
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 | 21 |
18
+ | W0116 | 3 | 14 |
19
+ | W0104 | 1 | 38 |
20
+ | W0104 | 1 | 54 |
21
+ | W0104 | 1 | 70 |
22
+ | W0629 | 1 | 21 |
23
+ | W0499 | 3 | 12 |
24
+ | W0628 | 1 | 21 |
25
+
26
+ Scenario: multiple shift-expressions in an expression with grouping
27
+ Given a target source named "fixture.c" with:
28
+ """
29
+ static unsigned int foo(unsigned int a, unsigned int b, unsigned int c)
30
+ {
31
+ return (a << b) >> c; /* 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 | 21 |
38
+ | W0116 | 3 | 15 |
39
+ | W0104 | 1 | 38 |
40
+ | W0104 | 1 | 54 |
41
+ | W0104 | 1 | 70 |
42
+ | W0629 | 1 | 21 |
43
+ | W0628 | 1 | 21 |
44
+
45
+ Scenario: multiple shift-expressions in an expression with large grouping
46
+ Given a target source named "fixture.c" with:
47
+ """
48
+ static unsigned int foo(unsigned int a, unsigned int b, unsigned int c)
49
+ {
50
+ return (a << b >> c); /* W0499 */
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 | 21 |
57
+ | W0116 | 3 | 15 |
58
+ | W0104 | 1 | 38 |
59
+ | W0104 | 1 | 54 |
60
+ | W0104 | 1 | 70 |
61
+ | W0629 | 1 | 21 |
62
+ | W0499 | 3 | 12 |
63
+ | W0628 | 1 | 21 |
@@ -0,0 +1,66 @@
1
+ Feature: W0500
2
+
3
+ W0500 detects that `+', `-', `*' and `%' operators of the different priority
4
+ appear in an expression without appropriate grouping.
5
+
6
+ Scenario: additives and multiplicatives in an expression
7
+ Given a target source named "fixture.c" with:
8
+ """
9
+ static unsigned int foo(unsigned int a, unsigned int b, unsigned int c)
10
+ {
11
+ return a + b * c; /* W0500 */
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 | 21 |
18
+ | W1052 | 3 | 18 |
19
+ | W1052 | 3 | 14 |
20
+ | W0104 | 1 | 38 |
21
+ | W0104 | 1 | 54 |
22
+ | W0104 | 1 | 70 |
23
+ | W0629 | 1 | 21 |
24
+ | W0500 | 3 | 12 |
25
+ | W0628 | 1 | 21 |
26
+
27
+ Scenario: additives and multiplicatives in an expression with grouping
28
+ Given a target source named "fixture.c" with:
29
+ """
30
+ static unsigned int foo(unsigned int a, unsigned int b, unsigned int c)
31
+ {
32
+ return a + (b * c); /* 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 | 21 |
39
+ | W1052 | 3 | 19 |
40
+ | W1052 | 3 | 14 |
41
+ | W0104 | 1 | 38 |
42
+ | W0104 | 1 | 54 |
43
+ | W0104 | 1 | 70 |
44
+ | W0629 | 1 | 21 |
45
+ | W0628 | 1 | 21 |
46
+
47
+ Scenario: additives and multiplicatives in an expression with large grouping
48
+ Given a target source named "fixture.c" with:
49
+ """
50
+ static unsigned int foo(unsigned int a, unsigned int b, unsigned int c)
51
+ {
52
+ return (a + b * c); /* W0500 */
53
+ }
54
+ """
55
+ When I successfully run `adlint fixture.c` on noarch
56
+ Then the output should exactly match with:
57
+ | mesg | line | column |
58
+ | W1076 | 1 | 21 |
59
+ | W1052 | 3 | 19 |
60
+ | W1052 | 3 | 15 |
61
+ | W0104 | 1 | 38 |
62
+ | W0104 | 1 | 54 |
63
+ | W0104 | 1 | 70 |
64
+ | W0629 | 1 | 21 |
65
+ | W0500 | 3 | 12 |
66
+ | W0628 | 1 | 21 |
@@ -0,0 +1,69 @@
1
+ Feature: W0501
2
+
3
+ W0501 detects that a binary-expression appars in a conditional-expression
4
+ without appropriate grouping.
5
+
6
+ Scenario: binary-expressions in a conditional-expression
7
+ Given a target source named "fixture.c" with:
8
+ """
9
+ static int foo(int a, int b, int c)
10
+ {
11
+ return a + b ? a + b : c; /* W0501 */
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
+ | W0723 | 3 | 22 |
20
+ | W0104 | 1 | 20 |
21
+ | W0104 | 1 | 27 |
22
+ | W0104 | 1 | 34 |
23
+ | W0629 | 1 | 12 |
24
+ | W0501 | 3 | 18 |
25
+ | W0114 | 3 | 14 |
26
+ | W0628 | 1 | 12 |
27
+
28
+ Scenario: binary-expressions in a conditional-expression with grouping
29
+ Given a target source named "fixture.c" with:
30
+ """
31
+ static int foo(int a, int b, int c)
32
+ {
33
+ return (a + b) ? (a + b) : c; /* OK */
34
+ }
35
+ """
36
+ When I successfully run `adlint fixture.c` on noarch
37
+ Then the output should exactly match with:
38
+ | mesg | line | column |
39
+ | W1076 | 1 | 12 |
40
+ | W0723 | 3 | 15 |
41
+ | W0723 | 3 | 25 |
42
+ | W0104 | 1 | 20 |
43
+ | W0104 | 1 | 27 |
44
+ | W0104 | 1 | 34 |
45
+ | W0629 | 1 | 12 |
46
+ | W0114 | 3 | 12 |
47
+ | W0628 | 1 | 12 |
48
+
49
+ Scenario: binary-expressions in a conditional-expression with large grouping
50
+ Given a target source named "fixture.c" with:
51
+ """
52
+ static int foo(int a, int b, int c)
53
+ {
54
+ return (a + b ? a + b : c); /* W0501 */
55
+ }
56
+ """
57
+ When I successfully run `adlint fixture.c` on noarch
58
+ Then the output should exactly match with:
59
+ | mesg | line | column |
60
+ | W1076 | 1 | 12 |
61
+ | W0723 | 3 | 15 |
62
+ | W0723 | 3 | 23 |
63
+ | W0104 | 1 | 20 |
64
+ | W0104 | 1 | 27 |
65
+ | W0104 | 1 | 34 |
66
+ | W0629 | 1 | 12 |
67
+ | W0501 | 3 | 19 |
68
+ | W0114 | 3 | 15 |
69
+ | W0628 | 1 | 12 |
@@ -0,0 +1,64 @@
1
+ Feature: W0502
2
+
3
+ W0502 detects that operators of the different priority except for `+', `-',
4
+ `*', `/' and `%' appear in an expression without appropriate grouping.
5
+
6
+ Scenario: shift-expression and and-expression in an expression
7
+ Given a target source named "fixture.c" with:
8
+ """
9
+ static unsigned int foo(unsigned int a, unsigned int b, unsigned int c)
10
+ {
11
+ return a << b & c; /* W0502 */
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 | 21 |
18
+ | W0116 | 3 | 14 |
19
+ | W0104 | 1 | 38 |
20
+ | W0104 | 1 | 54 |
21
+ | W0104 | 1 | 70 |
22
+ | W0629 | 1 | 21 |
23
+ | W0502 | 3 | 12 |
24
+ | W0628 | 1 | 21 |
25
+
26
+ Scenario: shift-expression and and-expression in an expression with grouping
27
+ Given a target source named "fixture.c" with:
28
+ """
29
+ static unsigned int foo(unsigned int a, unsigned int b, unsigned int c)
30
+ {
31
+ return a << (b & c); /* 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 | 21 |
38
+ | W0116 | 3 | 14 |
39
+ | W0104 | 1 | 38 |
40
+ | W0104 | 1 | 54 |
41
+ | W0104 | 1 | 70 |
42
+ | W0629 | 1 | 21 |
43
+ | W0628 | 1 | 21 |
44
+
45
+ Scenario: shift-expression and and-expression in an expression with large
46
+ grouping
47
+ Given a target source named "fixture.c" with:
48
+ """
49
+ static unsigned int foo(unsigned int a, unsigned int b, unsigned int c)
50
+ {
51
+ return (a << b & c); /* W0502 */
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 | 21 |
58
+ | W0116 | 3 | 15 |
59
+ | W0104 | 1 | 38 |
60
+ | W0104 | 1 | 54 |
61
+ | W0104 | 1 | 70 |
62
+ | W0629 | 1 | 21 |
63
+ | W0502 | 3 | 12 |
64
+ | W0628 | 1 | 21 |
@@ -87,5 +87,3 @@ Feature: W0573
87
87
  | W0100 | 6 | 9 |
88
88
  | W0947 | 6 | 19 |
89
89
  | W0628 | 3 | 6 |
90
-
91
- # vim:ts=2:sw=2:sts=2:et:
@@ -25,5 +25,3 @@ Feature: W0583
25
25
  | W0104 | 7 | 20 |
26
26
  | W0589 | 7 | 5 |
27
27
  | W0591 | 7 | 5 |
28
-
29
- # vim:ts=2:sw=2:sts=2:et:
@@ -16,5 +16,3 @@ Feature: W0606
16
16
  | mesg | line | column |
17
17
  | W0551 | 1 | 7 |
18
18
  | W0606 | 1 | 7 |
19
-
20
- # vim:ts=2:sw=2:sts=2:et:
@@ -53,5 +53,3 @@ Feature: W0635
53
53
  | W0635 | 9 | 19 |
54
54
  | W0100 | 5 | 9 |
55
55
  | W0947 | 9 | 19 |
56
-
57
- # vim:ts=2:sw=2:sts=2:et:
@@ -128,5 +128,3 @@ Feature: W0641
128
128
  | W0641 | 3 | 12 |
129
129
  | W0104 | 1 | 17 |
130
130
  | W0628 | 1 | 7 |
131
-
132
- # vim:ts=2:sw=2:sts=2:et:
@@ -76,5 +76,3 @@ Feature: W0643
76
76
  | mesg | line | column |
77
77
  | W0442 | 1 | 1 |
78
78
  | W0117 | 2 | 13 |
79
-
80
- # vim:ts=2:sw=2:sts=2:et:
@@ -529,5 +529,3 @@ Feature: W0644
529
529
  | W0117 | 3 | 6 |
530
530
  | W0644 | 5 | 7 |
531
531
  | W0628 | 3 | 6 |
532
-
533
- # vim:ts=2:sw=2:sts=2:et:
@@ -138,5 +138,3 @@ Feature: W0645
138
138
  | W0002 | 1 | 13 |
139
139
  | W0645 | 1 | 13 |
140
140
  | W0628 | 1 | 13 |
141
-
142
- # vim:ts=2:sw=2:sts=2:et:
@@ -111,5 +111,3 @@ Feature: W0646
111
111
  | mesg | line | column |
112
112
  | W9003 | 4 | 26 |
113
113
  | W0626 | 4 | 26 |
114
-
115
- # vim:ts=2:sw=2:sts=2:et:
@@ -273,5 +273,3 @@ Feature: W0649
273
273
  | W0572 | 5 | 14 |
274
274
  | W0104 | 3 | 13 |
275
275
  | W0628 | 3 | 5 |
276
-
277
- # vim:ts=2:sw=2:sts=2:et:
@@ -204,5 +204,3 @@ Feature: W0650
204
204
  | W0650 | 3 | 14 |
205
205
  | W0104 | 1 | 14 |
206
206
  | W0628 | 1 | 5 |
207
-
208
- # vim:ts=2:sw=2:sts=2:et:
@@ -0,0 +1,43 @@
1
+ Feature: W0655
2
+
3
+ W0655 detects that a bit-field member appears as an operand of the
4
+ sizeof-expression.
5
+
6
+ Scenario: bit-field as an operand
7
+ Given a target source named "fixture.c" with:
8
+ """
9
+ extern struct Foo { unsigned int b1:1, b2:1; } foo;
10
+
11
+ static unsigned long bar(void)
12
+ {
13
+ return sizeof(foo.b1); /* W0655 */
14
+ }
15
+ """
16
+ When I successfully run `adlint fixture.c` on noarch
17
+ Then the output should exactly match with:
18
+ | mesg | line | column |
19
+ | W0118 | 1 | 48 |
20
+ | W1076 | 3 | 22 |
21
+ | W0655 | 5 | 12 |
22
+ | W0629 | 3 | 22 |
23
+ | W0425 | 1 | 40 |
24
+ | W0628 | 3 | 22 |
25
+
26
+ Scenario: arithmetic expression of two bit-fields as an operand
27
+ Given a target source named "fixture.c" with:
28
+ """
29
+ extern struct Foo { unsigned int b1:1, b2:1; } foo;
30
+
31
+ static unsigned long bar(void)
32
+ {
33
+ return sizeof(foo.b1 + foo.b2); /* OK */
34
+ }
35
+ """
36
+ When I successfully run `adlint fixture.c` on noarch
37
+ Then the output should exactly match with:
38
+ | mesg | line | column |
39
+ | W0118 | 1 | 48 |
40
+ | W1076 | 3 | 22 |
41
+ | W0629 | 3 | 22 |
42
+ | W0425 | 1 | 40 |
43
+ | W0628 | 3 | 22 |
@@ -116,5 +116,3 @@ Feature: W0685
116
116
  | W0100 | 6 | 9 |
117
117
  | W0947 | 6 | 19 |
118
118
  | W0628 | 3 | 6 |
119
-
120
- # vim:ts=2:sw=2:sts=2:et:
@@ -88,5 +88,3 @@ Feature: W0686
88
88
  | W0100 | 6 | 9 |
89
89
  | W0947 | 6 | 19 |
90
90
  | W0628 | 3 | 6 |
91
-
92
- # vim:ts=2:sw=2:sts=2:et:
@@ -21,5 +21,3 @@ Feature: W0687
21
21
  When I successfully run `adlint fixture.c` on noarch
22
22
  Then the output should exactly match with:
23
23
  | mesg | line | column |
24
-
25
- # vim:ts=2:sw=2:sts=2:et:
@@ -59,5 +59,3 @@ Feature: W0688
59
59
  Then the output should exactly match with:
60
60
  | mesg | line | column |
61
61
  | W0688 | 1 | 7 |
62
-
63
- # vim:ts=2:sw=2:sts=2:et:
@@ -42,5 +42,3 @@ Feature: W0689
42
42
  | mesg | line | column |
43
43
  | W0689 | 1 | 16 |
44
44
  | W0690 | 1 | 7 |
45
-
46
- # vim:ts=2:sw=2:sts=2:et:
@@ -31,5 +31,3 @@ Feature: W0690
31
31
  When I successfully run `adlint fixture.c` on noarch
32
32
  Then the output should exactly match with:
33
33
  | mesg | line | column |
34
-
35
- # vim:ts=2:sw=2:sts=2:et:
@@ -96,5 +96,3 @@ Feature: W0691
96
96
  | W0442 | 1 | 1 |
97
97
  | W0691 | 3 | 21 |
98
98
  | W0117 | 3 | 8 |
99
-
100
- # vim:ts=2:sw=2:sts=2:et:
@@ -41,5 +41,3 @@ Feature: W0692
41
41
  | mesg | line | column |
42
42
  | W0442 | 1 | 1 |
43
43
  | W0117 | 3 | 11 |
44
-
45
- # vim:ts=2:sw=2:sts=2:et:
@@ -124,5 +124,3 @@ Feature: W0694
124
124
  | W0567 | 7 | 5 |
125
125
  | W0085 | 7 | 5 |
126
126
  | W0628 | 5 | 6 |
127
-
128
- # vim:ts=2:sw=2:sts=2:et:
@@ -74,5 +74,3 @@ Feature: W0695
74
74
  | W0567 | 7 | 5 |
75
75
  | W0085 | 7 | 5 |
76
76
  | W0628 | 5 | 6 |
77
-
78
- # vim:ts=2:sw=2:sts=2:et:
@@ -185,5 +185,3 @@ Feature: W0697
185
185
  | W0104 | 1 | 21 |
186
186
  | W1072 | 4 | 9 |
187
187
  | W0628 | 1 | 12 |
188
-
189
- # vim:ts=2:sw=2:sts=2:et:
@@ -17,5 +17,3 @@ Feature: W0698
17
17
  | W0117 | 1 | 5 |
18
18
  | W0698 | 3 | 5 |
19
19
  | W0628 | 1 | 5 |
20
-
21
- # vim:ts=2:sw=2:sts=2:et:
@@ -18,5 +18,3 @@ Feature: W0699
18
18
  | W0457 | 1 | 8 |
19
19
  | W0699 | 3 | 5 |
20
20
  | W0628 | 1 | 8 |
21
-
22
- # vim:ts=2:sw=2:sts=2:et:
@@ -52,5 +52,3 @@ Feature: W0700
52
52
  | W0117 | 1 | 8 |
53
53
  | W0457 | 1 | 8 |
54
54
  | W0628 | 1 | 8 |
55
-
56
- # vim:ts=2:sw=2:sts=2:et:
@@ -70,5 +70,3 @@ Feature: W0703
70
70
  | W1060 | 6 | 12 |
71
71
  | W0100 | 5 | 25 |
72
72
  | W0425 | 5 | 25 |
73
-
74
- # vim:ts=2:sw=2:sts=2:et:
@@ -112,6 +112,7 @@ Feature: W0705
112
112
  | W0490 | 6 | 9 |
113
113
  | W0499 | 6 | 9 |
114
114
  | W0502 | 6 | 9 |
115
+ | W0498 | 7 | 14 |
115
116
  | W0628 | 3 | 5 |
116
117
 
117
118
  Scenario: indirection-expression with non-constant subscript may cause OOB
@@ -142,6 +143,7 @@ Feature: W0705
142
143
  | W0490 | 5 | 9 |
143
144
  | W0499 | 5 | 9 |
144
145
  | W0502 | 5 | 9 |
146
+ | W0498 | 6 | 10 |
145
147
  | W0628 | 3 | 6 |
146
148
 
147
149
  Scenario: array-subscript-expression with non-constant subscript must not
@@ -249,6 +251,7 @@ Feature: W0705
249
251
  | W0490 | 6 | 9 |
250
252
  | W0499 | 6 | 9 |
251
253
  | W0502 | 6 | 9 |
254
+ | W0498 | 7 | 14 |
252
255
  | W0628 | 3 | 5 |
253
256
 
254
257
  Scenario: indirection-expression with non-constant subscript must not cause
@@ -278,6 +281,7 @@ Feature: W0705
278
281
  | W0490 | 5 | 9 |
279
282
  | W0499 | 5 | 9 |
280
283
  | W0502 | 5 | 9 |
284
+ | W0498 | 6 | 10 |
281
285
  | W0628 | 3 | 6 |
282
286
 
283
287
  Scenario: indirection-expression with non-constant subscript should not cause
@@ -311,6 +315,7 @@ Feature: W0705
311
315
  | W0490 | 5 | 9 |
312
316
  | W0499 | 5 | 9 |
313
317
  | W0502 | 5 | 9 |
318
+ | W0498 | 7 | 18 |
314
319
  | W0628 | 3 | 5 |
315
320
 
316
321
  Scenario: indirection-expression with non-constant subscript may and should
@@ -345,6 +350,5 @@ Feature: W0705
345
350
  | W0490 | 5 | 9 |
346
351
  | W0499 | 5 | 9 |
347
352
  | W0502 | 5 | 9 |
353
+ | W0498 | 7 | 18 |
348
354
  | W0628 | 3 | 5 |
349
-
350
- # vim:ts=2:sw=2:sts=2:et: