adlint 1.16.0 → 1.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. data/ChangeLog +471 -0
  2. data/MANIFEST +35 -8
  3. data/NEWS +50 -4
  4. data/bin/adlint +7 -7
  5. data/bin/adlint_chk +7 -7
  6. data/bin/adlint_cma +7 -7
  7. data/bin/adlint_sma +7 -7
  8. data/bin/adlintize +5 -5
  9. data/etc/mesg.d/en_US/messages.yml +3 -3
  10. data/etc/mesg.d/ja_JP/messages.yml +3 -3
  11. data/features/message_detection/E0013.feature +34 -0
  12. data/features/message_detection/W0007.feature +2 -0
  13. data/features/message_detection/W0583.feature +1 -2
  14. data/features/message_detection/W0641.feature +132 -0
  15. data/features/message_detection/W0643.feature +1 -1
  16. data/features/message_detection/W0644.feature +529 -0
  17. data/features/message_detection/W0645.feature +1 -1
  18. data/features/message_detection/W0649.feature +277 -0
  19. data/features/message_detection/W0650.feature +208 -0
  20. data/features/message_detection/W0697.feature +6 -0
  21. data/features/message_detection/W0705.feature +350 -0
  22. data/features/message_detection/W0707.feature +223 -0
  23. data/features/message_detection/W0711.feature +113 -0
  24. data/features/message_detection/W0712.feature +113 -0
  25. data/features/message_detection/W0713.feature +110 -0
  26. data/features/message_detection/W0714.feature +118 -0
  27. data/features/message_detection/W0715.feature +118 -0
  28. data/features/message_detection/W0716.feature +1 -0
  29. data/features/message_detection/W0717.feature +1 -0
  30. data/features/message_detection/W0718.feature +1 -0
  31. data/features/message_detection/W0719.feature +154 -0
  32. data/features/message_detection/W0723.feature +1 -2
  33. data/features/message_detection/W0732.feature +3 -0
  34. data/features/message_detection/W0733.feature +3 -0
  35. data/features/message_detection/W0734.feature +4 -0
  36. data/features/message_detection/W0735.feature +4 -0
  37. data/features/message_detection/W0745.feature +132 -0
  38. data/features/message_detection/W0780.feature +68 -0
  39. data/features/message_detection/W0783.feature +95 -0
  40. data/features/message_detection/W0792.feature +124 -0
  41. data/features/message_detection/W0793.feature +153 -0
  42. data/features/message_detection/W0794.feature +90 -0
  43. data/features/message_detection/W0830.feature +65 -0
  44. data/features/message_detection/W0833.feature +220 -0
  45. data/features/message_detection/W0834.feature +189 -0
  46. data/features/message_detection/W1026.feature +105 -0
  47. data/features/message_detection/W1031.feature +17 -34
  48. data/features/message_detection/W1039.feature +268 -0
  49. data/features/message_detection/W1047.feature +163 -0
  50. data/features/message_detection/W1066.feature +1 -0
  51. data/features/message_detection/W1067.feature +1 -0
  52. data/features/message_detection/W1068.feature +1 -0
  53. data/features/message_detection/W1069.feature +5 -0
  54. data/features/message_detection/W1070.feature +5 -0
  55. data/features/message_detection/W1071.feature +83 -0
  56. data/features/message_detection/W1073.feature +3 -2
  57. data/features/message_detection/W9003.feature +7 -12
  58. data/features/step_definitions/message_detection_steps.rb +4 -31
  59. data/features/support/env.rb +117 -2
  60. data/lib/adlint/c/branch.rb +0 -2
  61. data/lib/adlint/c/ctrlexpr.rb +33 -0
  62. data/lib/adlint/c/expr.rb +119 -31
  63. data/lib/adlint/c/interp.rb +44 -3
  64. data/lib/adlint/c/message.rb +1411 -29
  65. data/lib/adlint/c/object.rb +16 -2
  66. data/lib/adlint/c/option.rb +1 -0
  67. data/lib/adlint/c/parser.rb +101 -100
  68. data/lib/adlint/c/parser.y +3 -2
  69. data/lib/adlint/c/phase.rb +18 -0
  70. data/lib/adlint/c/resolver.rb +23 -0
  71. data/lib/adlint/c/syntax.rb +90 -4
  72. data/lib/adlint/c/type.rb +177 -110
  73. data/lib/adlint/cpp/macro.rb +4 -4
  74. data/lib/adlint/version.rb +2 -2
  75. data/share/demo/bad_include/test/"1/".h +0 -0
  76. data/share/doc/developers_guide_ja.html +3 -3
  77. data/share/doc/developers_guide_ja.texi +1 -1
  78. data/share/doc/users_guide_en.html +467 -506
  79. data/share/doc/users_guide_en.texi +95 -125
  80. data/share/doc/users_guide_ja.html +471 -518
  81. data/share/doc/users_guide_ja.texi +95 -133
  82. data/spec/spec_helper.rb +6 -0
  83. metadata +37 -10
@@ -0,0 +1,113 @@
1
+ Feature: W0711
2
+
3
+ W0711 detects that operand of right side of relational expression is
4
+ `effectively boolean'.
5
+
6
+ Scenario: a relational expression
7
+ Given a target source named "W0711.c" with:
8
+ """
9
+ static int foo(int a, int b, int c, int d)
10
+ {
11
+ return (a + b) > (c > d); /* W0711 */
12
+ }
13
+ """
14
+ When I successfully run `adlint W0711.c` on noarch
15
+ Then the output should exactly match with:
16
+ | mesg | line | column |
17
+ | W1076 | 1 | 12 |
18
+ | W0723 | 3 | 15 |
19
+ | W0104 | 1 | 20 |
20
+ | W0104 | 1 | 27 |
21
+ | W0104 | 1 | 34 |
22
+ | W0104 | 1 | 41 |
23
+ | W0629 | 1 | 12 |
24
+ | W0711 | 3 | 22 |
25
+ | W0628 | 1 | 12 |
26
+
27
+ Scenario: an equality expression
28
+ Given a target source named "W0711.c" with:
29
+ """
30
+ static int foo(int a, int b, int c, int d)
31
+ {
32
+ return (a + b) > (c == d); /* W0711 */
33
+ }
34
+ """
35
+ When I successfully run `adlint W0711.c` on noarch
36
+ Then the output should exactly match with:
37
+ | mesg | line | column |
38
+ | W1076 | 1 | 12 |
39
+ | W0723 | 3 | 15 |
40
+ | W0104 | 1 | 20 |
41
+ | W0104 | 1 | 27 |
42
+ | W0104 | 1 | 34 |
43
+ | W0104 | 1 | 41 |
44
+ | W0629 | 1 | 12 |
45
+ | W0711 | 3 | 22 |
46
+ | W0628 | 1 | 12 |
47
+
48
+ Scenario: a logical expression
49
+ Given a target source named "W0711.c" with:
50
+ """
51
+ static int foo(int a, int b, int c, int d)
52
+ {
53
+ return (a + b) > (c && d); /* W0711 */
54
+ }
55
+ """
56
+ When I successfully run `adlint W0711.c` on noarch
57
+ Then the output should exactly match with:
58
+ | mesg | line | column |
59
+ | W1076 | 1 | 12 |
60
+ | W0723 | 3 | 15 |
61
+ | W0104 | 1 | 20 |
62
+ | W0104 | 1 | 27 |
63
+ | W0104 | 1 | 34 |
64
+ | W0104 | 1 | 41 |
65
+ | W0629 | 1 | 12 |
66
+ | W0711 | 3 | 22 |
67
+ | W0628 | 1 | 12 |
68
+
69
+ Scenario: a shift expression
70
+ Given a target source named "W0711.c" with:
71
+ """
72
+ static int foo(int a, int b, int c, int d)
73
+ {
74
+ return (a + b) > (c << d); /* OK */
75
+ }
76
+ """
77
+ When I successfully run `adlint W0711.c` on noarch
78
+ Then the output should exactly match with:
79
+ | mesg | line | column |
80
+ | W1076 | 1 | 12 |
81
+ | W0723 | 3 | 15 |
82
+ | W0570 | 3 | 25 |
83
+ | W0572 | 3 | 25 |
84
+ | W0794 | 3 | 25 |
85
+ | W0104 | 1 | 20 |
86
+ | W0104 | 1 | 27 |
87
+ | W0104 | 1 | 34 |
88
+ | W0104 | 1 | 41 |
89
+ | W0629 | 1 | 12 |
90
+ | W0628 | 1 | 12 |
91
+
92
+ Scenario: an arithmetic expression
93
+ Given a target source named "W0711.c" with:
94
+ """
95
+ static int foo(int a, int b, int c, int d)
96
+ {
97
+ return (a + b) > (c + d); /* OK */
98
+ }
99
+ """
100
+ When I successfully run `adlint W0711.c` on noarch
101
+ Then the output should exactly match with:
102
+ | mesg | line | column |
103
+ | W1076 | 1 | 12 |
104
+ | W0723 | 3 | 15 |
105
+ | W0723 | 3 | 25 |
106
+ | W0104 | 1 | 20 |
107
+ | W0104 | 1 | 27 |
108
+ | W0104 | 1 | 34 |
109
+ | W0104 | 1 | 41 |
110
+ | W0629 | 1 | 12 |
111
+ | W0628 | 1 | 12 |
112
+
113
+ # vim:ts=2:sw=2:sts=2:et:
@@ -0,0 +1,113 @@
1
+ Feature: W0712
2
+
3
+ W0712 detects that operand of left side of relational expression is
4
+ `effectively boolean'.
5
+
6
+ Scenario: a relational expression
7
+ Given a target source named "W0712.c" with:
8
+ """
9
+ static int foo(int a, int b, int c, int d)
10
+ {
11
+ return (a > b) > (c + d); /* W0712 */
12
+ }
13
+ """
14
+ When I successfully run `adlint W0712.c` on noarch
15
+ Then the output should exactly match with:
16
+ | mesg | line | column |
17
+ | W1076 | 1 | 12 |
18
+ | W0723 | 3 | 25 |
19
+ | W0104 | 1 | 20 |
20
+ | W0104 | 1 | 27 |
21
+ | W0104 | 1 | 34 |
22
+ | W0104 | 1 | 41 |
23
+ | W0629 | 1 | 12 |
24
+ | W0712 | 3 | 12 |
25
+ | W0628 | 1 | 12 |
26
+
27
+ Scenario: an equality expression
28
+ Given a target source named "W0712.c" with:
29
+ """
30
+ static int foo(int a, int b, int c, int d)
31
+ {
32
+ return (a == b) > (c + d); /* W0712 */
33
+ }
34
+ """
35
+ When I successfully run `adlint W0712.c` on noarch
36
+ Then the output should exactly match with:
37
+ | mesg | line | column |
38
+ | W1076 | 1 | 12 |
39
+ | W0723 | 3 | 26 |
40
+ | W0104 | 1 | 20 |
41
+ | W0104 | 1 | 27 |
42
+ | W0104 | 1 | 34 |
43
+ | W0104 | 1 | 41 |
44
+ | W0629 | 1 | 12 |
45
+ | W0712 | 3 | 12 |
46
+ | W0628 | 1 | 12 |
47
+
48
+ Scenario: a logical expression
49
+ Given a target source named "W0712.c" with:
50
+ """
51
+ static int foo(int a, int b, int c, int d)
52
+ {
53
+ return (a && b) > (c + d); /* W0712 */
54
+ }
55
+ """
56
+ When I successfully run `adlint W0712.c` on noarch
57
+ Then the output should exactly match with:
58
+ | mesg | line | column |
59
+ | W1076 | 1 | 12 |
60
+ | W0723 | 3 | 26 |
61
+ | W0104 | 1 | 20 |
62
+ | W0104 | 1 | 27 |
63
+ | W0104 | 1 | 34 |
64
+ | W0104 | 1 | 41 |
65
+ | W0629 | 1 | 12 |
66
+ | W0712 | 3 | 12 |
67
+ | W0628 | 1 | 12 |
68
+
69
+ Scenario: a shift expression
70
+ Given a target source named "W0712.c" with:
71
+ """
72
+ static int foo(int a, int b, int c, int d)
73
+ {
74
+ return (a << b) > (c + d); /* OK */
75
+ }
76
+ """
77
+ When I successfully run `adlint W0712.c` on noarch
78
+ Then the output should exactly match with:
79
+ | mesg | line | column |
80
+ | W1076 | 1 | 12 |
81
+ | W0570 | 3 | 15 |
82
+ | W0572 | 3 | 15 |
83
+ | W0794 | 3 | 15 |
84
+ | W0723 | 3 | 26 |
85
+ | W0104 | 1 | 20 |
86
+ | W0104 | 1 | 27 |
87
+ | W0104 | 1 | 34 |
88
+ | W0104 | 1 | 41 |
89
+ | W0629 | 1 | 12 |
90
+ | W0628 | 1 | 12 |
91
+
92
+ Scenario: an arithmetic expression
93
+ Given a target source named "W0712.c" with:
94
+ """
95
+ static int foo(int a, int b, int c, int d)
96
+ {
97
+ return (a + b) > (c + d); /* OK */
98
+ }
99
+ """
100
+ When I successfully run `adlint W0712.c` on noarch
101
+ Then the output should exactly match with:
102
+ | mesg | line | column |
103
+ | W1076 | 1 | 12 |
104
+ | W0723 | 3 | 15 |
105
+ | W0723 | 3 | 25 |
106
+ | W0104 | 1 | 20 |
107
+ | W0104 | 1 | 27 |
108
+ | W0104 | 1 | 34 |
109
+ | W0104 | 1 | 41 |
110
+ | W0629 | 1 | 12 |
111
+ | W0628 | 1 | 12 |
112
+
113
+ # vim:ts=2:sw=2:sts=2:et:
@@ -0,0 +1,110 @@
1
+ Feature: W0713
2
+
3
+ W0713 detects that operands of both sides of relational expression is
4
+ `effectively boolean'.
5
+
6
+ Scenario: relational expressions
7
+ Given a target source named "W0713.c" with:
8
+ """
9
+ static int foo(int a, int b, int c, int d)
10
+ {
11
+ return (a > b) > (c > d); /* W0713 */
12
+ }
13
+ """
14
+ When I successfully run `adlint W0713.c` on noarch
15
+ Then the output should exactly match with:
16
+ | mesg | line | column |
17
+ | W1076 | 1 | 12 |
18
+ | W0104 | 1 | 20 |
19
+ | W0104 | 1 | 27 |
20
+ | W0104 | 1 | 34 |
21
+ | W0104 | 1 | 41 |
22
+ | W0629 | 1 | 12 |
23
+ | W0713 | 3 | 20 |
24
+ | W0628 | 1 | 12 |
25
+
26
+ Scenario: an equality expression
27
+ Given a target source named "W0713.c" with:
28
+ """
29
+ static int foo(int a, int b, int c, int d)
30
+ {
31
+ return (a == b) > (c != d); /* W0713 */
32
+ }
33
+ """
34
+ When I successfully run `adlint W0713.c` on noarch
35
+ Then the output should exactly match with:
36
+ | mesg | line | column |
37
+ | W1076 | 1 | 12 |
38
+ | W0104 | 1 | 20 |
39
+ | W0104 | 1 | 27 |
40
+ | W0104 | 1 | 34 |
41
+ | W0104 | 1 | 41 |
42
+ | W0629 | 1 | 12 |
43
+ | W0713 | 3 | 21 |
44
+ | W0628 | 1 | 12 |
45
+
46
+ Scenario: logical expressions
47
+ Given a target source named "W0713.c" with:
48
+ """
49
+ static int foo(int a, int b, int c, int d)
50
+ {
51
+ return (a && b) > (c || d); /* W0713 */
52
+ }
53
+ """
54
+ When I successfully run `adlint W0713.c` on noarch
55
+ Then the output should exactly match with:
56
+ | mesg | line | column |
57
+ | W1076 | 1 | 12 |
58
+ | W0104 | 1 | 20 |
59
+ | W0104 | 1 | 27 |
60
+ | W0104 | 1 | 34 |
61
+ | W0104 | 1 | 41 |
62
+ | W0629 | 1 | 12 |
63
+ | W0713 | 3 | 21 |
64
+ | W0628 | 1 | 12 |
65
+
66
+ Scenario: shift expressions
67
+ Given a target source named "W0713.c" with:
68
+ """
69
+ static int foo(int a, int b, int c, int d)
70
+ {
71
+ return (a << b) > (c ^ d); /* OK */
72
+ }
73
+ """
74
+ When I successfully run `adlint W0713.c` on noarch
75
+ Then the output should exactly match with:
76
+ | mesg | line | column |
77
+ | W1076 | 1 | 12 |
78
+ | W0570 | 3 | 15 |
79
+ | W0572 | 3 | 15 |
80
+ | W0794 | 3 | 15 |
81
+ | W0572 | 3 | 26 |
82
+ | W0104 | 1 | 20 |
83
+ | W0104 | 1 | 27 |
84
+ | W0104 | 1 | 34 |
85
+ | W0104 | 1 | 41 |
86
+ | W0629 | 1 | 12 |
87
+ | W0628 | 1 | 12 |
88
+
89
+ Scenario: arithmetic expressions
90
+ Given a target source named "W0713.c" with:
91
+ """
92
+ static int foo(int a, int b, int c, int d)
93
+ {
94
+ return (a + b) > (c - d); /* OK */
95
+ }
96
+ """
97
+ When I successfully run `adlint W0713.c` on noarch
98
+ Then the output should exactly match with:
99
+ | mesg | line | column |
100
+ | W1076 | 1 | 12 |
101
+ | W0723 | 3 | 15 |
102
+ | W0723 | 3 | 25 |
103
+ | W0104 | 1 | 20 |
104
+ | W0104 | 1 | 27 |
105
+ | W0104 | 1 | 34 |
106
+ | W0104 | 1 | 41 |
107
+ | W0629 | 1 | 12 |
108
+ | W0628 | 1 | 12 |
109
+
110
+ # vim:ts=2:sw=2:sts=2:et:
@@ -0,0 +1,118 @@
1
+ Feature: W0714
2
+
3
+ W0714 detects that operands of both sides of and-expression is
4
+ `effectively boolean'.
5
+
6
+ Scenario: relational expressions
7
+ Given a target source named "W0714.c" with:
8
+ """
9
+ static int foo(int a, int b, int c, int d)
10
+ {
11
+ return (a > b) & (c > d); /* W0714 */
12
+ }
13
+ """
14
+ When I successfully run `adlint W0714.c` on noarch
15
+ Then the output should exactly match with:
16
+ | mesg | line | column |
17
+ | W1076 | 1 | 12 |
18
+ | W0572 | 3 | 20 |
19
+ | W0104 | 1 | 20 |
20
+ | W0104 | 1 | 27 |
21
+ | W0104 | 1 | 34 |
22
+ | W0104 | 1 | 41 |
23
+ | W0629 | 1 | 12 |
24
+ | W0714 | 3 | 20 |
25
+ | W0716 | 3 | 20 |
26
+ | W0628 | 1 | 12 |
27
+
28
+ Scenario: equality expressions
29
+ Given a target source named "W0714.c" with:
30
+ """
31
+ static int foo(int a, int b, int c, int d)
32
+ {
33
+ return (a == b) & (c != d); /* W0714 */
34
+ }
35
+ """
36
+ When I successfully run `adlint W0714.c` on noarch
37
+ Then the output should exactly match with:
38
+ | mesg | line | column |
39
+ | W1076 | 1 | 12 |
40
+ | W0572 | 3 | 21 |
41
+ | W0104 | 1 | 20 |
42
+ | W0104 | 1 | 27 |
43
+ | W0104 | 1 | 34 |
44
+ | W0104 | 1 | 41 |
45
+ | W0629 | 1 | 12 |
46
+ | W0714 | 3 | 21 |
47
+ | W0716 | 3 | 21 |
48
+ | W0628 | 1 | 12 |
49
+
50
+ Scenario: logical expressions
51
+ Given a target source named "W0714.c" with:
52
+ """
53
+ static int foo(int a, int b, int c, int d)
54
+ {
55
+ return (a && b) & (c || d); /* W0714 */
56
+ }
57
+ """
58
+ When I successfully run `adlint W0714.c` on noarch
59
+ Then the output should exactly match with:
60
+ | mesg | line | column |
61
+ | W1076 | 1 | 12 |
62
+ | W0572 | 3 | 21 |
63
+ | W0104 | 1 | 20 |
64
+ | W0104 | 1 | 27 |
65
+ | W0104 | 1 | 34 |
66
+ | W0104 | 1 | 41 |
67
+ | W0629 | 1 | 12 |
68
+ | W0714 | 3 | 21 |
69
+ | W0716 | 3 | 21 |
70
+ | W0628 | 1 | 12 |
71
+
72
+ Scenario: shift expressions
73
+ Given a target source named "W0714.c" with:
74
+ """
75
+ static int foo(int a, int b, int c, int d)
76
+ {
77
+ return (a << b) & (c ^ d); /* OK */
78
+ }
79
+ """
80
+ When I successfully run `adlint W0714.c` on noarch
81
+ Then the output should exactly match with:
82
+ | mesg | line | column |
83
+ | W1076 | 1 | 12 |
84
+ | W0570 | 3 | 15 |
85
+ | W0572 | 3 | 15 |
86
+ | W0794 | 3 | 15 |
87
+ | W0572 | 3 | 26 |
88
+ | W0572 | 3 | 21 |
89
+ | W0104 | 1 | 20 |
90
+ | W0104 | 1 | 27 |
91
+ | W0104 | 1 | 34 |
92
+ | W0104 | 1 | 41 |
93
+ | W0629 | 1 | 12 |
94
+ | W0628 | 1 | 12 |
95
+
96
+ Scenario: arithmetic expressions
97
+ Given a target source named "W0714.c" with:
98
+ """
99
+ static int foo(int a, int b, int c, int d)
100
+ {
101
+ return (a + b) & (c - d); /* OK */
102
+ }
103
+ """
104
+ When I successfully run `adlint W0714.c` on noarch
105
+ Then the output should exactly match with:
106
+ | mesg | line | column |
107
+ | W1076 | 1 | 12 |
108
+ | W0723 | 3 | 15 |
109
+ | W0723 | 3 | 25 |
110
+ | W0572 | 3 | 20 |
111
+ | W0104 | 1 | 20 |
112
+ | W0104 | 1 | 27 |
113
+ | W0104 | 1 | 34 |
114
+ | W0104 | 1 | 41 |
115
+ | W0629 | 1 | 12 |
116
+ | W0628 | 1 | 12 |
117
+
118
+ # vim:ts=2:sw=2:sts=2:et: