adlint 2.6.12 → 2.6.14

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 (77) hide show
  1. data/ChangeLog +77 -0
  2. data/NEWS +17 -4
  3. data/bin/adlint +24 -30
  4. data/bin/adlint_chk +22 -28
  5. data/bin/adlint_cma +20 -26
  6. data/bin/adlint_sma +22 -28
  7. data/bin/adlintize +60 -58
  8. data/etc/mesg.d/c_builtin/en_US/messages.yml +168 -168
  9. data/etc/mesg.d/c_builtin/ja_JP/messages.yml +168 -168
  10. data/etc/mesg.d/core/en_US/messages.yml +1 -1
  11. data/etc/mesg.d/core/ja_JP/messages.yml +1 -1
  12. data/features/code_check/W0119.feature +0 -5
  13. data/features/code_check/W0120.feature +1 -0
  14. data/features/code_check/W0121.feature +0 -5
  15. data/features/code_check/W0123.feature +0 -5
  16. data/features/code_check/W0125.feature +0 -5
  17. data/features/code_check/W0127.feature +0 -5
  18. data/features/code_check/W0128.feature +0 -5
  19. data/features/code_check/W0129.feature +0 -5
  20. data/features/code_check/W0130.feature +0 -5
  21. data/features/code_check/W0132.feature +1 -0
  22. data/features/code_check/W0133.feature +0 -5
  23. data/features/code_check/W0134.feature +0 -5
  24. data/features/code_check/W0135.feature +0 -5
  25. data/features/code_check/W0136.feature +0 -5
  26. data/features/code_check/W0137.feature +0 -5
  27. data/features/code_check/W0138.feature +0 -5
  28. data/features/code_check/W0139.feature +0 -5
  29. data/features/code_check/W0140.feature +0 -5
  30. data/features/code_check/W0141.feature +0 -5
  31. data/features/code_check/W0142.feature +0 -5
  32. data/features/code_check/W0157.feature +0 -5
  33. data/features/code_check/W0161.feature +0 -5
  34. data/features/code_check/W0165.feature +0 -5
  35. data/features/code_check/W0169.feature +0 -5
  36. data/features/code_check/W0177.feature +0 -5
  37. data/features/code_check/W0182.feature +0 -5
  38. data/features/code_check/W0183.feature +0 -5
  39. data/features/code_check/W0184.feature +0 -5
  40. data/features/code_check/W0212.feature +0 -5
  41. data/features/code_check/W0214.feature +0 -5
  42. data/features/code_check/W0221.feature +0 -5
  43. data/features/code_check/W0223.feature +0 -5
  44. data/features/code_check/W0230.feature +0 -5
  45. data/features/code_check/W0232.feature +0 -5
  46. data/features/code_check/W0245.feature +0 -5
  47. data/features/code_check/W0246.feature +0 -5
  48. data/features/code_check/W0247.feature +0 -5
  49. data/features/code_check/W0251.feature +0 -5
  50. data/features/code_check/W0650.feature +0 -4
  51. data/features/code_check/W0703.feature +5 -1
  52. data/features/code_check/W0719.feature +0 -10
  53. data/features/code_check/W0748.feature +0 -5
  54. data/features/code_check/W0751.feature +0 -5
  55. data/features/code_check/W0756.feature +0 -5
  56. data/features/code_check/W0763.feature +0 -5
  57. data/features/code_check/W0787.feature +7 -0
  58. data/features/code_check/W0794.feature +0 -1
  59. data/features/code_check/W1052.feature +0 -2
  60. data/features/support/env.rb +2 -7
  61. data/lib/adlint/c/syntax.rb +10 -16
  62. data/lib/adlint/cpp/macro.rb +96 -0
  63. data/lib/adlint/exam/c_builtin/c_check.rb +954 -817
  64. data/lib/adlint/exam/c_builtin/c_check_shima.rb +17 -19
  65. data/lib/adlint/exam/c_builtin/ld_check.rb +86 -44
  66. data/lib/adlint/message.rb +1 -1
  67. data/lib/adlint/util.rb +8 -8
  68. data/lib/adlint/version.rb +2 -2
  69. data/lib/adlint.rb +8 -0
  70. data/share/doc/developers_guide_ja.html +3 -3
  71. data/share/doc/developers_guide_ja.texi +1 -1
  72. data/share/doc/users_guide_en.html +5055 -5053
  73. data/share/doc/users_guide_en.texi +3817 -3818
  74. data/share/doc/users_guide_ja.html +3787 -3786
  75. data/share/doc/users_guide_ja.texi +3784 -3783
  76. data/spec/spec_helper.rb +3 -11
  77. metadata +2 -2
data/bin/adlintize CHANGED
@@ -31,20 +31,12 @@
31
31
  #
32
32
  #++
33
33
 
34
- require "pathname"
35
-
36
- $bindir = Pathname.new(__FILE__).realpath.dirname
37
- $prefix = Pathname.new("..").expand_path($bindir)
38
- $libdir = Pathname.new("lib").expand_path($prefix)
39
- $etcdir = Pathname.new("etc").expand_path($prefix)
40
-
41
- $:.unshift($libdir.to_s)
42
-
34
+ $LOAD_PATH.unshift(File.expand_path("../lib", File.dirname(__FILE__)))
43
35
  require "adlint"
44
36
 
45
- $version = "AdLint project generator #{AdLint::VERSION}"
37
+ version = "AdLint project generator #{AdLint::VERSION}"
46
38
 
47
- $usage = <<EOS
39
+ usage = <<EOS
48
40
  Usage: adlintize [options] [project-name]
49
41
  Options:
50
42
  -t FILE, --traits FILE Write traits to FILE
@@ -74,13 +66,15 @@ Options:
74
66
  EOS
75
67
 
76
68
  def print_environments
77
- Dir.entries(Pathname.new("conf.d").expand_path($etcdir)).each do |dirent|
69
+ conf_dpath = Pathname.new("conf.d").expand_path(AdLint::Config[:etcdir])
70
+ Dir.entries(conf_dpath).each do |dirent|
78
71
  case dirent
79
72
  when ".", "..", "fallback", "noarch"
80
73
  next
81
74
  end
82
75
 
83
- Dir.glob("#{$etcdir}/conf.d/#{dirent}/traits-*.erb").each do |traits_fpath|
76
+ traits_pattern = "#{AdLint::Config[:etcdir]}/conf.d/#{dirent}/traits-*.erb"
77
+ Dir.glob(traits_pattern).each do |traits_fpath|
84
78
  basename = File.basename(traits_fpath, ".erb")
85
79
  puts "#{dirent}-#{basename.sub(/\Atraits-/, "")}"
86
80
  end
@@ -269,33 +263,35 @@ end
269
263
 
270
264
  require "getoptlong"
271
265
 
272
- parser = GetoptLong.new(["--traits", "-t", GetoptLong::REQUIRED_ARGUMENT],
273
- ["--pinit-hdr", "-p", GetoptLong::REQUIRED_ARGUMENT],
274
- ["--cinit-hdr", "-c", GetoptLong::REQUIRED_ARGUMENT],
275
- ["--list-file", "-l", GetoptLong::REQUIRED_ARGUMENT],
276
- ["--makefile", "-m", GetoptLong::REQUIRED_ARGUMENT],
277
- ["--sh-script", "-s", GetoptLong::REQUIRED_ARGUMENT],
278
- ["--bat-file", "-b", GetoptLong::REQUIRED_ARGUMENT],
279
- ["--output-dir", "-o", GetoptLong::REQUIRED_ARGUMENT],
280
- ["--environment", "-e", GetoptLong::REQUIRED_ARGUMENT],
281
- ["--list-environment", "-L", GetoptLong::NO_ARGUMENT],
282
- ["--force", "-f", GetoptLong::NO_ARGUMENT],
283
- ["--version", GetoptLong::NO_ARGUMENT],
284
- ["--copyright", GetoptLong::NO_ARGUMENT],
285
- ["--prefix", GetoptLong::NO_ARGUMENT],
286
- ["--migrate", GetoptLong::REQUIRED_ARGUMENT],
287
- ["--help", "-h", GetoptLong::NO_ARGUMENT])
266
+ parser = GetoptLong.new(
267
+ ["--traits", "-t", GetoptLong::REQUIRED_ARGUMENT],
268
+ ["--pinit-hdr", "-p", GetoptLong::REQUIRED_ARGUMENT],
269
+ ["--cinit-hdr", "-c", GetoptLong::REQUIRED_ARGUMENT],
270
+ ["--list-file", "-l", GetoptLong::REQUIRED_ARGUMENT],
271
+ ["--makefile", "-m", GetoptLong::REQUIRED_ARGUMENT],
272
+ ["--sh-script", "-s", GetoptLong::REQUIRED_ARGUMENT],
273
+ ["--bat-file", "-b", GetoptLong::REQUIRED_ARGUMENT],
274
+ ["--output-dir", "-o", GetoptLong::REQUIRED_ARGUMENT],
275
+ ["--environment", "-e", GetoptLong::REQUIRED_ARGUMENT],
276
+ ["--list-environment", "-L", GetoptLong::NO_ARGUMENT],
277
+ ["--force", "-f", GetoptLong::NO_ARGUMENT],
278
+ ["--version", GetoptLong::NO_ARGUMENT],
279
+ ["--copyright", GetoptLong::NO_ARGUMENT],
280
+ ["--prefix", GetoptLong::NO_ARGUMENT],
281
+ ["--migrate", GetoptLong::REQUIRED_ARGUMENT],
282
+ ["--help", "-h", GetoptLong::NO_ARGUMENT]
283
+ )
288
284
 
289
285
  begin
290
- traits_fpath = Pathname.new("adlint_traits.yml")
291
- pinit_fpath = Pathname.new("adlint_pinit.h")
292
- cinit_fpath = Pathname.new("adlint_cinit.h")
293
- list_fpath = Pathname.new("adlint_files.txt")
294
- make_fpath = Pathname.new("GNUmakefile")
295
- sh_fpath = Pathname.new("adlint_all.sh")
296
- bat_fpath = Pathname.new("adlint_all.bat")
297
- output_dpath = Pathname.new(".")
298
- environment = nil
286
+ traits_fpath = Pathname.new("adlint_traits.yml")
287
+ pinit_fpath = Pathname.new("adlint_pinit.h")
288
+ cinit_fpath = Pathname.new("adlint_cinit.h")
289
+ list_fpath = Pathname.new("adlint_files.txt")
290
+ make_fpath = Pathname.new("GNUmakefile")
291
+ sh_fpath = Pathname.new("adlint_all.sh")
292
+ bat_fpath = Pathname.new("adlint_all.bat")
293
+ output_dpath = Pathname.new(".")
294
+ environment = nil
299
295
  force_overwrite = false
300
296
 
301
297
  parser.each do |option, value|
@@ -324,24 +320,24 @@ begin
324
320
  when "--force"
325
321
  force_overwrite = true
326
322
  when "--version"
327
- puts $version, AdLint::AUTHOR
323
+ puts version, AdLint::AUTHOR
328
324
  exit 0
329
325
  when "--copyright"
330
326
  puts AdLint::COPYRIGHT
331
327
  exit 0
332
328
  when "--prefix"
333
- puts $prefix
329
+ puts AdLint::Config[:prefix]
334
330
  exit 0
335
331
  when "--migrate"
336
332
  migrate_traits_schema(Pathname.new(value))
337
333
  exit 0
338
334
  when "--help"
339
- puts $usage
335
+ puts usage
340
336
  exit 0
341
337
  end
342
338
  end
343
339
  rescue
344
- $stderr.puts $usage
340
+ $stderr.puts usage
345
341
  exit 1
346
342
  end
347
343
 
@@ -351,38 +347,44 @@ FileUtils.mkdir_p(output_dpath) unless Dir.exist?(output_dpath)
351
347
  vpath = Pathname.pwd.relative_path_from(Pathname.new(output_dpath).realpath)
352
348
 
353
349
  traits_fpath = traits_fpath.expand_path(output_dpath)
354
- pinit_fpath = pinit_fpath.expand_path(output_dpath)
355
- cinit_fpath = cinit_fpath.expand_path(output_dpath)
356
- list_fpath = list_fpath.expand_path(output_dpath)
357
- make_fpath = make_fpath.expand_path(output_dpath)
358
- sh_fpath = sh_fpath.expand_path(output_dpath)
359
- bat_fpath = bat_fpath.expand_path(output_dpath)
350
+ pinit_fpath = pinit_fpath.expand_path(output_dpath)
351
+ cinit_fpath = cinit_fpath.expand_path(output_dpath)
352
+ list_fpath = list_fpath.expand_path(output_dpath)
353
+ make_fpath = make_fpath.expand_path(output_dpath)
354
+ sh_fpath = sh_fpath.expand_path(output_dpath)
355
+ bat_fpath = bat_fpath.expand_path(output_dpath)
360
356
 
361
357
  if environment
362
358
  arch, os, compiler = environment.split("-")
363
359
 
364
- cinit_templ_fpath =
365
- Pathname.new("#{$etcdir}/conf.d/#{arch}-#{os}/cinit-#{compiler}.erb")
360
+ cinit_templ_fpath = Pathname.new(
361
+ "#{AdLint::Config[:etcdir]}/conf.d/#{arch}-#{os}/cinit-#{compiler}.erb")
366
362
  unless File.readable?(cinit_templ_fpath)
367
363
  $stderr.puts "#{File.basename(__FILE__)}: no such preset build environment"
368
364
  exit 1
369
365
  end
370
366
 
371
- traits_templ_fpath =
372
- Pathname.new("#{$etcdir}/conf.d/#{arch}-#{os}/traits-#{compiler}.erb")
367
+ traits_templ_fpath = Pathname.new(
368
+ "#{AdLint::Config[:etcdir]}/conf.d/#{arch}-#{os}/traits-#{compiler}.erb")
373
369
  unless File.readable?(traits_templ_fpath)
374
370
  $stderr.puts "#{File.basename(__FILE__)}: no such preset build environment"
375
371
  exit 1
376
372
  end
377
373
  else
378
- cinit_templ_fpath = Pathname.new("#{$etcdir}/conf.d/fallback/cinit.erb")
379
- traits_templ_fpath = Pathname.new("#{$etcdir}/conf.d/fallback/traits.erb")
374
+ cinit_templ_fpath = Pathname.new(
375
+ "#{AdLint::Config[:etcdir]}/conf.d/fallback/cinit.erb")
376
+ traits_templ_fpath = Pathname.new(
377
+ "#{AdLint::Config[:etcdir]}/conf.d/fallback/traits.erb")
380
378
  end
381
379
 
382
- pinit_templ_fpath = Pathname.new("#{$etcdir}/conf.d/noarch/pinit.erb")
383
- make_templ_fpath = Pathname.new("#{$etcdir}/conf.d/noarch/GNUmakefile.erb")
384
- sh_templ_fpath = Pathname.new("#{$etcdir}/conf.d/noarch/adlint_all_sh.erb")
385
- bat_templ_fpath = Pathname.new("#{$etcdir}/conf.d/noarch/adlint_all_bat.erb")
380
+ pinit_templ_fpath = Pathname.new(
381
+ "#{AdLint::Config[:etcdir]}/conf.d/noarch/pinit.erb")
382
+ make_templ_fpath = Pathname.new(
383
+ "#{AdLint::Config[:etcdir]}/conf.d/noarch/GNUmakefile.erb")
384
+ sh_templ_fpath = Pathname.new(
385
+ "#{AdLint::Config[:etcdir]}/conf.d/noarch/adlint_all_sh.erb")
386
+ bat_templ_fpath = Pathname.new(
387
+ "#{AdLint::Config[:etcdir]}/conf.d/noarch/adlint_all_bat.erb")
386
388
 
387
389
  require "erb"
388
390