adlint-exam-c_staging 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/AUTHORS CHANGED
@@ -3,7 +3,7 @@
3
3
  / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
4
4
  / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
5
5
  / __ |/ /_/ / /___/ / /| / / /
6
- /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
6
+ /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
7
7
 
8
8
  This file is part of AdLint.
9
9
 
data/ChangeLog CHANGED
@@ -1,3 +1,18 @@
1
+ Wed Mar 27 16:48:24 2013 Yutaka Yanoh <yanoh@users.sourceforge.net>
2
+
3
+ * release.ga : 0.3.0
4
+ - Correct to run with AdLint 3.0.0 or later.
5
+
6
+ Thu Jan 17 14:24:37 2013 Yutaka Yanoh <yanoh@users.sourceforge.net>
7
+
8
+ * release.rc : 0.2.1
9
+ - Correct to run with AdLint 2.7.4 or later.
10
+
11
+ Thu Jan 17 14:11:30 2013 Yutaka Yanoh <yanoh@users.sourceforge.net>
12
+
13
+ * lib/adlint/exam/c_staging/cpp_check.rb : Correct to run with AdLint
14
+ 2.7.4 or later.
15
+
1
16
  Fri Sep 21 16:48:06 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
2
17
 
3
18
  * release.ga : 0.2.0
data/INSTALL CHANGED
@@ -3,7 +3,7 @@
3
3
  / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
4
4
  / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
5
5
  / __ |/ /_/ / /___/ / /| / / /
6
- /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
6
+ /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
7
7
 
8
8
  This file is part of AdLint.
9
9
 
data/NEWS CHANGED
@@ -3,7 +3,7 @@
3
3
  / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
4
4
  / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
5
5
  / __ |/ /_/ / /___/ / /| / / /
6
- /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
6
+ /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
7
7
 
8
8
  This file is part of AdLint.
9
9
 
@@ -21,6 +21,10 @@
21
21
 
22
22
  ++
23
23
 
24
+ === adlint-exam-c_staging 0.3.0 is released (2013-03-27)
25
+
26
+ * Correct to run with AdLint 3.0.0 or later
27
+
24
28
  === adlint-exam-c_staging 0.2.0 is released (2012-09-21)
25
29
 
26
30
  ==== Including source code examination features
data/README CHANGED
@@ -3,7 +3,7 @@
3
3
  / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
4
4
  / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
5
5
  / __ |/ /_/ / /___/ / /| / / /
6
- /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
6
+ /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
7
7
 
8
8
  This file is part of AdLint.
9
9
 
@@ -36,7 +36,7 @@ for \AdLint.
36
36
 
37
37
  == License
38
38
 
39
- Copyright (C) 2010-2012, {OGIS-RI}[http://www.ogis-ri.co.jp/] Co.,Ltd.
39
+ Copyright (C) 2010-2013, {OGIS-RI}[http://www.ogis-ri.co.jp/] Co.,Ltd.
40
40
 
41
41
  \AdLint is free software: you can redistribute it and/or modify it under the
42
42
  terms of the GNU General Public License as published by the Free Software
data/Rakefile CHANGED
@@ -3,7 +3,7 @@
3
3
  # / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
4
4
  # / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
5
5
  # / __ |/ /_/ / /___/ / /| / / /
6
- # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
6
+ # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
7
7
  #
8
8
  # This file is part of AdLint.
9
9
  #
@@ -58,7 +58,7 @@ EOS
58
58
  s.extra_rdoc_files = %w(README)
59
59
  s.rdoc_options = ["--main", "README", "--charset", "utf-8"]
60
60
 
61
- s.add_dependency("adlint", ">= 2.3.0")
61
+ s.add_dependency("adlint", ">= 3.0.0")
62
62
  end
63
63
 
64
64
  Gem::PackageTask.new(gemspec) do |pkg|
data/TODO CHANGED
@@ -3,7 +3,7 @@
3
3
  / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
4
4
  / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
5
5
  / __ |/ /_/ / /___/ / /| / / /
6
- /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
6
+ /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
7
7
 
8
8
  This file is part of AdLint.
9
9
 
@@ -2,7 +2,7 @@
2
2
  # / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
3
3
  # / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
4
4
  # / __ |/ /_/ / /___/ / /| / / /
5
- # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
5
+ # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
6
6
  #
7
7
  # This file is part of AdLint.
8
8
  #
@@ -39,7 +39,7 @@
39
39
  # - "PRT:B20"
40
40
  # format: "Your custom message for the warning of W9999."
41
41
 
42
- version: "0.2.0"
42
+ version: "0.3.0"
43
43
 
44
44
  message_definition:
45
45
  W2001:
@@ -2,7 +2,7 @@
2
2
  # / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
3
3
  # / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
4
4
  # / __ |/ /_/ / /___/ / /| / / /
5
- # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
5
+ # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
6
6
  #
7
7
  # This file is part of AdLint.
8
8
  #
@@ -39,7 +39,7 @@
39
39
  # - "PRT:B20"
40
40
  # format: "Your custom message for the warning of W9999."
41
41
 
42
- version: "0.2.0"
42
+ version: "0.3.0"
43
43
 
44
44
  message_definition:
45
45
  W2001:
@@ -1,5 +1,5 @@
1
1
  NOARCH_TRAITS = <<EOF
2
- version: "2.4.0"
2
+ version: "3.0.0"
3
3
 
4
4
  exam_packages:
5
5
  - "c_staging"
@@ -7,8 +7,12 @@ exam_packages:
7
7
  project_traits:
8
8
  project_name: "features"
9
9
  project_root: "."
10
- include_path:
10
+ target_files:
11
+ inclusion_paths:
12
+ - "."
13
+ exclusion_paths:
11
14
  initial_header: "empty_pinit.h"
15
+ file_search_paths:
12
16
  coding_style:
13
17
  indent_style: "K&R"
14
18
  tab_width: 8
@@ -17,7 +21,9 @@ project_traits:
17
21
 
18
22
  compiler_traits:
19
23
  initial_header: "empty_cinit.h"
20
- standard_type:
24
+ file_search_paths:
25
+ - "."
26
+ standard_types:
21
27
  char_size: 8
22
28
  char_alignment: 8
23
29
  short_size: 16
@@ -39,11 +45,10 @@ compiler_traits:
39
45
  data_ptr_size: 32
40
46
  data_ptr_alignment: 32
41
47
  char_as_unsigned_char: true
42
- include_path:
43
- - "."
44
48
  arithmetic:
45
49
  logical_right_shift: true
46
- extension_substitution:
50
+ identifier_max: 128
51
+ extension_substitutions:
47
52
  "pascal": ""
48
53
  "__pascal": ""
49
54
  "fortran": ""
@@ -58,12 +63,11 @@ compiler_traits:
58
63
  "__huge": ""
59
64
  "__extension__": ""
60
65
  "__attribute__(__adlint__any)": ""
61
- arbitrary_substitution:
66
+ arbitrary_substitutions:
62
67
  "typeof": "__typeof__"
63
68
  "__typeof": "__typeof__"
64
69
  "alignof": "__alignof__"
65
70
  "__alignof": "__alignof__"
66
- identifier_max: 128
67
71
 
68
72
  linker_traits:
69
73
  identifier_max: 128
@@ -71,11 +75,7 @@ linker_traits:
71
75
 
72
76
  message_traits:
73
77
  language: "ja_JP"
74
- message_with_class: false
75
- warn_files_in:
76
- - "."
77
- warn_files_not_in:
78
- individual_selection: true
78
+ individual_suppression: true
79
79
  exclusion:
80
80
  inclusion:
81
81
  change_list:
@@ -114,7 +114,19 @@ DUMMY_ASSERT_H = <<EOF
114
114
  #endif
115
115
  EOF
116
116
 
117
- require "pathname"
117
+ DUMMY_STDDEF_H = <<EOF
118
+ #if !defined(DUMMY_STDDEF_H)
119
+ #define DUMMY_STDDEF_H
120
+
121
+ typedef unsigned long size_t;
122
+
123
+ #endif
124
+ EOF
125
+
126
+ require "adlint"
127
+
128
+ $tmpdir = File.expand_path("../../cucumber-tmp", File.dirname(__FILE__))
129
+ $:.unshift(File.expand_path("../../lib", File.dirname(__FILE__)))
118
130
 
119
131
  if ENV["ADLINT_COV"] =~ /1|on|true/
120
132
  require "simplecov"
@@ -122,23 +134,13 @@ if ENV["ADLINT_COV"] =~ /1|on|true/
122
134
  SimpleCov.start
123
135
  end
124
136
 
125
- $envdir = Pathname.new(__FILE__).realpath.dirname
126
- $prefix = Pathname.new("../..").expand_path($envdir)
127
- $bindir = Pathname.new("bin").expand_path($prefix)
128
- $libdir = Pathname.new("lib").expand_path($prefix)
129
- $tmpdir = Pathname.new("cucumber-tmp").expand_path($prefix)
130
-
131
- module Kernel
132
- def exit(status)
133
- # NOTE: To avoid terminating cucumber process.
134
- end
135
- end
137
+ EXCL_FILES = /_pinit\.h|_cinit\.h|stdio\.h|math\.h|assert\.h|stddef\.h/
136
138
 
137
139
  def run_adlint(cmd, *args)
138
140
  create_adlint_files
139
141
  cd_to_tmpdir do
140
142
  $all_output = exec(cmd, *args).each_line.map { |line|
141
- if line =~ /_pinit\.h|_cinit\.h|stdio\.h|math\.h|assert\.h/
143
+ if line =~ /#{EXCL_FILES}.*:warning/
142
144
  nil
143
145
  else
144
146
  line.chomp
@@ -156,9 +158,21 @@ ensure
156
158
  Dir.chdir(orig_wd)
157
159
  end
158
160
 
161
+ $noarch_traits_fname = Pathname.new("noarch_traits.yml")
162
+
159
163
  def exec(cmd, *args)
160
- ENV["RUBYLIB"] = "#{$libdir}:#{ENV["RUBYLIB"]}"
161
- system "#{cmd} #{args.join(" ")} 2>&1 >all_output"
164
+ orig_stdout = $stdout.dup
165
+ orig_stderr = $stderr.dup
166
+ File.open("all_output", "w") do |io|
167
+ $stdout.reopen(io)
168
+ $stderr.reopen(io)
169
+ adlint = AdLint::AdLint.new($noarch_traits_fname, Pathname.new("."), false)
170
+ adlint.run_sma!(Pathname.new(args.first), 0)
171
+ $stdout.flush
172
+ $stderr.flush
173
+ end
174
+ $stdout.reopen(orig_stdout)
175
+ $stderr.reopen(orig_stderr)
162
176
  File.read("all_output")
163
177
  end
164
178
 
@@ -168,12 +182,13 @@ end
168
182
 
169
183
  def create_adlint_files
170
184
  cd_to_tmpdir do
171
- create_file("noarch_traits.yml", NOARCH_TRAITS)
185
+ create_file($noarch_traits_fname, NOARCH_TRAITS)
172
186
  create_file("empty_pinit.h")
173
187
  create_file("empty_cinit.h")
174
188
  create_file("stdio.h", DUMMY_STDIO_H)
175
189
  create_file("math.h", DUMMY_MATH_H)
176
190
  create_file("assert.h", DUMMY_ASSERT_H)
191
+ create_file("stddef.h", DUMMY_STDDEF_H)
177
192
  end
178
193
  end
179
194
 
@@ -1,7 +1,7 @@
1
1
  # Examination loader of adlint-exam-c_staging package.
2
2
  #
3
3
  # Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
4
- # Copyright:: Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
4
+ # Copyright:: Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
5
5
  # License:: GPLv3+: GNU General Public License version 3 or later
6
6
  #
7
7
  # Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
@@ -11,7 +11,7 @@
11
11
  # / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
12
12
  # / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
13
13
  # / __ |/ /_/ / /___/ / /| / / /
14
- # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
14
+ # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
15
15
  #
16
16
  # This file is part of AdLint.
17
17
  #
@@ -41,9 +41,9 @@ module CStaging #:nodoc:
41
41
  cat.name = "c_staging"
42
42
 
43
43
  cat.major_version = 0
44
- cat.minor_version = 2
44
+ cat.minor_version = 3
45
45
  cat.patch_version = 0
46
- cat.release_date = "2012-09-21"
46
+ cat.release_date = "2013-03-27"
47
47
 
48
48
  cat.examination_classes = [
49
49
  W2001,
@@ -1,7 +1,7 @@
1
1
  # Code checkings (cpp-phase) of adlint-exam-c_staging package.
2
2
  #
3
3
  # Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
4
- # Copyright:: Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
4
+ # Copyright:: Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
5
5
  # License:: GPLv3+: GNU General Public License version 3 or later
6
6
  #
7
7
  # Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
@@ -11,7 +11,7 @@
11
11
  # / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
12
12
  # / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
13
13
  # / __ |/ /_/ / /___/ / /| / / /
14
- # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
14
+ # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
15
15
  #
16
16
  # This file is part of AdLint.
17
17
  #
@@ -47,7 +47,7 @@ module CStaging #:nodoc:
47
47
  def check(include_line, *)
48
48
  header_name = include_line.header_name
49
49
  if Pathname.new(header_name.value.gsub(/["<>]/, "")).absolute?
50
- W(:W2001, include_line.location, include_line.fpath)
50
+ W(include_line.location, include_line.fpath)
51
51
  end
52
52
  end
53
53
  end
@@ -59,16 +59,13 @@ module CStaging #:nodoc:
59
59
  super
60
60
  interp = context[:cpp_interpreter]
61
61
  interp.on_system_header_included += method(:check)
62
- @project_root = Traits.instance.of_project.project_root.realpath
62
+ @project_root = traits.of_project.project_root
63
63
  end
64
64
 
65
65
  private
66
66
  def check(include_line, *)
67
- include_line.fpath.realpath.descend do |path|
68
- if path == @project_root
69
- W(:W2002, include_line.location, include_line.fpath)
70
- break
71
- end
67
+ if include_line.fpath.under?(traits.of_project.project_root)
68
+ W(include_line.location, include_line.fpath)
72
69
  end
73
70
  end
74
71
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adlint-exam-c_staging
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-21 00:00:00.000000000 Z
12
+ date: 2013-03-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: adlint
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 2.3.0
21
+ version: 3.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
- version: 2.3.0
29
+ version: 3.0.0
30
30
  description: ! 'Experimental C language code examination package for AdLint
31
31
 
32
32
  '
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  version: '0'
79
79
  requirements: []
80
80
  rubyforge_project:
81
- rubygems_version: 1.8.24
81
+ rubygems_version: 1.8.23
82
82
  signing_key:
83
83
  specification_version: 3
84
84
  summary: Experimental C language code examination package for AdLint