adlint 1.8.2 → 1.8.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -386,8 +386,7 @@ module C #:nodoc:
386
386
 
387
387
  def check_filelocal_object_name(name, decl_or_def)
388
388
  if @function_def_level == 0
389
- storage_class_specifier = decl_or_def.storage_class_specifier
390
- if storage_class_specifier && storage_class_specifier.type == :STATIC
389
+ if scs = decl_or_def.storage_class_specifier and scs.type == :STATIC
391
390
  W(:W0809, decl_or_def.location, name)
392
391
  end
393
392
  end
@@ -263,7 +263,7 @@ module C #:nodoc:
263
263
  if @scope.global?
264
264
  super
265
265
  else
266
- storage_class_specifiers.all? { |sc_spec| sc_spec.type == :EXTERN }
266
+ storage_class_specifiers.any? { |sc_spec| sc_spec.type == :EXTERN }
267
267
  end
268
268
  end
269
269
 
data/lib/adlint/c/type.rb CHANGED
@@ -212,6 +212,10 @@ module C #:nodoc:
212
212
  self.real_type.unqualify == type.real_type.unqualify
213
213
  end
214
214
 
215
+ def parameter?
216
+ false
217
+ end
218
+
215
219
  def scalar?
216
220
  subclass_responsibility
217
221
  end
@@ -2019,7 +2023,7 @@ module C #:nodoc:
2019
2023
  end
2020
2024
 
2021
2025
  def same_as?(type)
2022
- false
2026
+ type.void?
2023
2027
  end
2024
2028
 
2025
2029
  def scalar?
@@ -5334,6 +5338,21 @@ module C #:nodoc:
5334
5338
  false
5335
5339
  end
5336
5340
 
5341
+ def same_as?(type)
5342
+ lhs_unqualified = self.real_type.unqualify
5343
+ rhs_unqualified = type.real_type.unqualify
5344
+
5345
+ if rhs_unqualified.pointer?
5346
+ if lhs_unqualified.base_type.void?
5347
+ true
5348
+ else
5349
+ lhs_unqualified.base_type.same_as?(rhs_unqualified.base_type)
5350
+ end
5351
+ else
5352
+ false
5353
+ end
5354
+ end
5355
+
5337
5356
  def pointer?
5338
5357
  true
5339
5358
  end
@@ -5526,6 +5545,24 @@ module C #:nodoc:
5526
5545
  type.array? && @base_type.coercible?(type.base_type)
5527
5546
  end
5528
5547
 
5548
+ def same_as?(type)
5549
+ lhs_unqualified = self.real_type.unqualify
5550
+ rhs_unqualified = type.real_type.unqualify
5551
+
5552
+ case
5553
+ when rhs_unqualified.array?
5554
+ if lhs_unqualified.length
5555
+ lhs_unqualified.length == rhs_unqualified.length
5556
+ else
5557
+ lhs_unqualified.base_type.same_as?(rhs_unqualified.base_type)
5558
+ end
5559
+ when rhs_unqualified.pointer?
5560
+ lhs_unqualified.base_type.same_as?(rhs_unqualified.base_type)
5561
+ else
5562
+ false
5563
+ end
5564
+ end
5565
+
5529
5566
  def scalar?
5530
5567
  false
5531
5568
  end
@@ -6834,6 +6871,11 @@ module C #:nodoc:
6834
6871
  def_delegator :@type, :incomplete?
6835
6872
  def_delegator :@type, :compatible?
6836
6873
  def_delegator :@type, :coercible?
6874
+
6875
+ def parameter?
6876
+ true
6877
+ end
6878
+
6837
6879
  def_delegator :@type, :scalar?
6838
6880
  def_delegator :@type, :integer?
6839
6881
  def_delegator :@type, :floating?
@@ -79,6 +79,35 @@ module Cpp #:nodoc:
79
79
  string.chars.to_a - select_adapted(string)
80
80
  end
81
81
 
82
+ # NOTE: The ISO C99 standard saids;
83
+ #
84
+ # 5.2 Environmental considerations
85
+ # 5.2.1 Character sets
86
+ #
87
+ # 1 Two sets of characters and their associated collating sequences shall
88
+ # be defined: the set in which source files are written (the source
89
+ # character set), and the set interpreted in the execution environment
90
+ # (the execution character set). Each set is further divided into a basic
91
+ # character set, whose contents are given by this subclause, and a set of
92
+ # zero or more locale-specific members (which are not members of the
93
+ # basic character set) called extended characters. The combined set is
94
+ # also called the extended character set. The values of the members of
95
+ # the execution character set are implementation-defined.
96
+ #
97
+ # 3 Both the basic source and basic execution character sets shall have the
98
+ # following members: the 26 uppercase letters of the Latin alphabet
99
+ # A B C D E F G H I J K L M
100
+ # N O P Q R S T U V W X Y Z
101
+ # the 26 lowercase letters of the Latin alphabet
102
+ # a b c d e f g h i j k l m
103
+ # n o p q r s t u v w x y z
104
+ # the 10 decimal digits
105
+ # 0 1 2 3 4 5 6 7 8 9
106
+ # the following 29 graphic characters
107
+ # ! " # % & ' ( ) * + , - . / :
108
+ # ; < = > ? [ \ ] ^ _ { | } ~
109
+ # the space character, and control characters representing horizontal
110
+ # tab, vertical tab, and form feed.
82
111
  CHARS = [
83
112
  " ", "\t", "\v", "\f", "\n",
84
113
  "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
@@ -33,8 +33,8 @@ module AdLint #:nodoc:
33
33
 
34
34
  MAJOR_VERSION = 1
35
35
  MINOR_VERSION = 8
36
- PATCH_VERSION = 2
37
- RELEASE_DATE = "2012-05-08"
36
+ PATCH_VERSION = 10
37
+ RELEASE_DATE = "2012-05-18"
38
38
 
39
39
  TRAITS_SCHEMA_VERSION = "1.0.0"
40
40
 
data/share/demo/Makefile CHANGED
@@ -36,6 +36,7 @@ incomplete_ifelse \
36
36
  incomplete_type \
37
37
  indirect_recur \
38
38
  inline_asm \
39
+ integer_promotion \
39
40
  intro_demo \
40
41
  invalid_call \
41
42
  kandr_fundef \
@@ -0,0 +1,17 @@
1
+ /* ADLINT:TUNIT:[-W0118,-W0414,-W0425,-W0947,-W0948] */
2
+
3
+ #define EOF (-1)
4
+
5
+ extern int getchar(void);
6
+ extern int printf(const char *, ...);
7
+
8
+ int main(void)
9
+ {
10
+ unsigned char c; /* ADLINT::[-W0100] */
11
+
12
+ while ((c = getchar()) != EOF) {
13
+ if ((int) c != '\n') printf("%d\n", (int) c);
14
+ }
15
+
16
+ return 0;
17
+ }
@@ -1,8 +1,8 @@
1
1
  <html lang="ja">
2
2
  <head>
3
- <title>AdLint 1.8.2 開発者ガイド</title>
3
+ <title>AdLint 1.8.10 開発者ガイド</title>
4
4
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
- <meta name="description" content="AdLint 1.8.2 開発者ガイド">
5
+ <meta name="description" content="AdLint 1.8.10 開発者ガイド">
6
6
  <meta name="generator" content="makeinfo 4.13">
7
7
  <link title="Top" rel="top" href="#Top">
8
8
  <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
@@ -44,7 +44,7 @@ td { border: 1px solid black; }
44
44
  --></style>
45
45
  </head>
46
46
  <body>
47
- <h1 class="settitle">AdLint 1.8.2 開発者ガイド</h1>
47
+ <h1 class="settitle">AdLint 1.8.10 開発者ガイド</h1>
48
48
  <div class="contents">
49
49
  <h2>Table of Contents</h2>
50
50
  <ul>
@@ -2,7 +2,7 @@
2
2
  @setfilename developers_guide_ja.info
3
3
  @documentlanguage ja
4
4
  @documentencoding utf-8
5
- @settitle AdLint 1.8.2 開発者ガイド
5
+ @settitle AdLint 1.8.10 開発者ガイド
6
6
 
7
7
  @copying
8
8
  Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
@@ -1,8 +1,8 @@
1
1
  <html lang="en">
2
2
  <head>
3
- <title>AdLint 1.8.2 User's Guide</title>
3
+ <title>AdLint 1.8.10 User's Guide</title>
4
4
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
- <meta name="description" content="AdLint 1.8.2 User's Guide">
5
+ <meta name="description" content="AdLint 1.8.10 User's Guide">
6
6
  <meta name="generator" content="makeinfo 4.13">
7
7
  <link title="Top" rel="top" href="#Top">
8
8
  <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
@@ -44,7 +44,7 @@ td { border: 1px solid black; }
44
44
  --></style>
45
45
  </head>
46
46
  <body>
47
- <h1 class="settitle">AdLint 1.8.2 User's Guide</h1>
47
+ <h1 class="settitle">AdLint 1.8.10 User's Guide</h1>
48
48
  <div class="node">
49
49
  <a name="Top"></a>
50
50
  <p><hr>
@@ -2,7 +2,7 @@
2
2
  @setfilename users_guide_en.info
3
3
  @documentlanguage en
4
4
  @documentencoding utf-8
5
- @settitle AdLint 1.8.2 User's Guide
5
+ @settitle AdLint 1.8.10 User's Guide
6
6
 
7
7
  @copying
8
8
  Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
@@ -1,8 +1,8 @@
1
1
  <html lang="ja">
2
2
  <head>
3
- <title>AdLint 1.8.2 利用者ガイド</title>
3
+ <title>AdLint 1.8.10 利用者ガイド</title>
4
4
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
- <meta name="description" content="AdLint 1.8.2 利用者ガイド">
5
+ <meta name="description" content="AdLint 1.8.10 利用者ガイド">
6
6
  <meta name="generator" content="makeinfo 4.13">
7
7
  <link title="Top" rel="top" href="#Top">
8
8
  <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
@@ -44,7 +44,7 @@ td { border: 1px solid black; }
44
44
  --></style>
45
45
  </head>
46
46
  <body>
47
- <h1 class="settitle">AdLint 1.8.2 利用者ガイド</h1>
47
+ <h1 class="settitle">AdLint 1.8.10 利用者ガイド</h1>
48
48
  <div class="node">
49
49
  <a name="Top"></a>
50
50
  <p><hr>
@@ -2,7 +2,7 @@
2
2
  @setfilename users_guide_ja.info
3
3
  @documentlanguage ja
4
4
  @documentencoding utf-8
5
- @settitle AdLint 1.8.2 利用者ガイド
5
+ @settitle AdLint 1.8.10 利用者ガイド
6
6
 
7
7
  @copying
8
8
  Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adlint
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.2
4
+ version: 1.8.10
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-05-08 00:00:00.000000000 Z
12
+ date: 2012-05-18 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! 'AdLint is a source code static analyzer.
15
15
 
@@ -181,6 +181,7 @@ files:
181
181
  - share/demo/indirect_recur/indirect_recur_3.h
182
182
  - share/demo/indirect_recur/indirect_recur_4.c
183
183
  - share/demo/inline_asm/inline_asm.c
184
+ - share/demo/integer_promotion/integer_promotion.c
184
185
  - share/demo/intro_demo/intro_demo.c
185
186
  - share/demo/intro_demo/intro_demo.h
186
187
  - share/demo/intro_demo/useless_header.h