adlint 1.0.0 → 1.2.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.
- data/AUTHORS +3 -2
 - data/ChangeLog +208 -63
 - data/MANIFEST +4 -0
 - data/NEWS +24 -5
 - data/etc/conf.d/fallback/traits.erb +1 -1
 - data/etc/conf.d/i686-cygwin/traits-gcc_4.3.4.erb +1 -1
 - data/etc/conf.d/i686-devkit/traits-gcc_4.5.2.erb +1 -1
 - data/etc/conf.d/i686-linux/traits-gcc_4.5.1.erb +1 -1
 - data/etc/conf.d/i686-mingw/traits-gcc_4.6.1.erb +1 -1
 - data/etc/mesg.d/en_US/messages.yml +3 -3
 - data/etc/mesg.d/ja_JP/messages.yml +4 -4
 - data/lib/adlint/c/builtin.rb +3 -3
 - data/lib/adlint/c/ctrlexpr.rb +7 -11
 - data/lib/adlint/c/expr.rb +548 -363
 - data/lib/adlint/c/interp.rb +233 -525
 - data/lib/adlint/c/mediator.rb +1 -0
 - data/lib/adlint/c/message.rb +144 -1
 - data/lib/adlint/c/object.rb +15 -6
 - data/lib/adlint/c/parser.rb +170 -128
 - data/lib/adlint/c/parser.y +36 -0
 - data/lib/adlint/c/phase.rb +4 -0
 - data/lib/adlint/c/seqp.rb +72 -0
 - data/lib/adlint/c/syntax.rb +254 -3
 - data/lib/adlint/c.rb +1 -0
 - data/lib/adlint/cpp/code.rb +2 -2
 - data/lib/adlint/cpp/eval.rb +29 -13
 - data/lib/adlint/cpp/message.rb +71 -70
 - data/lib/adlint/cpp/message_shima.rb +100 -0
 - data/lib/adlint/cpp/phase.rb +4 -0
 - data/lib/adlint/cpp/syntax.rb +5 -1
 - data/lib/adlint/cpp.rb +1 -0
 - data/lib/adlint/message.rb +6 -3
 - data/lib/adlint/traits.rb +1 -1
 - data/lib/adlint/version.rb +5 -5
 - data/share/demo/Makefile +3 -1
 - data/share/demo/bad_line/bad_line.c +27 -0
 - data/share/demo/sequence_point/sequence_point.c +31 -0
 - data/share/doc/adlint_on_vim_en.png +0 -0
 - data/share/doc/adlint_on_vim_ja.png +0 -0
 - data/share/doc/developers_guide_ja.html +3 -3
 - data/share/doc/developers_guide_ja.texi +1 -1
 - data/share/doc/users_guide_en.html +3118 -41
 - data/share/doc/users_guide_en.texi +3090 -37
 - data/share/doc/users_guide_ja.html +3120 -47
 - data/share/doc/users_guide_ja.texi +3106 -65
 - data/share/sample/ctags-5.8/adlint/GNUmakefile +13 -1
 - data/share/sample/ctags-5.8/adlint/adlint_cinit.h +14 -2
 - data/share/sample/ctags-5.8/adlint/adlint_pinit.h +14 -4
 - data/share/sample/ctags-5.8/adlint/adlint_traits.yml +14 -1
 - data/share/sample/flex-2.5.35/adlint/GNUmakefile +13 -1
 - data/share/sample/flex-2.5.35/adlint/adlint_cinit.h +14 -2
 - data/share/sample/flex-2.5.35/adlint/adlint_pinit.h +14 -4
 - data/share/sample/flex-2.5.35/adlint/adlint_traits.yml +14 -1
 - metadata +6 -2
 
    
        data/NEWS
    CHANGED
    
    | 
         @@ -21,18 +21,37 @@ 
     | 
|
| 
       21 
21 
     | 
    
         | 
| 
       22 
22 
     | 
    
         
             
            ++
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
      
 24 
     | 
    
         
            +
            === \AdLint 1.2.0 is released (2012-03-21)
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            ==== Changes since the 1.0.0 release
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            * Add W0597 detection
         
     | 
| 
      
 29 
     | 
    
         
            +
            * Add W0598 detection
         
     | 
| 
      
 30 
     | 
    
         
            +
            * Add W0599 detection
         
     | 
| 
      
 31 
     | 
    
         
            +
            * Add W0600 detection
         
     | 
| 
      
 32 
     | 
    
         
            +
            * Add W0688 detection
         
     | 
| 
      
 33 
     | 
    
         
            +
            * Add W0689 detection
         
     | 
| 
      
 34 
     | 
    
         
            +
            * Add W0690 detection
         
     | 
| 
      
 35 
     | 
    
         
            +
            * Change schema version validation method of input YAML files
         
     | 
| 
      
 36 
     | 
    
         
            +
            * Clarify message text of W0459 and W0460
         
     | 
| 
      
 37 
     | 
    
         
            +
            * Revise specification of W0459 and W0460 detections not to warn when a pointer
         
     | 
| 
      
 38 
     | 
    
         
            +
              argument points to an uninitialized object
         
     | 
| 
      
 39 
     | 
    
         
            +
            * Fix bad FN_UNUV metric measurement
         
     | 
| 
      
 40 
     | 
    
         
            +
            * Update the user's guide in Japanese
         
     | 
| 
      
 41 
     | 
    
         
            +
            * Update the user's guide in English
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
            See the file
         
     | 
| 
      
 44 
     | 
    
         
            +
            {ChangeLog}[http://adlint.sourceforge.net/pmwiki/upload.d/Main/ChangeLog]
         
     | 
| 
      
 45 
     | 
    
         
            +
            for more details.
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
       24 
47 
     | 
    
         
             
            === \AdLint 1.0.0 is released (2012-02-28)
         
     | 
| 
       25 
48 
     | 
    
         | 
| 
       26 
49 
     | 
    
         
             
            This is the initial GA release of \AdLint.
         
     | 
| 
       27 
50 
     | 
    
         | 
| 
       28 
     | 
    
         
            -
            ==== Implemented  
     | 
| 
      
 51 
     | 
    
         
            +
            ==== Implemented features
         
     | 
| 
       29 
52 
     | 
    
         | 
| 
       30 
53 
     | 
    
         
             
            * Single module analysis
         
     | 
| 
       31 
54 
     | 
    
         
             
            * Cross module analysis
         
     | 
| 
       32 
55 
     | 
    
         
             
            * 597 kinds of warning detections
         
     | 
| 
       33 
56 
     | 
    
         
             
            * 14 kinds of code structure extractions
         
     | 
| 
       34 
57 
     | 
    
         
             
            * 15 kinds of quality metric measurements
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
            See the file
         
     | 
| 
       37 
     | 
    
         
            -
            {ChangeLog}[http://adlint.sourceforge.net/pmwiki/upload.d/Main/ChangeLog]
         
     | 
| 
       38 
     | 
    
         
            -
            for more details.
         
     | 
| 
         @@ -36,7 +36,7 @@ 
     | 
|
| 
       36 
36 
     | 
    
         
             
            #     X9999: "Your custom message for the fatal error of #9999."
         
     | 
| 
       37 
37 
     | 
    
         
             
            #     E9999: "Your custom message for the error of #9999."
         
     | 
| 
       38 
38 
     | 
    
         | 
| 
       39 
     | 
    
         
            -
            version: "1. 
     | 
| 
      
 39 
     | 
    
         
            +
            version: "1.2.0"
         
     | 
| 
       40 
40 
     | 
    
         | 
| 
       41 
41 
     | 
    
         
             
            message_definition:
         
     | 
| 
       42 
42 
     | 
    
         
             
              X0001: "An unknown exception `%s' is found."
         
     | 
| 
         @@ -458,8 +458,8 @@ message_definition: 
     | 
|
| 
       458 
458 
     | 
    
         
             
              W0456: "An object or a function `%s which has external coupling is defined in a header file."
         
     | 
| 
       459 
459 
     | 
    
         
             
              W0457: "The return value doesn't define explicitly in the function declaration or definition. It defined as 'int' implicitly."
         
     | 
| 
       460 
460 
     | 
    
         
             
              W0458: "The type doesn't define explicitly in the object declaration or definition. It defined as 'int' implicitly."
         
     | 
| 
       461 
     | 
    
         
            -
              W0459: "A value of variable `%s' doesn't set  
     | 
| 
       462 
     | 
    
         
            -
              W0460: "A value of variable `%s' wouldn't set  
     | 
| 
      
 461 
     | 
    
         
            +
              W0459: "A value of variable `%s' doesn't set when this expression is evaluated. This program is danger."
         
     | 
| 
      
 462 
     | 
    
         
            +
              W0460: "A value of variable `%s' wouldn't set when this expression is evaluated."
         
     | 
| 
       463 
463 
     | 
    
         
             
              W0461: "A pointer which points the undetermined variable is used for the actual argument of the function. This program is danger."
         
     | 
| 
       464 
464 
     | 
    
         
             
              W0462: "A pointer which the value will probably not set is used for the actual argument of the function."
         
     | 
| 
       465 
465 
     | 
    
         
             
              W0463: "UNUSABLE"
         
     | 
| 
         @@ -36,7 +36,7 @@ 
     | 
|
| 
       36 
36 
     | 
    
         
             
            #     X9999: "Your custom message for the fatal error of #9999."
         
     | 
| 
       37 
37 
     | 
    
         
             
            #     E9999: "Your custom message for the error of #9999."
         
     | 
| 
       38 
38 
     | 
    
         | 
| 
       39 
     | 
    
         
            -
            version: "1. 
     | 
| 
      
 39 
     | 
    
         
            +
            version: "1.2.0"
         
     | 
| 
       40 
40 
     | 
    
         | 
| 
       41 
41 
     | 
    
         
             
            message_definition:
         
     | 
| 
       42 
42 
     | 
    
         
             
              X0001: "不明な例外条件 `%s' を検出しました。"
         
     | 
| 
         @@ -458,8 +458,8 @@ message_definition: 
     | 
|
| 
       458 
458 
     | 
    
         
             
              W0456: "外部結合を持つオブジェクトあるいは関数 `%s' が、ヘッダファイル内で定義されています。"
         
     | 
| 
       459 
459 
     | 
    
         
             
              W0457: "関数の宣言あるいは定義で、戻り値型が明示的に定義されていないので、暗黙的に int 型と定義されます。"
         
     | 
| 
       460 
460 
     | 
    
         
             
              W0458: "オブジェクトの宣言あるいは定義で、型が明示的に定義されていないので、暗黙的に int 型と定義されます。"
         
     | 
| 
       461 
     | 
    
         
            -
              W0459: "変数 `%s'  
     | 
| 
       462 
     | 
    
         
            -
              W0460: "変数 `%s'  
     | 
| 
      
 461 
     | 
    
         
            +
              W0459: "変数 `%s' の値は、この式の評価時点では設定されていません。このプログラムは危険です。"
         
     | 
| 
      
 462 
     | 
    
         
            +
              W0460: "変数 `%s' の値は、この式の評価時点では設定されていないことがあります。"
         
     | 
| 
       463 
463 
     | 
    
         
             
              W0461: "値が定まっていない変数を指すポインタを関数の実引数として使っています。このプログラムは危険です。"
         
     | 
| 
       464 
464 
     | 
    
         
             
              W0462: "値が設定されていないことがありうる変数を指すポインタを関数の実引数として使っています。"
         
     | 
| 
       465 
465 
     | 
    
         
             
              W0463: "使用不可"
         
     | 
| 
         @@ -615,7 +615,7 @@ message_definition: 
     | 
|
| 
       615 
615 
     | 
    
         
             
              W0686: "走査セット(`[]' に囲まれた文字の並び)の中に同じ文字が二つ以上記述されています。"
         
     | 
| 
       616 
616 
     | 
    
         
             
              W0687: "defined 演算子を削除する目的で #undef を使っています。"
         
     | 
| 
       617 
617 
     | 
    
         
             
              W0688: "#line 指令の後に、1 から 32767 の範囲の行番号が記述されていません。"
         
     | 
| 
       618 
     | 
    
         
            -
              W0689: "#line 指令の構文が `#line 汎整数定数 \" 
     | 
| 
      
 618 
     | 
    
         
            +
              W0689: "#line 指令の構文が `#line 汎整数定数 \"文字列\"' の形式と合っていません。"
         
     | 
| 
       619 
619 
     | 
    
         
             
              W0690: "#line 指令の後に行番号が記述されていません。"
         
     | 
| 
       620 
620 
     | 
    
         
             
              W0691: "`##' 演算子の結果が有効な前処理字句ではありません。"
         
     | 
| 
       621 
621 
     | 
    
         
             
              W0692: "関数形式マクロに実引数が与えられていません。"
         
     | 
    
        data/lib/adlint/c/builtin.rb
    CHANGED
    
    | 
         @@ -48,7 +48,7 @@ module C #:nodoc: 
     | 
|
| 
       48 
48 
     | 
    
         
             
                  true
         
     | 
| 
       49 
49 
     | 
    
         
             
                end
         
     | 
| 
       50 
50 
     | 
    
         | 
| 
       51 
     | 
    
         
            -
                def call(interpreter, args)
         
     | 
| 
      
 51 
     | 
    
         
            +
                def call(interpreter, funcall_expr, args)
         
     | 
| 
       52 
52 
     | 
    
         
             
                  interpreter.temporary_variable(type.return_type)
         
     | 
| 
       53 
53 
     | 
    
         
             
                end
         
     | 
| 
       54 
54 
     | 
    
         
             
              end
         
     | 
| 
         @@ -58,7 +58,7 @@ module C #:nodoc: 
     | 
|
| 
       58 
58 
     | 
    
         
             
                  super(type_table, "__adlint__inspect")
         
     | 
| 
       59 
59 
     | 
    
         
             
                end
         
     | 
| 
       60 
60 
     | 
    
         | 
| 
       61 
     | 
    
         
            -
                def call(interpreter, args)
         
     | 
| 
      
 61 
     | 
    
         
            +
                def call(interpreter, funcall_expr, args)
         
     | 
| 
       62 
62 
     | 
    
         
             
                  puts "__adlint__inspect"
         
     | 
| 
       63 
63 
     | 
    
         
             
                  args.each { |arg, expr| pp arg }
         
     | 
| 
       64 
64 
     | 
    
         
             
                  puts "EOM"
         
     | 
| 
         @@ -71,7 +71,7 @@ module C #:nodoc: 
     | 
|
| 
       71 
71 
     | 
    
         
             
                  super(type_table, "__adlint__eval")
         
     | 
| 
       72 
72 
     | 
    
         
             
                end
         
     | 
| 
       73 
73 
     | 
    
         | 
| 
       74 
     | 
    
         
            -
                def call(interpreter, args)
         
     | 
| 
      
 74 
     | 
    
         
            +
                def call(interpreter, funcall_expr, args)
         
     | 
| 
       75 
75 
     | 
    
         
             
                  puts "__adlint__eval"
         
     | 
| 
       76 
76 
     | 
    
         
             
                  char_array = interpreter.pointee_of(args.first.first)
         
     | 
| 
       77 
77 
     | 
    
         
             
                  if char_array.type.array?
         
     | 
    
        data/lib/adlint/c/ctrlexpr.rb
    CHANGED
    
    | 
         @@ -226,7 +226,7 @@ module C #:nodoc: 
     | 
|
| 
       226 
226 
     | 
    
         
             
                                              object_narrowing, *arg_narrowings) do
         
     | 
| 
       227 
227 
     | 
    
         
             
                    checkpoint(node.location)
         
     | 
| 
       228 
228 
     | 
    
         | 
| 
       229 
     | 
    
         
            -
                     
     | 
| 
      
 229 
     | 
    
         
            +
                    object_narrowing.execute!
         
     | 
| 
       230 
230 
     | 
    
         
             
                    args = arg_narrowings.map { |narrowing|
         
     | 
| 
       231 
231 
     | 
    
         
             
                      narrowing.execute!; [narrowing.result, narrowing.node]
         
     | 
| 
       232 
232 
     | 
    
         
             
                    }
         
     | 
| 
         @@ -276,8 +276,7 @@ module C #:nodoc: 
     | 
|
| 
       276 
276 
     | 
    
         
             
                  DelayedObjectDerivation.new(self, node, object_narrowing) do
         
     | 
| 
       277 
277 
     | 
    
         
             
                    checkpoint(node.location)
         
     | 
| 
       278 
278 
     | 
    
         | 
| 
       279 
     | 
    
         
            -
                     
     | 
| 
       280 
     | 
    
         
            -
             
     | 
| 
      
 279 
     | 
    
         
            +
                    object_narrowing.execute!
         
     | 
| 
       281 
280 
     | 
    
         
             
                    execute_postfix_increment_expression(node, object_narrowing.result)
         
     | 
| 
       282 
281 
     | 
    
         
             
                  end
         
     | 
| 
       283 
282 
     | 
    
         
             
                end
         
     | 
| 
         @@ -290,8 +289,7 @@ module C #:nodoc: 
     | 
|
| 
       290 
289 
     | 
    
         
             
                  DelayedObjectDerivation.new(self, node, object_narrowing) do
         
     | 
| 
       291 
290 
     | 
    
         
             
                    checkpoint(node.location)
         
     | 
| 
       292 
291 
     | 
    
         | 
| 
       293 
     | 
    
         
            -
                     
     | 
| 
       294 
     | 
    
         
            -
             
     | 
| 
      
 292 
     | 
    
         
            +
                    object_narrowing.execute!
         
     | 
| 
       295 
293 
     | 
    
         
             
                    execute_postfix_decrement_expression(node, object_narrowing.result)
         
     | 
| 
       296 
294 
     | 
    
         
             
                  end
         
     | 
| 
       297 
295 
     | 
    
         
             
                end
         
     | 
| 
         @@ -306,8 +304,7 @@ module C #:nodoc: 
     | 
|
| 
       306 
304 
     | 
    
         
             
                  DelayedObjectDerivation.new(self, node, object_narrowing) do
         
     | 
| 
       307 
305 
     | 
    
         
             
                    checkpoint(node.location)
         
     | 
| 
       308 
306 
     | 
    
         | 
| 
       309 
     | 
    
         
            -
                     
     | 
| 
       310 
     | 
    
         
            -
             
     | 
| 
      
 307 
     | 
    
         
            +
                    object_narrowing.execute!
         
     | 
| 
       311 
308 
     | 
    
         
             
                    execute_prefix_increment_expression(node, object_narrowing.result)
         
     | 
| 
       312 
309 
     | 
    
         
             
                  end
         
     | 
| 
       313 
310 
     | 
    
         
             
                end
         
     | 
| 
         @@ -320,8 +317,7 @@ module C #:nodoc: 
     | 
|
| 
       320 
317 
     | 
    
         
             
                  DelayedObjectDerivation.new(self, node, object_narrowing) do
         
     | 
| 
       321 
318 
     | 
    
         
             
                    checkpoint(node.location)
         
     | 
| 
       322 
319 
     | 
    
         | 
| 
       323 
     | 
    
         
            -
                     
     | 
| 
       324 
     | 
    
         
            -
             
     | 
| 
      
 320 
     | 
    
         
            +
                    object_narrowing.execute!
         
     | 
| 
       325 
321 
     | 
    
         
             
                    execute_prefix_decrement_expression(node, object_narrowing.result)
         
     | 
| 
       326 
322 
     | 
    
         
             
                  end
         
     | 
| 
       327 
323 
     | 
    
         
             
                end
         
     | 
| 
         @@ -524,7 +520,7 @@ module C #:nodoc: 
     | 
|
| 
       524 
520 
     | 
    
         
             
                  DelayedObjectDerivation.new(self, node, lhs_narrowing, rhs_narrowing) do
         
     | 
| 
       525 
521 
     | 
    
         
             
                    checkpoint(node.location)
         
     | 
| 
       526 
522 
     | 
    
         | 
| 
       527 
     | 
    
         
            -
                     
     | 
| 
      
 523 
     | 
    
         
            +
                    lhs_narrowing.execute!
         
     | 
| 
       528 
524 
     | 
    
         
             
                    rhs_narrowing.execute!
         
     | 
| 
       529 
525 
     | 
    
         | 
| 
       530 
526 
     | 
    
         
             
                    execute_simple_assignment_expression(
         
     | 
| 
         @@ -541,7 +537,7 @@ module C #:nodoc: 
     | 
|
| 
       541 
537 
     | 
    
         
             
                  DelayedObjectDerivation.new(self, node, lhs_narrowing, rhs_narrowing) do
         
     | 
| 
       542 
538 
     | 
    
         
             
                    checkpoint(node.location)
         
     | 
| 
       543 
539 
     | 
    
         | 
| 
       544 
     | 
    
         
            -
                     
     | 
| 
      
 540 
     | 
    
         
            +
                    lhs_narrowing.execute!
         
     | 
| 
       545 
541 
     | 
    
         
             
                    rhs_narrowing.execute!
         
     | 
| 
       546 
542 
     | 
    
         | 
| 
       547 
543 
     | 
    
         
             
                    execute_compound_assignment_expression(
         
     |