adlint 2.2.0 → 2.4.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 (100) hide show
  1. data/AUTHORS +0 -1
  2. data/ChangeLog +185 -1
  3. data/MANIFEST +3 -0
  4. data/NEWS +28 -5
  5. data/bin/adlintize +70 -7
  6. data/etc/conf.d/fallback/traits.erb +12 -3
  7. data/etc/conf.d/i686-cygwin/traits-gcc_4.3.4.erb +12 -3
  8. data/etc/conf.d/i686-devkit/traits-gcc_4.5.2.erb +12 -3
  9. data/etc/conf.d/i686-linux/traits-gcc_4.5.1.erb +12 -3
  10. data/etc/conf.d/i686-mingw/traits-gcc_4.6.1.erb +12 -3
  11. data/etc/conf.d/x86_64-ubuntu_12.04/traits-gcc_4.6.3.erb +12 -4
  12. data/etc/mesg.d/c_builtin/en_US/messages.yml +1 -1
  13. data/etc/mesg.d/c_builtin/ja_JP/messages.yml +1 -1
  14. data/etc/mesg.d/core/en_US/messages.yml +1 -1
  15. data/etc/mesg.d/core/ja_JP/messages.yml +1 -1
  16. data/features/code_check/W0070.feature +51 -0
  17. data/features/code_check/W0071.feature +51 -0
  18. data/features/code_check/W0425.feature +279 -0
  19. data/features/code_check/W0692.feature +14 -1
  20. data/features/code_check/W0834.feature +7 -5
  21. data/features/code_check/W1073.feature +0 -1
  22. data/features/code_check/W1074.feature +6 -0
  23. data/features/code_check/W9003.feature +54 -0
  24. data/features/support/env.rb +15 -3
  25. data/lib/adlint/c/expr.rb +30 -6
  26. data/lib/adlint/c/interp.rb +4 -0
  27. data/lib/adlint/cpp/eval.rb +24 -14
  28. data/lib/adlint/cpp/macro.rb +52 -40
  29. data/lib/adlint/exam/c_builtin/c_check.rb +76 -42
  30. data/lib/adlint/exam/c_builtin/cpp_check.rb +4 -2
  31. data/lib/adlint/traits.rb +37 -23
  32. data/lib/adlint/util.rb +6 -0
  33. data/lib/adlint/version.rb +3 -3
  34. data/share/doc/developers_guide_ja.html +3 -3
  35. data/share/doc/developers_guide_ja.texi +1 -1
  36. data/share/doc/users_guide_en.html +1679 -1651
  37. data/share/doc/users_guide_en.texi +56 -24
  38. data/share/doc/users_guide_ja.html +1697 -1669
  39. data/share/doc/users_guide_ja.texi +57 -24
  40. data/share/sample/bison-2.5/adlint/adlint_traits.yml +13 -4
  41. data/share/sample/bison-2.5/adlint/lib/adlint_traits.yml +13 -4
  42. data/share/sample/bison-2.5/adlint/src/adlint_traits.yml +13 -4
  43. data/share/sample/ctags-5.8/adlint/adlint_traits.yml +13 -4
  44. data/share/sample/flex-2.5.35/adlint/adlint_traits.yml +13 -4
  45. data/share/sample/ruby-1.9.3-p0/adlint/adlint_traits.yml +13 -4
  46. data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_traits.yml +13 -4
  47. data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_traits.yml +13 -4
  48. data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_traits.yml +13 -4
  49. data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_traits.yml +13 -4
  50. data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_traits.yml +13 -4
  51. data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_traits.yml +13 -4
  52. data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_traits.yml +13 -4
  53. data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_traits.yml +13 -4
  54. data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_traits.yml +13 -4
  55. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_traits.yml +13 -4
  56. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_traits.yml +13 -4
  57. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_traits.yml +13 -4
  58. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_traits.yml +13 -4
  59. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_traits.yml +13 -4
  60. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_traits.yml +13 -4
  61. data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_traits.yml +13 -4
  62. data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_traits.yml +13 -4
  63. data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_traits.yml +13 -4
  64. data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_traits.yml +13 -4
  65. data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_traits.yml +13 -4
  66. data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_traits.yml +13 -4
  67. data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_traits.yml +13 -4
  68. data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_traits.yml +13 -4
  69. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_traits.yml +13 -4
  70. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_traits.yml +13 -4
  71. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_traits.yml +13 -4
  72. data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_traits.yml +13 -4
  73. data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_traits.yml +13 -4
  74. data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_traits.yml +13 -4
  75. data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_traits.yml +13 -4
  76. data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_traits.yml +13 -4
  77. data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_traits.yml +13 -4
  78. data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_traits.yml +13 -4
  79. data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_traits.yml +13 -4
  80. data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_traits.yml +13 -4
  81. data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_traits.yml +13 -4
  82. data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_traits.yml +13 -4
  83. data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_traits.yml +13 -4
  84. data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_traits.yml +13 -4
  85. data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_traits.yml +13 -4
  86. data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_traits.yml +13 -4
  87. data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_traits.yml +13 -4
  88. data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_traits.yml +13 -4
  89. data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_traits.yml +13 -4
  90. data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_traits.yml +13 -4
  91. data/share/sample/screen-4.0.3/adlint/adlint_traits.yml +13 -4
  92. data/share/sample/vim-7.3/adlint/vim/adlint_traits.yml +13 -4
  93. data/share/sample/vim-7.3/adlint/xxd/adlint_traits.yml +13 -4
  94. data/share/sample/zsh-4.3.15/adlint/adlint_traits.yml +13 -4
  95. data/share/sample/zsh-4.3.15/adlint/builtins/adlint_traits.yml +13 -4
  96. data/share/sample/zsh-4.3.15/adlint/core/adlint_traits.yml +13 -4
  97. data/share/sample/zsh-4.3.15/adlint/modules/adlint_traits.yml +13 -4
  98. data/share/sample/zsh-4.3.15/adlint/zle/adlint_traits.yml +13 -4
  99. data/spec/conf.d/default_traits.yml +12 -4
  100. metadata +5 -2
data/AUTHORS CHANGED
@@ -25,4 +25,3 @@
25
25
 
26
26
  * Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
27
27
  * Rie Shima <mailto:rkakuuchi@users.sourceforge.net>
28
- * Code Quality Assessment Team of {OGIS-RI}[http://www.ogis-ri.co.jp/] Co.,Ltd.
data/ChangeLog CHANGED
@@ -1,3 +1,187 @@
1
+ Fri Sep 21 15:00:34 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
2
+
3
+ * release.ga : 2.4.0
4
+ - Fix W0425 detection not to warn when a selection-statement or a
5
+ iteration-statement is written in a line.
6
+ - Fix evaluation of sizeof expression to return `size_t' value or
7
+ `unsigned long' value if size_t is not declared.
8
+ - Fix evaluation of function-definition in order to refer symbols of
9
+ return type and parameter types.
10
+ - Revise format of the traits file in preparation for supporting
11
+ warning suppression of 3rd-party headers imported in the target
12
+ project tree.
13
+ - Support compound pathname as an entry in the directory pathname
14
+ list item of the traits file.
15
+ - Fix abend problem when no examination package name is specified in
16
+ the traits file.
17
+ - Fix W0100 detection not to over-warn about variables updated in an
18
+ iteration-statement.
19
+ - Fix bad preprocess behavior when an empty argument is given to a
20
+ function-like macro call which applies `##' operator to the empty
21
+ perameter.
22
+ - Fix #include directive evaluation in order to correctly read header
23
+ file with an absolute path when any include_path items are not
24
+ specified.
25
+
26
+ Fri Sep 21 13:00:47 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
27
+
28
+ * release.rc : 2.3.4
29
+ - Fix #include directive evaluation in order to correctly read header
30
+ file with an absolute path when any include_path items are not
31
+ specified.
32
+
33
+ Fri Sep 21 12:57:40 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
34
+
35
+ * lib/adlint/cpp/eval.rb : Fix #include directive evaluation in order
36
+ to correctly read header file with an absolute path when any
37
+ include_path items are not specified.
38
+
39
+ Fri Sep 21 10:07:05 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
40
+
41
+ * release.rc : 2.3.3
42
+ - Fix W0692 detection in order to warn about no argument
43
+ function-like macro call which has one parameter.
44
+
45
+ Fri Sep 21 09:50:13 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
46
+
47
+ * lib/adlint/exam/c_builtin/cpp_check.rb : Fix W0692 detection in order
48
+ to warn about no argument function-like macro call which has one
49
+ parameter.
50
+
51
+ Fri Sep 21 05:10:01 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
52
+
53
+ * release.rc : 2.3.2
54
+ - Fix bad macro substitution in order not to apply a function-like
55
+ macro without parameters when value of a token is same as that
56
+ function-like macro name.
57
+
58
+ Fri Sep 21 04:25:22 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
59
+
60
+ * lib/adlint/cpp/macro.rb : Fix bad macro substitution in order not to
61
+ apply a function-like macro without parameters when value of a token
62
+ is same as that function-like macro name.
63
+
64
+ Thu Sep 20 19:45:06 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
65
+
66
+ * release.rc : 2.3.1
67
+ - Fix W0100 detection not to over-warn about variables updated in an
68
+ iteration-statement.
69
+ - Fix bad preprocess behavior when an empty argument is given to a
70
+ function-like macro call which applies `##' operator to the empty
71
+ perameter.
72
+
73
+ Thu Sep 20 19:07:54 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
74
+
75
+ * lib/adlint/cpp/macro.rb : Fix bad preprocess behavior when an empty
76
+ argument is given to a function-like macro call which applies `##'
77
+ operator to the empty perameter.
78
+
79
+ Thu Sep 20 11:22:17 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
80
+
81
+ * lib/adlint/exam/c_builtin/c_check.rb : Fix W0100 detection not to
82
+ over-warn about variables updated in an iteration-statement.
83
+
84
+ Wed Sep 19 17:13:01 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
85
+
86
+ * release.rc : 2.3.0
87
+ - Fix evaluation of sizeof expression to return `size_t' value or
88
+ `unsigned long' value if size_t is not declared.
89
+ - Fix evaluation of function-definition in order to refer symbols of
90
+ return type and parameter types.
91
+ - Revise format of the traits file in preparation for supporting
92
+ warning suppression of 3rd-party headers imported in the target
93
+ project tree.
94
+ - Support compound pathname as an entry in the directory pathname
95
+ list item of the traits file.
96
+ - Fix abend problem when no examination package name is specified in
97
+ the traits file.
98
+
99
+ Wed Sep 19 15:41:38 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
100
+
101
+ * share/doc/users_guide_ja.texi : Update descriptions about revised
102
+ traits file format.
103
+ * share/doc/users_guide_en.texi : Ditto.
104
+
105
+ Wed Sep 19 14:19:24 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
106
+
107
+ * lib/adlint/util.rb : Fix abend problem when no examination package
108
+ name is specified in the traits file.
109
+
110
+ Wed Sep 19 14:00:03 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
111
+
112
+ * lib/adlint/traits.rb : Support compound pathname as an entry in the
113
+ directory pathname list item of the traits file.
114
+
115
+ Wed Sep 19 13:26:48 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
116
+
117
+ * lib/adlint/traits.rb : Revise format of the traits file in
118
+ preparation for supporting warning suppression of 3rd-party headers
119
+ imported in the target project tree.
120
+ * etc/conf.d/**/traits.erb : Ditto.
121
+ * spec/conf.d/default_traits.yml : Ditto.
122
+ * features/support/env.rb : Ditto.
123
+
124
+ * bin/adlintize : Add ad-hoc traits schema migration for 2.4.0 release.
125
+
126
+ Tue Sep 18 16:06:40 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
127
+
128
+ * features/code_check/W9003.feature : Add W9003 specification to
129
+ reproduce a known bug.
130
+
131
+ * features/code_check/W0070.feature : Add W0070 specification.
132
+ * features/code_check/W0071.feature : Add W0071 specification.
133
+ * MANIFEST : Add W0070 and W0071 specifications.
134
+
135
+ * lib/adlint/c/expr.rb : Fix evaluation of sizeof expression to return
136
+ `size_t' value or `unsigned long' value if size_t is not declared.
137
+
138
+ * lib/adlint/c/interp.rb : Fix evaluation of function-definition in
139
+ order to refer symbols of return type and parameter types.
140
+
141
+ Tue Sep 18 13:45:50 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
142
+
143
+ * release.rc : 2.2.5
144
+ - Fix W0425 detection not to warn about one-liner typedef declaration
145
+ with struct or union type declaration redundantly.
146
+
147
+ Tue Sep 18 13:38:22 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
148
+
149
+ * features/code_check/W0425.feature : Add W0425 specification to
150
+ reproduce a known bug.
151
+
152
+ * lib/adlint/exam/c_builtin/c_check.rb : Fix W0425 detection not to
153
+ warn about one-liner typedef declaration with struct or union type
154
+ declaration redundantly.
155
+
156
+ Fri Sep 14 14:05:38 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
157
+
158
+ * release.rc : 2.2.3
159
+ - Fix W0425 detection to warn about one-liner struct or union member
160
+ declarations.
161
+
162
+ Fri Sep 14 13:43:23 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
163
+
164
+ * features/code_check/W0425.feature : Add W0425 specification to
165
+ reproduce a known bug.
166
+
167
+ * lib/adlint/exam/c_builtin/c_check.rb : Fix W0425 detection to warn
168
+ about one-liner struct or union member declarations.
169
+
170
+ Thu Sep 13 17:53:53 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
171
+
172
+ * release.rc : 2.2.1
173
+ - Fix W0425 detection not to warn when a selection-statement or a
174
+ iteration-statement is written in a line.
175
+
176
+ Thu Sep 13 13:32:44 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
177
+
178
+ * features/code_check/W0425.feature : Add W0425 specification.
179
+ * MANIFEST : Ditto.
180
+
181
+ * lib/adlint/exam/c_builtin/c_check.rb : Fix W0425 detection not to
182
+ warn when a selection-statement or a iteration-statement is written
183
+ in a line.
184
+
1
185
  Wed Sep 12 10:59:42 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
2
186
 
3
187
  * release.ga : 2.2.0
@@ -3791,6 +3975,6 @@ Wed Apr 13 10:09:52 2011 Yutaka Yanoh <yanoh@users.sourceforge.net>
3791
3975
  * release.alpha : 0.1.0
3792
3976
  - This is the initial alpha release for system tests.
3793
3977
  - Implement `single module analysis' and `cross module analysis'.
3794
- - Implement 456 kinds of warning detections.
3978
+ - Implement 456 kinds of code checkings.
3795
3979
  - Implement 14 kinds of code structure extractions.
3796
3980
  - Implement 15 kinds of code quality metric measurements.
data/MANIFEST CHANGED
@@ -43,6 +43,8 @@ features/code_check/W0016.feature
43
43
  features/code_check/W0017.feature
44
44
  features/code_check/W0025.feature
45
45
  features/code_check/W0026.feature
46
+ features/code_check/W0070.feature
47
+ features/code_check/W0071.feature
46
48
  features/code_check/W0093.feature
47
49
  features/code_check/W0104.feature
48
50
  features/code_check/W0109.feature
@@ -182,6 +184,7 @@ features/code_check/W0251.feature
182
184
  features/code_check/W0252.feature
183
185
  features/code_check/W0253.feature
184
186
  features/code_check/W0254.feature
187
+ features/code_check/W0425.feature
185
188
  features/code_check/W0431.feature
186
189
  features/code_check/W0432.feature
187
190
  features/code_check/W0477.feature
data/NEWS CHANGED
@@ -21,6 +21,33 @@
21
21
 
22
22
  ++
23
23
 
24
+ === \AdLint 2.4.0 is released (2012-09-21)
25
+
26
+ ==== Changes since the 2.2.0 release
27
+
28
+ * Fix W0425 detection not to warn when a selection-statement or a
29
+ iteration-statement is written in a line
30
+ * Fix evaluation of sizeof expression to return `size_t' value or `unsigned
31
+ long' value if size_t is not declared
32
+ * Fix evaluation of function-definition in order to refer symbols of return
33
+ type and parameter types
34
+ * Revise format of the traits file in preparation for supporting warning
35
+ suppression of 3rd-party headers imported in the target project tree
36
+ * Support compound pathname as an entry in the directory pathname list item of
37
+ the traits file
38
+ * Fix abend problem when no examination package name is specified in the traits
39
+ file
40
+ * Fix W0100 detection not to over-warn about variables updated in an
41
+ iteration-statement
42
+ * Fix bad preprocess behavior when an empty argument is given to a
43
+ function-like macro call which applies `##' operator to the empty perameter
44
+ * Fix #include directive evaluation in order to correctly read header file with
45
+ an absolute path when any include_path items are not specified
46
+
47
+ See the file
48
+ {ChangeLog}[http://adlint.sourceforge.net/pmwiki/upload.d/Main/ChangeLog]
49
+ for more details.
50
+
24
51
  === \AdLint 2.2.0 is released (2012-09-12)
25
52
 
26
53
  ==== Changes since the 2.0.10 release
@@ -32,10 +59,6 @@
32
59
  scope
33
60
  * Clarify W0025 and W0026 message texts
34
61
 
35
- See the file
36
- {ChangeLog}[http://adlint.sourceforge.net/pmwiki/upload.d/Main/ChangeLog]
37
- for more details.
38
-
39
62
  === \AdLint 2.0.10 is released (2012-09-06)
40
63
 
41
64
  ==== Changes since the 2.0.6 release
@@ -401,6 +424,6 @@ This is the initial GA release of \AdLint.
401
424
 
402
425
  * Single module analysis
403
426
  * Cross module analysis
404
- * 597 kinds of warning detections
427
+ * 597 kinds of code checkings
405
428
  * 14 kinds of code structure extractions
406
429
  * 15 kinds of quality metric measurements
data/bin/adlintize CHANGED
@@ -87,24 +87,34 @@ def print_environments
87
87
  end
88
88
  end
89
89
 
90
- # TODO: Refine this ad-hoc schema migration.
91
90
  def migrate_traits_schema(traits_fpath)
92
91
  unless traits_fpath.exist? && traits_fpath.file?
93
92
  $stderr.puts "#{File.basename(__FILE__)} : no such traits file"
94
93
  exit 1
95
94
  end
96
95
 
96
+ backup_traits_file(traits_fpath, %w(.orig .old .mig))
97
97
  contents = File.open(traits_fpath, "r:utf-8") { |io| io.read }
98
- return unless contents =~ /^version: "1\.0\.0"$/
99
98
 
100
- backup_traits_file(traits_fpath, %w(.orig .old .mig))
99
+ case contents
100
+ when /^version: "1\.0\.0"$/
101
+ migrate_traits_schema_from_1_0_0(traits_fpath, contents)
102
+ when /^version: "2\.0\.0"$/
103
+ migrate_traits_schema_from_2_0_0(traits_fpath, contents)
104
+ else
105
+ $stderr.puts "nothing to be done"
106
+ end
107
+ end
108
+
109
+ # TODO: Refine this ad-hoc schema migration.
110
+ def migrate_traits_schema_from_1_0_0(traits_fpath, contents)
101
111
  File.open(traits_fpath, "w:utf-8") do |io|
102
112
  io.puts "# Traits file migrated by adlintize #{AdLint::SHORT_VERSION}.", ""
103
113
  change_list = []
104
114
  contents.lines.map { |str| str.chomp }.each do |line|
105
115
  case line
106
116
  when /\Aversion:/
107
- io.puts "version: \"2.0.0\"", ""
117
+ io.puts "version: \"2.4.0\"", ""
108
118
  io.puts <<EOS
109
119
  # List of names of source code examination packages.
110
120
  #
@@ -113,6 +123,13 @@ def migrate_traits_schema(traits_fpath)
113
123
  # list to specify which examination packages are to be run.
114
124
  exam_packages:
115
125
  - "c_builtin"
126
+ EOS
127
+ when /\Aproject_traits:/
128
+ io.puts <<EOS
129
+ project_traits:
130
+
131
+ # Project root directory.
132
+ project_root: "#{vpath_from_traits_fpath(traits_fpath)}"
116
133
  EOS
117
134
  when /\Amessage_traits:/
118
135
  io.puts <<EOS
@@ -121,9 +138,15 @@ message_traits:
121
138
  # Output messages with category and severity information?
122
139
  message_with_class: false
123
140
 
124
- # Warn only files in the specified directory. If omitted, all files (such as
125
- # system headers or 3rd-party library headers) will be warned.
126
- warn_only_files_in:
141
+ # Warn only files in the specified directory.
142
+ # If omitted, all files including system headers will be warned.
143
+ warn_files_in:
144
+ - "#{vpath_from_traits_fpath(traits_fpath)}"
145
+
146
+ # Don't warn files in the specified directory.
147
+ # You can specify 3rd-party library header directories imported in the
148
+ # project to suppress warnings about unconcerned headers.
149
+ warn_files_not_in:
127
150
 
128
151
  # Enable translation-unit specific code check selection?
129
152
  individual_selection: true
@@ -194,6 +217,46 @@ EOS
194
217
  end
195
218
  end
196
219
 
220
+ # TODO: Refine this ad-hoc schema migration.
221
+ def migrate_traits_schema_from_2_0_0(traits_fpath, contents)
222
+ File.open(traits_fpath, "w:utf-8") do |io|
223
+ io.puts "# Traits file migrated by adlintize #{AdLint::SHORT_VERSION}.", ""
224
+ contents.lines.map { |str| str.chomp }.each do |line|
225
+ case line
226
+ when /\Aversion:/
227
+ io.puts "version: \"2.4.0\"", ""
228
+ when /\Aproject_traits:/
229
+ io.puts <<EOS
230
+ project_traits:
231
+
232
+ # Project root directory.
233
+ project_root: "#{vpath_from_traits_fpath(traits_fpath)}"
234
+ EOS
235
+ when /\A (warn_only_files_in:.*)\z/
236
+ io.puts " # #{$1} is obsolete"
237
+ io.puts
238
+ io.puts <<EOS
239
+ # Warn only files in the specified directory.
240
+ # If omitted, all files including system headers will be warned.
241
+ warn_files_in:
242
+ - "#{vpath_from_traits_fpath(traits_fpath)}"
243
+
244
+ # Don't warn files in the specified directory.
245
+ # You can specify 3rd-party library header directories imported in the
246
+ # project to suppress warnings about unconcerned headers.
247
+ warn_files_not_in:
248
+ EOS
249
+ else
250
+ io.puts line
251
+ end
252
+ end
253
+ end
254
+ end
255
+
256
+ def vpath_from_traits_fpath(traits_fpath)
257
+ Pathname.pwd.relative_path_from(Pathname.new(traits_fpath.dirname).realpath)
258
+ end
259
+
197
260
  def backup_traits_file(traits_fpath, suffixes)
198
261
  suffixes.each do |suffix|
199
262
  backup_fpath = Pathname.new("#{traits_fpath}#{suffix}")
@@ -26,6 +26,9 @@ project_traits:
26
26
  # Project name.
27
27
  project_name: "<%= project_name %>"
28
28
 
29
+ # Project root directory.
30
+ project_root: "<%= vpath %>"
31
+
29
32
  # Project specific additional include paths.
30
33
  # Ex.
31
34
  # include_path:
@@ -220,9 +223,15 @@ message_traits:
220
223
  # Output messages with category and severity information?
221
224
  message_with_class: false
222
225
 
223
- # Warn only files in the specified directory. If omitted, all files (such as
224
- # system headers or 3rd-party library headers) will be warned.
225
- warn_only_files_in: "<%= vpath %>"
226
+ # Warn only files in the specified directory.
227
+ # If omitted, all files including system headers will be warned.
228
+ warn_files_in:
229
+ - "<%= vpath %>"
230
+
231
+ # Don't warn files in the specified directory.
232
+ # You can specify 3rd-party library header directories imported in the
233
+ # project to suppress warnings about unconcerned headers.
234
+ warn_files_not_in:
226
235
 
227
236
  # Enable translation-unit specific code check selection?
228
237
  individual_selection: true
@@ -26,6 +26,9 @@ project_traits:
26
26
  # Project name.
27
27
  project_name: "<%= project_name %>"
28
28
 
29
+ # Project root directory.
30
+ project_root: "<%= vpath %>"
31
+
29
32
  # Project specific additional include paths.
30
33
  # Ex.
31
34
  # include_path:
@@ -231,9 +234,15 @@ message_traits:
231
234
  # Output messages with category and severity information?
232
235
  message_with_class: false
233
236
 
234
- # Warn only files in the specified directory. If omitted, all files (such as
235
- # system headers or 3rd-party library headers) will be warned.
236
- warn_only_files_in: "<%= vpath %>"
237
+ # Warn only files in the specified directory.
238
+ # If omitted, all files including system headers will be warned.
239
+ warn_files_in:
240
+ - "<%= vpath %>"
241
+
242
+ # Don't warn files in the specified directory.
243
+ # You can specify 3rd-party library header directories imported in the
244
+ # project to suppress warnings about unconcerned headers.
245
+ warn_files_not_in:
237
246
 
238
247
  # Enable translation-unit specific code check selection?
239
248
  individual_selection: true
@@ -26,6 +26,9 @@ project_traits:
26
26
  # Project name.
27
27
  project_name: "<%= project_name %>"
28
28
 
29
+ # Project root directory.
30
+ project_root: "<%= vpath %>"
31
+
29
32
  # Project specific additional include paths.
30
33
  # Ex.
31
34
  # include_path:
@@ -230,9 +233,15 @@ message_traits:
230
233
  # Output messages with category and severity information?
231
234
  message_with_class: false
232
235
 
233
- # Warn only files in the specified directory. If omitted, all files (such as
234
- # system headers or 3rd-party library headers) will be warned.
235
- warn_only_files_in: "<%= vpath %>"
236
+ # Warn only files in the specified directory.
237
+ # If omitted, all files including system headers will be warned.
238
+ warn_files_in:
239
+ - "<%= vpath %>"
240
+
241
+ # Don't warn files in the specified directory.
242
+ # You can specify 3rd-party library header directories imported in the
243
+ # project to suppress warnings about unconcerned headers.
244
+ warn_files_not_in:
236
245
 
237
246
  # Enable translation-unit specific code check selection?
238
247
  individual_selection: true
@@ -26,6 +26,9 @@ project_traits:
26
26
  # Project name.
27
27
  project_name: "<%= project_name %>"
28
28
 
29
+ # Project root directory.
30
+ project_root: "<%= vpath %>"
31
+
29
32
  # Project specific additional include paths.
30
33
  # Ex.
31
34
  # include_path:
@@ -228,9 +231,15 @@ message_traits:
228
231
  # Output messages with category and severity information?
229
232
  message_with_class: false
230
233
 
231
- # Warn only files in the specified directory. If omitted, all files (such as
232
- # system headers or 3rd-party library headers) will be warned.
233
- warn_only_files_in: "<%= vpath %>"
234
+ # Warn only files in the specified directory.
235
+ # If omitted, all files including system headers will be warned.
236
+ warn_files_in:
237
+ - "<%= vpath %>"
238
+
239
+ # Don't warn files in the specified directory.
240
+ # You can specify 3rd-party library header directories imported in the
241
+ # project to suppress warnings about unconcerned headers.
242
+ warn_files_not_in:
234
243
 
235
244
  # Enable translation-unit specific code check selection?
236
245
  individual_selection: true
@@ -26,6 +26,9 @@ project_traits:
26
26
  # Project name.
27
27
  project_name: "<%= project_name %>"
28
28
 
29
+ # Project root directory.
30
+ project_root: "<%= vpath %>"
31
+
29
32
  # Project specific additional include paths.
30
33
  # Ex.
31
34
  # include_path:
@@ -230,9 +233,15 @@ message_traits:
230
233
  # Output messages with category and severity information?
231
234
  message_with_class: false
232
235
 
233
- # Warn only files in the specified directory. If omitted, all files (such as
234
- # system headers or 3rd-party library headers) will be warned.
235
- warn_only_files_in: "<%= vpath %>"
236
+ # Warn only files in the specified directory.
237
+ # If omitted, all files including system headers will be warned.
238
+ warn_files_in:
239
+ - "<%= vpath %>"
240
+
241
+ # Don't warn files in the specified directory.
242
+ # You can specify 3rd-party library header directories imported in the
243
+ # project to suppress warnings about unconcerned headers.
244
+ warn_files_not_in:
236
245
 
237
246
  # Enable translation-unit specific code check selection?
238
247
  individual_selection: true
@@ -26,6 +26,9 @@ project_traits:
26
26
  # Project name.
27
27
  project_name: "<%= project_name %>"
28
28
 
29
+ # Project root directory.
30
+ project_root: "<%= vpath %>"
31
+
29
32
  # Project specific additional include paths.
30
33
  # Ex.
31
34
  # include_path:
@@ -234,9 +237,15 @@ message_traits:
234
237
  # Output messages with category and severity information?
235
238
  message_with_class: false
236
239
 
237
- # Warn only files in the specified directory. If omitted, all files (such as
238
- # system headers or 3rd-party library headers) will be warned.
239
- warn_only_files_in: "<%= vpath %>"
240
+ # Warn only files in the specified directory.
241
+ # If omitted, all files including system headers will be warned.
242
+ warn_files_in:
243
+ - "<%= vpath %>"
244
+
245
+ # Don't warn files in the specified directory.
246
+ # You can specify 3rd-party library header directories imported in the
247
+ # project to suppress warnings about unconcerned headers.
248
+ warn_files_not_in:
240
249
 
241
250
  # Enable translation-unit specific code check selection?
242
251
  individual_selection: true
@@ -281,4 +290,3 @@ message_traits:
281
290
  # - "ERR:X99"
282
291
  # format: "Your custom message for the warning of E9999."
283
292
  change_list:
284
-
@@ -49,7 +49,7 @@
49
49
  # - "ERR:X99"
50
50
  # format: "Your custom message for the error of E9999."
51
51
 
52
- version: "2.2.0"
52
+ version: "2.4.0"
53
53
 
54
54
  message_definition:
55
55
  W0001:
@@ -49,7 +49,7 @@
49
49
  # - "ERR:X99"
50
50
  # format: "Your custom message for the error of E9999."
51
51
 
52
- version: "2.2.0"
52
+ version: "2.4.0"
53
53
 
54
54
  message_definition:
55
55
  W0001:
@@ -49,7 +49,7 @@
49
49
  # - "ERR:X99"
50
50
  # format: "Your custom message for the error of E9999."
51
51
 
52
- version: "2.2.0"
52
+ version: "2.4.0"
53
53
 
54
54
  message_definition:
55
55
  X0001:
@@ -49,7 +49,7 @@
49
49
  # - "ERR:X99"
50
50
  # format: "Your custom message for the error of E9999."
51
51
 
52
- version: "2.2.0"
52
+ version: "2.4.0"
53
53
 
54
54
  message_definition:
55
55
  X0001:
@@ -0,0 +1,51 @@
1
+ Feature: W0070
2
+
3
+ W0070 detects that contents of a header included by #include <...> directive
4
+ are not referred by other files in a translation-unit.
5
+
6
+ Scenario: a typedef in the header and no reference to it
7
+ Given a target source named "fixture.c" with:
8
+ """
9
+ #include <test.h> /* W0070 */
10
+
11
+ int bar(void) { return 0; }
12
+ """
13
+ And a target source named "test.h" with:
14
+ """
15
+ #if !defined(TEST_H)
16
+ #define TEST_H
17
+
18
+ typedef int foo;
19
+
20
+ #endif
21
+ """
22
+ When I successfully run `adlint fixture.c` on noarch
23
+ Then the output should exactly match with:
24
+ | mesg | line | column |
25
+ | W0117 | 3 | 5 |
26
+ | W0070 | 1 | 1 |
27
+ | W0628 | 3 | 5 |
28
+
29
+ Scenario: a typedef in the header and reference to it in other file.
30
+ Given a target source named "fixture.c" with:
31
+ """
32
+ #include <test.h> /* OK */
33
+
34
+ foo bar(void) { return 0; }
35
+ """
36
+ And a target source named "test.h" with:
37
+ """
38
+ #if !defined(TEST_H)
39
+ #define TEST_H
40
+
41
+ typedef int foo;
42
+
43
+ #endif
44
+ """
45
+ When I successfully run `adlint fixture.c` on noarch
46
+ Then the output should exactly match with:
47
+ | mesg | line | column |
48
+ | W0117 | 3 | 5 |
49
+ | W0628 | 3 | 5 |
50
+
51
+ # vim:ts=2:sw=2:sts=2:et: