adlint 1.14.0 → 1.16.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 (70) hide show
  1. data/ChangeLog +265 -0
  2. data/MANIFEST +15 -0
  3. data/NEWS +30 -4
  4. data/etc/conf.d/noarch/adlint_all_bat.erb +1 -1
  5. data/etc/mesg.d/en_US/messages.yml +3 -3
  6. data/etc/mesg.d/ja_JP/messages.yml +3 -3
  7. data/features/message_detection/W0001.feature +2 -0
  8. data/features/message_detection/W0007.feature +8 -0
  9. data/features/message_detection/W0010.feature +4 -1
  10. data/features/message_detection/W0013.feature +8 -0
  11. data/features/message_detection/W0093.feature +3 -0
  12. data/features/message_detection/W0104.feature +7 -0
  13. data/features/message_detection/W0643.feature +80 -0
  14. data/features/message_detection/W0646.feature +115 -0
  15. data/features/message_detection/W0691.feature +100 -0
  16. data/features/message_detection/W0692.feature +32 -0
  17. data/features/message_detection/W0694.feature +128 -0
  18. data/features/message_detection/W0716.feature +3 -0
  19. data/features/message_detection/W0717.feature +3 -0
  20. data/features/message_detection/W0718.feature +3 -0
  21. data/features/message_detection/W0723.feature +2 -0
  22. data/features/message_detection/W0732.feature +3 -0
  23. data/features/message_detection/W0733.feature +3 -0
  24. data/features/message_detection/W0734.feature +8 -0
  25. data/features/message_detection/W0735.feature +8 -0
  26. data/features/message_detection/W0805.feature +92 -0
  27. data/features/message_detection/W0811.feature +79 -0
  28. data/features/message_detection/W1031.feature +7 -0
  29. data/features/message_detection/W1040.feature +89 -0
  30. data/features/message_detection/W1041.feature +15 -0
  31. data/features/message_detection/W1046.feature +60 -0
  32. data/features/message_detection/W1052.feature +3 -0
  33. data/features/message_detection/W1066.feature +3 -0
  34. data/features/message_detection/W1067.feature +3 -0
  35. data/features/message_detection/W1068.feature +3 -0
  36. data/features/message_detection/W1069.feature +5 -0
  37. data/features/message_detection/W1070.feature +6 -0
  38. data/features/message_detection/W1072.feature +1 -0
  39. data/features/message_detection/W1073.feature +145 -0
  40. data/features/message_detection/W1074.feature +139 -0
  41. data/features/message_detection/W1075.feature +86 -0
  42. data/features/message_detection/W1076.feature +66 -0
  43. data/features/message_detection/W1077.feature +105 -0
  44. data/features/message_detection/W9003.feature +4 -0
  45. data/lib/adlint/c/ctrlexpr.rb +3 -0
  46. data/lib/adlint/c/interp.rb +11 -5
  47. data/lib/adlint/c/lexer.rb +14 -3
  48. data/lib/adlint/c/message.rb +192 -0
  49. data/lib/adlint/c/parser.rb +19 -3
  50. data/lib/adlint/c/parser.y +18 -2
  51. data/lib/adlint/c/phase.rb +19 -6
  52. data/lib/adlint/c/syntax.rb +6 -0
  53. data/lib/adlint/c/type.rb +5 -1
  54. data/lib/adlint/cpp/constexpr.rb +3 -3
  55. data/lib/adlint/cpp/constexpr.y +3 -3
  56. data/lib/adlint/cpp/eval.rb +60 -86
  57. data/lib/adlint/cpp/lexer.rb +82 -28
  58. data/lib/adlint/cpp/macro.rb +64 -35
  59. data/lib/adlint/cpp/message.rb +137 -4
  60. data/lib/adlint/cpp/phase.rb +8 -0
  61. data/lib/adlint/cpp/syntax.rb +25 -0
  62. data/lib/adlint/lang.rb +2 -1
  63. data/lib/adlint/version.rb +2 -2
  64. data/share/doc/developers_guide_ja.html +3 -3
  65. data/share/doc/developers_guide_ja.texi +1 -1
  66. data/share/doc/users_guide_en.html +102 -85
  67. data/share/doc/users_guide_en.texi +85 -69
  68. data/share/doc/users_guide_ja.html +102 -94
  69. data/share/doc/users_guide_ja.texi +85 -77
  70. metadata +17 -2
@@ -0,0 +1,32 @@
1
+ Feature: W0692
2
+
3
+ W0692 detects that no argument is given to a function-like macro.
4
+
5
+ Scenario: no argument to a function-like macro
6
+ Given a target source named "W0692.c" with:
7
+ """
8
+ #define MACRO(a) #a
9
+
10
+ const char *s = (char *) MACRO(); /* W0692 */
11
+ """
12
+ When I successfully run `adlint W0692.c` on noarch
13
+ Then the output should exactly match with:
14
+ | mesg | line | column |
15
+ | W0442 | 1 | 1 |
16
+ | W0692 | 3 | 26 |
17
+ | W0117 | 3 | 13 |
18
+
19
+ Scenario: enough arguments to a function-like macro
20
+ Given a target source named "W0692.c" with:
21
+ """
22
+ #define MACRO(a) #a
23
+
24
+ const char *s = (char *) MACRO(str); /* OK */
25
+ """
26
+ When I successfully run `adlint W0692.c` on noarch
27
+ Then the output should exactly match with:
28
+ | mesg | line | column |
29
+ | W0442 | 1 | 1 |
30
+ | W0117 | 3 | 13 |
31
+
32
+ # vim:ts=2:sw=2:sts=2:et:
@@ -0,0 +1,128 @@
1
+ Feature: W0694
2
+
3
+ W0694 detects that the function named `assert' is called because standard
4
+ `assert' macro is undefined.
5
+
6
+ Scenario: undefining `assert' macro and then declaring `assert' function
7
+ Given a target source named "W0694.c" with:
8
+ """
9
+ #undef assert
10
+ extern void assert(int);
11
+
12
+ void foo(void)
13
+ {
14
+ assert("should not be reached" == ""); /* W0694 */
15
+ }
16
+ """
17
+ When I successfully run `adlint W0694.c` on noarch
18
+ Then the output should exactly match with:
19
+ | mesg | line | column |
20
+ | W0695 | 1 | 8 |
21
+ | W0118 | 2 | 13 |
22
+ | W0117 | 4 | 6 |
23
+ | W0027 | 6 | 36 |
24
+ | W0610 | 6 | 36 |
25
+ | W0694 | 6 | 11 |
26
+ | W0947 | 6 | 12 |
27
+ | W0947 | 6 | 39 |
28
+ | W0628 | 4 | 6 |
29
+
30
+ Scenario: declaring `assert' function and then undefining `assert' macro
31
+ Given a target source named "W0694.c" with:
32
+ """
33
+ extern void assert(int);
34
+ #undef assert
35
+
36
+ void foo(void)
37
+ {
38
+ assert("should not be reached" == ""); /* W0694 */
39
+ }
40
+ """
41
+ When I successfully run `adlint W0694.c` on noarch
42
+ Then the output should exactly match with:
43
+ | mesg | line | column |
44
+ | W0695 | 2 | 8 |
45
+ | W0118 | 1 | 13 |
46
+ | W0117 | 4 | 6 |
47
+ | W0027 | 6 | 36 |
48
+ | W0610 | 6 | 36 |
49
+ | W0694 | 6 | 11 |
50
+ | W0947 | 6 | 12 |
51
+ | W0947 | 6 | 39 |
52
+ | W0628 | 4 | 6 |
53
+
54
+ Scenario: undefining `assert' macro in function and then declaring `assert'
55
+ function
56
+ Given a target source named "W0694.c" with:
57
+ """
58
+ void foo(void)
59
+ {
60
+ #undef assert
61
+ extern void assert(int);
62
+ assert("should not be reached" == ""); /* W0694 */
63
+ }
64
+ """
65
+ When I successfully run `adlint W0694.c` on noarch
66
+ Then the output should exactly match with:
67
+ | mesg | line | column |
68
+ | W0695 | 3 | 8 |
69
+ | W0117 | 1 | 6 |
70
+ | W0118 | 4 | 17 |
71
+ | W0622 | 4 | 17 |
72
+ | W0027 | 5 | 36 |
73
+ | W0610 | 5 | 36 |
74
+ | W0694 | 5 | 11 |
75
+ | W0624 | 3 | 1 |
76
+ | W0947 | 5 | 12 |
77
+ | W0947 | 5 | 39 |
78
+ | W0628 | 1 | 6 |
79
+
80
+ Scenario: declaring `assert' function and then undefining `assert' macro in
81
+ function
82
+ Given a target source named "W0694.c" with:
83
+ """
84
+ extern void assert(int);
85
+
86
+ void foo(void)
87
+ {
88
+ #undef assert
89
+ assert("should not be reached" == ""); /* W0694 */
90
+ }
91
+ """
92
+ When I successfully run `adlint W0694.c` on noarch
93
+ Then the output should exactly match with:
94
+ | mesg | line | column |
95
+ | W0695 | 5 | 8 |
96
+ | W0118 | 1 | 13 |
97
+ | W0117 | 3 | 6 |
98
+ | W0027 | 6 | 36 |
99
+ | W0610 | 6 | 36 |
100
+ | W0694 | 6 | 11 |
101
+ | W0624 | 5 | 1 |
102
+ | W0947 | 6 | 12 |
103
+ | W0947 | 6 | 39 |
104
+ | W0628 | 3 | 6 |
105
+
106
+ Scenario: `assert' function declared but calling `assert' macro
107
+ Given a target source named "W0694.c" with:
108
+ """
109
+ extern void assert(int);
110
+
111
+ #define assert(expr) ((void *) 0) /* to simulate #include <assert.h> */
112
+
113
+ void foo(void)
114
+ {
115
+ assert("should not be reached" == ""); /* OK */
116
+ }
117
+ """
118
+ When I successfully run `adlint W0694.c` on noarch
119
+ Then the output should exactly match with:
120
+ | mesg | line | column |
121
+ | W0442 | 3 | 1 |
122
+ | W0118 | 1 | 13 |
123
+ | W0117 | 5 | 6 |
124
+ | W0567 | 7 | 5 |
125
+ | W0085 | 7 | 5 |
126
+ | W0628 | 5 | 6 |
127
+
128
+ # vim:ts=2:sw=2:sts=2:et:
@@ -14,6 +14,7 @@ Feature: W0716
14
14
  When I successfully run `adlint W0716.c` on noarch
15
15
  Then the output should exactly match with:
16
16
  | mesg | line | column |
17
+ | W1076 | 1 | 12 |
17
18
  | W0723 | 3 | 20 |
18
19
  | W0104 | 1 | 20 |
19
20
  | W0104 | 1 | 27 |
@@ -34,6 +35,7 @@ Feature: W0716
34
35
  When I successfully run `adlint W0716.c` on noarch
35
36
  Then the output should exactly match with:
36
37
  | mesg | line | column |
38
+ | W1076 | 1 | 12 |
37
39
  | W0572 | 3 | 20 |
38
40
  | W0104 | 1 | 20 |
39
41
  | W0104 | 1 | 27 |
@@ -54,6 +56,7 @@ Feature: W0716
54
56
  When I successfully run `adlint W0716.c` on noarch
55
57
  Then the output should exactly match with:
56
58
  | mesg | line | column |
59
+ | W1076 | 1 | 12 |
57
60
  | W0570 | 3 | 20 |
58
61
  | W0572 | 3 | 20 |
59
62
  | W0104 | 1 | 20 |
@@ -14,6 +14,7 @@ Feature: W0717
14
14
  When I successfully run `adlint W0717.c` on noarch
15
15
  Then the output should exactly match with:
16
16
  | mesg | line | column |
17
+ | W1076 | 1 | 12 |
17
18
  | W0723 | 3 | 20 |
18
19
  | W0104 | 1 | 21 |
19
20
  | W0104 | 1 | 28 |
@@ -33,6 +34,7 @@ Feature: W0717
33
34
  When I successfully run `adlint W0717.c` on noarch
34
35
  Then the output should exactly match with:
35
36
  | mesg | line | column |
37
+ | W1076 | 1 | 12 |
36
38
  | W0572 | 3 | 20 |
37
39
  | W0104 | 1 | 21 |
38
40
  | W0104 | 1 | 28 |
@@ -52,6 +54,7 @@ Feature: W0717
52
54
  When I successfully run `adlint W0717.c` on noarch
53
55
  Then the output should exactly match with:
54
56
  | mesg | line | column |
57
+ | W1076 | 1 | 12 |
55
58
  | W0570 | 3 | 20 |
56
59
  | W0572 | 3 | 20 |
57
60
  | W0104 | 1 | 21 |
@@ -14,6 +14,7 @@ Feature: W0718
14
14
  When I successfully run `adlint W0718.c` on noarch
15
15
  Then the output should exactly match with:
16
16
  | mesg | line | column |
17
+ | W1076 | 1 | 12 |
17
18
  | W0723 | 3 | 14 |
18
19
  | W0104 | 1 | 21 |
19
20
  | W0104 | 1 | 28 |
@@ -33,6 +34,7 @@ Feature: W0718
33
34
  When I successfully run `adlint W0718.c` on noarch
34
35
  Then the output should exactly match with:
35
36
  | mesg | line | column |
37
+ | W1076 | 1 | 12 |
36
38
  | W0572 | 3 | 14 |
37
39
  | W0104 | 1 | 21 |
38
40
  | W0104 | 1 | 28 |
@@ -52,6 +54,7 @@ Feature: W0718
52
54
  When I successfully run `adlint W0718.c` on noarch
53
55
  Then the output should exactly match with:
54
56
  | mesg | line | column |
57
+ | W1076 | 1 | 12 |
55
58
  | W0570 | 3 | 14 |
56
59
  | W0572 | 3 | 14 |
57
60
  | W0104 | 1 | 21 |
@@ -27,6 +27,7 @@ Feature: W0723
27
27
  When I successfully run `adlint W0723.c` on noarch
28
28
  Then the output should exactly match with:
29
29
  | mesg | line | column |
30
+ | W1076 | 1 | 12 |
30
31
  | W0104 | 1 | 22 |
31
32
  | W0104 | 1 | 31 |
32
33
  | W0629 | 1 | 12 |
@@ -43,6 +44,7 @@ Feature: W0723
43
44
  When I successfully run `adlint W0723.c` on noarch
44
45
  Then the output should exactly match with:
45
46
  | mesg | line | column |
47
+ | W1076 | 1 | 12 |
46
48
  | W0723 | 3 | 14 |
47
49
  | W0104 | 1 | 20 |
48
50
  | W0104 | 1 | 27 |
@@ -23,6 +23,7 @@ Feature: W0732
23
23
  When I successfully run `adlint W0732.c` on noarch
24
24
  Then the output should exactly match with:
25
25
  | mesg | line | column |
26
+ | W1076 | 1 | 13 |
26
27
  | W0723 | 5 | 12 |
27
28
  | W0723 | 5 | 23 |
28
29
  | W0723 | 6 | 12 |
@@ -78,6 +79,7 @@ Feature: W0732
78
79
  When I successfully run `adlint W0732.c` on noarch
79
80
  Then the output should exactly match with:
80
81
  | mesg | line | column |
82
+ | W1076 | 1 | 13 |
81
83
  | W0570 | 5 | 12 |
82
84
  | W0572 | 5 | 12 |
83
85
  | W0570 | 5 | 24 |
@@ -143,6 +145,7 @@ Feature: W0732
143
145
  When I successfully run `adlint W0732.c` on noarch
144
146
  Then the output should exactly match with:
145
147
  | mesg | line | column |
148
+ | W1076 | 1 | 13 |
146
149
  | W0104 | 1 | 22 |
147
150
  | W0104 | 1 | 29 |
148
151
  | W0104 | 1 | 36 |
@@ -23,6 +23,7 @@ Feature: W0733
23
23
  When I successfully run `adlint W0733.c` on noarch
24
24
  Then the output should exactly match with:
25
25
  | mesg | line | column |
26
+ | W1076 | 1 | 13 |
26
27
  | W0723 | 5 | 12 |
27
28
  | W0723 | 5 | 23 |
28
29
  | W0723 | 6 | 12 |
@@ -78,6 +79,7 @@ Feature: W0733
78
79
  When I successfully run `adlint W0733.c` on noarch
79
80
  Then the output should exactly match with:
80
81
  | mesg | line | column |
82
+ | W1076 | 1 | 13 |
81
83
  | W0570 | 5 | 12 |
82
84
  | W0572 | 5 | 12 |
83
85
  | W0570 | 5 | 24 |
@@ -143,6 +145,7 @@ Feature: W0733
143
145
  When I successfully run `adlint W0733.c` on noarch
144
146
  Then the output should exactly match with:
145
147
  | mesg | line | column |
148
+ | W1076 | 1 | 13 |
146
149
  | W0104 | 1 | 22 |
147
150
  | W0104 | 1 | 29 |
148
151
  | W0104 | 1 | 36 |
@@ -20,6 +20,7 @@ Feature: W0734
20
20
  When I successfully run `adlint W0734.c` on noarch
21
21
  Then the output should exactly match with:
22
22
  | mesg | line | column |
23
+ | W1076 | 1 | 13 |
23
24
  | W0723 | 5 | 12 |
24
25
  | W0723 | 6 | 12 |
25
26
  | W0723 | 7 | 12 |
@@ -58,6 +59,7 @@ Feature: W0734
58
59
  When I successfully run `adlint W0734.c` on noarch
59
60
  Then the output should exactly match with:
60
61
  | mesg | line | column |
62
+ | W1076 | 1 | 13 |
61
63
  | W0723 | 5 | 12 |
62
64
  | W0723 | 6 | 12 |
63
65
  | W0723 | 7 | 12 |
@@ -97,6 +99,7 @@ Feature: W0734
97
99
  When I successfully run `adlint W0734.c` on noarch
98
100
  Then the output should exactly match with:
99
101
  | mesg | line | column |
102
+ | W1076 | 1 | 13 |
100
103
  | W0723 | 5 | 12 |
101
104
  | W0723 | 6 | 12 |
102
105
  | W0723 | 7 | 12 |
@@ -135,6 +138,7 @@ Feature: W0734
135
138
  When I successfully run `adlint W0734.c` on noarch
136
139
  Then the output should exactly match with:
137
140
  | mesg | line | column |
141
+ | W1076 | 1 | 13 |
138
142
  | W0723 | 5 | 12 |
139
143
  | W0723 | 6 | 12 |
140
144
  | W0723 | 7 | 12 |
@@ -174,6 +178,7 @@ Feature: W0734
174
178
  When I successfully run `adlint W0734.c` on noarch
175
179
  Then the output should exactly match with:
176
180
  | mesg | line | column |
181
+ | W1076 | 1 | 13 |
177
182
  | W0570 | 5 | 12 |
178
183
  | W0572 | 5 | 12 |
179
184
  | W0571 | 6 | 12 |
@@ -214,6 +219,7 @@ Feature: W0734
214
219
  When I successfully run `adlint W0734.c` on noarch
215
220
  Then the output should exactly match with:
216
221
  | mesg | line | column |
222
+ | W1076 | 1 | 13 |
217
223
  | W0570 | 5 | 12 |
218
224
  | W0572 | 5 | 12 |
219
225
  | W0571 | 6 | 12 |
@@ -254,6 +260,7 @@ Feature: W0734
254
260
  When I successfully run `adlint W0734.c` on noarch
255
261
  Then the output should exactly match with:
256
262
  | mesg | line | column |
263
+ | W1076 | 1 | 13 |
257
264
  | W0570 | 5 | 12 |
258
265
  | W0572 | 5 | 12 |
259
266
  | W0571 | 6 | 12 |
@@ -295,6 +302,7 @@ Feature: W0734
295
302
  When I successfully run `adlint W0734.c` on noarch
296
303
  Then the output should exactly match with:
297
304
  | mesg | line | column |
305
+ | W1076 | 1 | 13 |
298
306
  | W0570 | 5 | 12 |
299
307
  | W0572 | 5 | 12 |
300
308
  | W0571 | 6 | 12 |
@@ -20,6 +20,7 @@ Feature: W0735
20
20
  When I successfully run `adlint W0735.c` on noarch
21
21
  Then the output should exactly match with:
22
22
  | mesg | line | column |
23
+ | W1076 | 1 | 13 |
23
24
  | W0723 | 5 | 17 |
24
25
  | W0723 | 6 | 17 |
25
26
  | W0723 | 7 | 17 |
@@ -58,6 +59,7 @@ Feature: W0735
58
59
  When I successfully run `adlint W0735.c` on noarch
59
60
  Then the output should exactly match with:
60
61
  | mesg | line | column |
62
+ | W1076 | 1 | 13 |
61
63
  | W0723 | 5 | 24 |
62
64
  | W0723 | 6 | 23 |
63
65
  | W0723 | 7 | 24 |
@@ -97,6 +99,7 @@ Feature: W0735
97
99
  When I successfully run `adlint W0735.c` on noarch
98
100
  Then the output should exactly match with:
99
101
  | mesg | line | column |
102
+ | W1076 | 1 | 13 |
100
103
  | W0723 | 5 | 17 |
101
104
  | W0723 | 6 | 17 |
102
105
  | W0723 | 7 | 17 |
@@ -135,6 +138,7 @@ Feature: W0735
135
138
  When I successfully run `adlint W0735.c` on noarch
136
139
  Then the output should exactly match with:
137
140
  | mesg | line | column |
141
+ | W1076 | 1 | 13 |
138
142
  | W0723 | 5 | 24 |
139
143
  | W0723 | 6 | 23 |
140
144
  | W0723 | 7 | 24 |
@@ -174,6 +178,7 @@ Feature: W0735
174
178
  When I successfully run `adlint W0735.c` on noarch
175
179
  Then the output should exactly match with:
176
180
  | mesg | line | column |
181
+ | W1076 | 1 | 13 |
177
182
  | W0570 | 5 | 17 |
178
183
  | W0572 | 5 | 17 |
179
184
  | W0571 | 6 | 17 |
@@ -214,6 +219,7 @@ Feature: W0735
214
219
  When I successfully run `adlint W0735.c` on noarch
215
220
  Then the output should exactly match with:
216
221
  | mesg | line | column |
222
+ | W1076 | 1 | 13 |
217
223
  | W0570 | 5 | 17 |
218
224
  | W0572 | 5 | 17 |
219
225
  | W0571 | 6 | 17 |
@@ -254,6 +260,7 @@ Feature: W0735
254
260
  When I successfully run `adlint W0735.c` on noarch
255
261
  Then the output should exactly match with:
256
262
  | mesg | line | column |
263
+ | W1076 | 1 | 13 |
257
264
  | W0570 | 5 | 24 |
258
265
  | W0572 | 5 | 24 |
259
266
  | W0571 | 6 | 23 |
@@ -295,6 +302,7 @@ Feature: W0735
295
302
  When I successfully run `adlint W0735.c` on noarch
296
303
  Then the output should exactly match with:
297
304
  | mesg | line | column |
305
+ | W1076 | 1 | 13 |
298
306
  | W0570 | 5 | 24 |
299
307
  | W0572 | 5 | 24 |
300
308
  | W0571 | 6 | 23 |
@@ -0,0 +1,92 @@
1
+ Feature: W0805
2
+
3
+ W0805 detects that no identifier as argument for the `defined' operator.
4
+
5
+ Scenario: no arguments
6
+ Given a target source named "W0805.c" with:
7
+ """
8
+ #if defined /* OK */
9
+ int i = 0;
10
+ #endif
11
+ """
12
+ When I successfully run `adlint W0805.c` on noarch
13
+ Then the output should exactly match with:
14
+ | mesg | line | column |
15
+ | E0007 | 1 | |
16
+ | W0804 | 1 | 5 |
17
+
18
+ Scenario: an argument specified but not an identifier
19
+ Given a target source named "W0805.c" with:
20
+ """
21
+ #if defined "foo" /* W0805 */
22
+ int i = 0;
23
+ #endif
24
+ """
25
+ When I successfully run `adlint W0805.c` on noarch
26
+ Then the output should exactly match with:
27
+ | mesg | line | column |
28
+ | E0007 | 1 | 13 |
29
+ | W0804 | 1 | 5 |
30
+ | W0805 | 1 | 5 |
31
+
32
+ Scenario: an identifier specified
33
+ Given a target source named "W0805.c" with:
34
+ """
35
+ #if defined FOO /* OK */
36
+ int i = 0;
37
+ #endif
38
+ """
39
+ When I successfully run `adlint W0805.c` on noarch
40
+ Then the output should exactly match with:
41
+ | mesg | line | column |
42
+
43
+ Scenario: an identifier specified in parenthesis
44
+ Given a target source named "W0805.c" with:
45
+ """
46
+ #if defined(FOO) /* OK */
47
+ int i = 0;
48
+ #endif
49
+ """
50
+ When I successfully run `adlint W0805.c` on noarch
51
+ Then the output should exactly match with:
52
+ | mesg | line | column |
53
+
54
+ Scenario: no arguments for latter `defined' operator
55
+ Given a target source named "W0805.c" with:
56
+ """
57
+ #if defined(FOO) && defined /* OK */
58
+ int i = 0;
59
+ #endif
60
+ """
61
+ When I successfully run `adlint W0805.c` on noarch
62
+ Then the output should exactly match with:
63
+ | mesg | line | column |
64
+ | E0007 | 1 | |
65
+ | W0804 | 1 | 21 |
66
+
67
+ Scenario: non identifier for latter `defined' operator
68
+ Given a target source named "W0805.c" with:
69
+ """
70
+ #if defined(FOO) && defined "foo" /* W0805 */
71
+ int i = 0;
72
+ #endif
73
+ """
74
+ When I successfully run `adlint W0805.c` on noarch
75
+ Then the output should exactly match with:
76
+ | mesg | line | column |
77
+ | E0007 | 1 | 29 |
78
+ | W0804 | 1 | 21 |
79
+ | W0805 | 1 | 21 |
80
+
81
+ Scenario: identifiers for two `defined' operator
82
+ Given a target source named "W0805.c" with:
83
+ """
84
+ #if defined(FOO) && defined BAR /* OK */
85
+ int i = 0;
86
+ #endif
87
+ """
88
+ When I successfully run `adlint W0805.c` on noarch
89
+ Then the output should exactly match with:
90
+ | mesg | line | column |
91
+
92
+ # vim:ts=2:sw=2:sts=2:et: