adlint 2.6.14 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +1 -3
- data/ChangeLog +511 -0
- data/INSTALL +1 -1
- data/MANIFEST +57 -37
- data/NEWS +36 -7
- data/README +2 -2
- data/Rakefile +6 -6
- data/TODO +1 -1
- data/bin/adlint +25 -16
- data/bin/adlint_chk +22 -12
- data/bin/adlint_cma +17 -12
- data/bin/adlint_sma +22 -12
- data/bin/adlintize +98 -17
- data/etc/conf.d/fallback/cinit.erb +1 -1
- data/etc/conf.d/fallback/traits.erb +37 -37
- data/etc/conf.d/i686-cygwin/cinit-gcc_4.3.4.erb +1 -1
- data/etc/conf.d/i686-cygwin/traits-gcc_4.3.4.erb +41 -41
- data/etc/conf.d/i686-devkit/cinit-gcc_4.5.2.erb +1 -1
- data/etc/conf.d/i686-devkit/traits-gcc_4.5.2.erb +40 -40
- data/etc/conf.d/i686-linux/cinit-gcc_4.5.1.erb +1 -1
- data/etc/conf.d/i686-linux/traits-gcc_4.5.1.erb +40 -40
- data/etc/conf.d/i686-mingw/cinit-gcc_4.6.1.erb +1 -1
- data/etc/conf.d/i686-mingw/traits-gcc_4.6.1.erb +40 -40
- data/etc/conf.d/noarch/GNUmakefile.erb +1 -1
- data/etc/conf.d/noarch/adlint_all_bat.erb +1 -1
- data/etc/conf.d/noarch/adlint_all_sh.erb +1 -1
- data/etc/conf.d/noarch/pinit.erb +1 -1
- data/etc/conf.d/x86_64-ubuntu_12.04/cinit-gcc_4.6.3.erb +1 -1
- data/etc/conf.d/x86_64-ubuntu_12.04/traits-gcc_4.6.3.erb +42 -42
- data/etc/mesg.d/c_builtin/en_US/messages.yml +33 -33
- data/etc/mesg.d/c_builtin/ja_JP/messages.yml +5 -5
- data/etc/mesg.d/core/en_US/messages.yml +2 -2
- data/etc/mesg.d/core/ja_JP/messages.yml +2 -2
- data/features/code_check/W0018.feature +197 -0
- data/features/code_check/W0019.feature +79 -0
- data/features/code_check/W0021.feature +81 -0
- data/features/code_check/W0023.feature +203 -0
- data/features/code_check/W0024.feature +226 -0
- data/features/code_check/W0025.feature +5 -0
- data/features/code_check/W0088.feature +2 -2
- data/features/code_check/W0109.feature +2 -2
- data/features/code_check/W0477.feature +0 -3
- data/features/code_check/W0478.feature +0 -1
- data/features/code_check/W0582.feature +3 -3
- data/features/code_check/W0583.feature +4 -7
- data/features/code_check/W0646.feature +0 -1
- data/features/code_check/W0695.feature +0 -1
- data/features/code_check/W0705.feature +8 -0
- data/features/code_check/W0723.feature +0 -1
- data/features/code_check/W0745.feature +1 -0
- data/features/code_check/W0781.feature +1 -0
- data/features/code_check/W1057.feature +141 -0
- data/features/code_check/W1058.feature +93 -0
- data/features/code_check/W1059.feature +86 -0
- data/features/code_check/W1060.feature +77 -0
- data/features/code_check/W1061.feature +143 -0
- data/features/code_check/W1062.feature +162 -0
- data/features/code_check/W1063.feature +123 -0
- data/features/code_check/W1064.feature +83 -0
- data/features/code_check/W1065.feature +82 -0
- data/features/code_check/W9003.feature +2 -0
- data/features/step_definitions/code_check_steps.rb +1 -0
- data/features/support/env.rb +16 -13
- data/lib/adlint.rb +7 -4
- data/lib/adlint/analyzer.rb +131 -157
- data/lib/adlint/annot.rb +149 -0
- data/lib/adlint/cc1.rb +57 -0
- data/lib/adlint/{c → cc1}/branch.rb +74 -62
- data/lib/adlint/{c → cc1}/builtin.rb +21 -21
- data/lib/adlint/{c → cc1}/const.rb +119 -117
- data/lib/adlint/{c → cc1}/conv.rb +76 -78
- data/lib/adlint/{c → cc1}/ctrlexpr.rb +69 -86
- data/lib/adlint/cc1/domain.rb +8103 -0
- data/lib/adlint/{c → cc1}/enum.rb +3 -3
- data/lib/adlint/{c → cc1}/environ.rb +21 -21
- data/lib/adlint/{c → cc1}/expr.rb +232 -218
- data/lib/adlint/{c → cc1}/format.rb +305 -342
- data/lib/adlint/{c → cc1}/interp.rb +269 -220
- data/lib/adlint/cc1/lexer.rb +246 -0
- data/lib/adlint/{c → cc1}/mediator.rb +78 -84
- data/lib/adlint/{c → cc1}/object.rb +261 -264
- data/lib/adlint/{c → cc1}/operator.rb +7 -7
- data/lib/adlint/{c → cc1}/option.rb +4 -3
- data/lib/adlint/{c → cc1}/parser.rb +274 -506
- data/lib/adlint/{c → cc1}/parser.y +69 -301
- data/lib/adlint/cc1/phase.rb +138 -0
- data/lib/adlint/{c → cc1}/resolver.rb +66 -78
- data/lib/adlint/{c → cc1}/scanner.rb +57 -49
- data/lib/adlint/{c → cc1}/scope.rb +3 -3
- data/lib/adlint/{c → cc1}/seqp.rb +13 -5
- data/lib/adlint/{c → cc1}/syntax.rb +819 -1122
- data/lib/adlint/{c → cc1}/type.rb +1498 -1479
- data/lib/adlint/{c → cc1}/util.rb +20 -12
- data/lib/adlint/{c → cc1}/value.rb +699 -642
- data/lib/adlint/code.rb +163 -164
- data/lib/adlint/cpp.rb +2 -2
- data/lib/adlint/cpp/asm.rb +13 -14
- data/lib/adlint/cpp/constexpr.rb +42 -38
- data/lib/adlint/cpp/constexpr.y +44 -40
- data/lib/adlint/cpp/eval.rb +435 -435
- data/lib/adlint/cpp/lexer.rb +343 -340
- data/lib/adlint/cpp/macro.rb +188 -190
- data/lib/adlint/cpp/phase.rb +66 -45
- data/lib/adlint/cpp/scanner.rb +14 -17
- data/lib/adlint/cpp/source.rb +49 -55
- data/lib/adlint/cpp/subst.rb +65 -65
- data/lib/adlint/cpp/syntax.rb +155 -275
- data/lib/adlint/cpp/util.rb +22 -19
- data/lib/adlint/driver.rb +86 -93
- data/lib/adlint/error.rb +33 -52
- data/lib/adlint/exam.rb +158 -24
- data/lib/adlint/exam/c_builtin.rb +7 -7
- data/lib/adlint/exam/c_builtin/cc1_check.rb +20522 -0
- data/lib/adlint/exam/c_builtin/cc1_check_shima.rb +957 -0
- data/lib/adlint/exam/c_builtin/cc1_code.rb +459 -0
- data/lib/adlint/exam/c_builtin/cc1_metric.rb +794 -0
- data/lib/adlint/exam/c_builtin/cpp_check.rb +486 -441
- data/lib/adlint/exam/c_builtin/cpp_check_shima.rb +36 -39
- data/lib/adlint/exam/c_builtin/cpp_code.rb +63 -65
- data/lib/adlint/exam/c_builtin/ld_check.rb +136 -129
- data/lib/adlint/exam/c_builtin/ld_metric.rb +11 -11
- data/lib/adlint/lang.rb +25 -25
- data/lib/adlint/ld.rb +2 -2
- data/lib/adlint/ld/object.rb +220 -188
- data/lib/adlint/ld/phase.rb +94 -63
- data/lib/adlint/ld/typedef.rb +22 -11
- data/lib/adlint/ld/util.rb +43 -35
- data/lib/adlint/lexer.rb +59 -56
- data/lib/adlint/location.rb +140 -0
- data/lib/adlint/memo.rb +157 -0
- data/lib/adlint/message.rb +207 -156
- data/lib/adlint/metric.rb +139 -217
- data/lib/adlint/monitor.rb +45 -43
- data/lib/adlint/phase.rb +56 -29
- data/lib/adlint/prelude.rb +66 -54
- data/lib/adlint/report.rb +253 -332
- data/lib/adlint/source.rb +26 -27
- data/lib/adlint/supp.rb +131 -0
- data/lib/adlint/symbol.rb +14 -16
- data/lib/adlint/token.rb +19 -91
- data/lib/adlint/traits.rb +242 -226
- data/lib/adlint/util.rb +116 -205
- data/lib/adlint/version.rb +8 -8
- data/share/HEADER +2 -2
- data/share/doc/developers_guide_ja.html +148 -19
- data/share/doc/developers_guide_ja.texi +141 -11
- data/share/doc/samples/GNUmakefile +1 -1
- data/share/doc/samples/adlint_traits.yml +45 -36
- data/share/doc/users_guide_en.html +1321 -1252
- data/share/doc/users_guide_en.texi +475 -408
- data/share/doc/users_guide_ja.html +1932 -1878
- data/share/doc/users_guide_ja.texi +324 -273
- data/share/sample/bison-2.5/adlint/GNUmakefile +5 -1
- data/share/sample/bison-2.5/adlint/adlint_traits.yml +38 -38
- data/share/sample/bison-2.5/adlint/lib/GNUmakefile +1 -1
- data/share/sample/bison-2.5/adlint/lib/adlint_cinit.h +1 -1
- data/share/sample/bison-2.5/adlint/lib/adlint_pinit.h +1 -1
- data/share/sample/bison-2.5/adlint/lib/adlint_traits.yml +50 -42
- data/share/sample/bison-2.5/adlint/src/GNUmakefile +1 -1
- data/share/sample/bison-2.5/adlint/src/adlint_cinit.h +1 -1
- data/share/sample/bison-2.5/adlint/src/adlint_pinit.h +1 -1
- data/share/sample/bison-2.5/adlint/src/adlint_traits.yml +50 -42
- data/share/sample/ctags-5.8/adlint/GNUmakefile +1 -1
- data/share/sample/ctags-5.8/adlint/adlint_cinit.h +1 -1
- data/share/sample/ctags-5.8/adlint/adlint_pinit.h +1 -1
- data/share/sample/ctags-5.8/adlint/adlint_traits.yml +50 -42
- data/share/sample/flex-2.5.35/adlint/GNUmakefile +1 -1
- data/share/sample/flex-2.5.35/adlint/adlint_cinit.h +1 -1
- data/share/sample/flex-2.5.35/adlint/adlint_pinit.h +1 -1
- data/share/sample/flex-2.5.35/adlint/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/adlint_traits.yml +46 -38
- data/share/sample/ruby-1.9.3-p0/adlint/core/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/enc/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-date/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_traits.yml +50 -42
- data/share/sample/screen-4.0.3/adlint/GNUmakefile +1 -1
- data/share/sample/screen-4.0.3/adlint/adlint_cinit.h +1 -1
- data/share/sample/screen-4.0.3/adlint/adlint_pinit.h +1 -1
- data/share/sample/screen-4.0.3/adlint/adlint_traits.yml +50 -42
- data/share/sample/vim-7.3/adlint/vim/GNUmakefile +1 -1
- data/share/sample/vim-7.3/adlint/vim/adlint_cinit.h +1 -1
- data/share/sample/vim-7.3/adlint/vim/adlint_pinit.h +1 -1
- data/share/sample/vim-7.3/adlint/vim/adlint_traits.yml +50 -42
- data/share/sample/vim-7.3/adlint/xxd/GNUmakefile +1 -1
- data/share/sample/vim-7.3/adlint/xxd/adlint_cinit.h +1 -1
- data/share/sample/vim-7.3/adlint/xxd/adlint_pinit.h +1 -1
- data/share/sample/vim-7.3/adlint/xxd/adlint_traits.yml +49 -41
- data/share/sample/zsh-4.3.15/adlint/GNUmakefile +1 -1
- data/share/sample/zsh-4.3.15/adlint/adlint_traits.yml +46 -38
- data/share/sample/zsh-4.3.15/adlint/builtins/GNUmakefile +1 -1
- data/share/sample/zsh-4.3.15/adlint/builtins/adlint_cinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/builtins/adlint_pinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/builtins/adlint_traits.yml +50 -42
- data/share/sample/zsh-4.3.15/adlint/core/GNUmakefile +1 -1
- data/share/sample/zsh-4.3.15/adlint/core/adlint_cinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/core/adlint_pinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/core/adlint_traits.yml +50 -42
- data/share/sample/zsh-4.3.15/adlint/modules/GNUmakefile +1 -1
- data/share/sample/zsh-4.3.15/adlint/modules/adlint_cinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/modules/adlint_pinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/modules/adlint_traits.yml +50 -42
- data/share/sample/zsh-4.3.15/adlint/zle/GNUmakefile +1 -1
- data/share/sample/zsh-4.3.15/adlint/zle/adlint_cinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/zle/adlint_pinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/zle/adlint_traits.yml +50 -42
- data/spec/adlint/{c → cc1}/ctrlexpr_spec.rb +51 -49
- data/spec/adlint/{c → cc1}/domain_spec.rb +210 -179
- data/spec/adlint/{c → cc1}/operator_spec.rb +3 -3
- data/spec/adlint/{c → cc1}/syntax_spec.rb +10 -12
- data/spec/adlint/{c → cc1}/type_spec.rb +61 -68
- data/{lib/adlint/c.rb → spec/adlint/location_spec.rb} +24 -29
- data/spec/conf.d/default_traits.yml +38 -37
- data/spec/conf.d/empty_cinit.h +1 -1
- data/spec/conf.d/empty_pinit.h +1 -1
- data/spec/conf.d/project/foo.c +0 -0
- data/spec/spec_helper.rb +2 -2
- metadata +60 -40
- data/lib/adlint/c/domain.rb +0 -7931
- data/lib/adlint/c/lexer.rb +0 -252
- data/lib/adlint/c/phase.rb +0 -135
- data/lib/adlint/exam/c_builtin/c_check.rb +0 -20745
- data/lib/adlint/exam/c_builtin/c_check_shima.rb +0 -983
- data/lib/adlint/exam/c_builtin/c_code.rb +0 -477
- data/lib/adlint/exam/c_builtin/c_metric.rb +0 -818
@@ -163,6 +163,7 @@ Feature: W9003
|
|
163
163
|
| W0286 | 5 | 5 |
|
164
164
|
| W0031 | 3 | 13 |
|
165
165
|
| W0104 | 3 | 13 |
|
166
|
+
| W0070 | 1 | 1 |
|
166
167
|
| W0628 | 3 | 5 |
|
167
168
|
|
168
169
|
Scenario: explicit conversion of size_t value
|
@@ -181,6 +182,7 @@ Feature: W9003
|
|
181
182
|
| W0117 | 3 | 5 |
|
182
183
|
| W0031 | 3 | 13 |
|
183
184
|
| W0104 | 3 | 13 |
|
185
|
+
| W0070 | 1 | 1 |
|
184
186
|
| W0628 | 3 | 5 |
|
185
187
|
|
186
188
|
Scenario: implicit conversion to void pointer
|
@@ -8,6 +8,7 @@ When /^I successfully run `(.*)` on noarch$/ do |abbrev_cmd|
|
|
8
8
|
end
|
9
9
|
|
10
10
|
Then /^the output should exactly match with:$/ do |mesg_table|
|
11
|
+
$all_output.lines.to_a.size.should == mesg_table.hashes.size
|
11
12
|
$all_output.each_line.zip(mesg_table.hashes).each do |line, row|
|
12
13
|
if row
|
13
14
|
line.should =~ /#{row[:line]}:#{row[:column]}:.*:.*:#{row[:mesg]}/
|
data/features/support/env.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
NOARCH_TRAITS = <<EOF
|
2
|
-
version: "
|
2
|
+
version: "3.0.0"
|
3
3
|
|
4
4
|
exam_packages:
|
5
5
|
- "c_builtin"
|
@@ -7,8 +7,12 @@ exam_packages:
|
|
7
7
|
project_traits:
|
8
8
|
project_name: "features"
|
9
9
|
project_root: "."
|
10
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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,10 +75,7 @@ linker_traits:
|
|
71
75
|
|
72
76
|
message_traits:
|
73
77
|
language: "ja_JP"
|
74
|
-
|
75
|
-
warn_files_in:
|
76
|
-
warn_files_not_in:
|
77
|
-
individual_selection: true
|
78
|
+
individual_suppression: true
|
78
79
|
exclusion:
|
79
80
|
inclusion:
|
80
81
|
change_list:
|
@@ -137,11 +138,13 @@ module Kernel
|
|
137
138
|
end
|
138
139
|
end
|
139
140
|
|
141
|
+
EXCL_FILES = /_pinit\.h|_cinit\.h|stdio\.h|math\.h|assert\.h|stddef\.h/
|
142
|
+
|
140
143
|
def run_adlint(cmd, *args)
|
141
144
|
create_adlint_files
|
142
145
|
cd_to_tmpdir do
|
143
146
|
$all_output = exec(cmd, *args).each_line.map { |line|
|
144
|
-
if line =~ /
|
147
|
+
if line =~ /#{EXCL_FILES}.*:warning/
|
145
148
|
nil
|
146
149
|
else
|
147
150
|
line.chomp
|
data/lib/adlint.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# AdLint package loader.
|
2
2
|
#
|
3
3
|
# Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
4
|
-
# Copyright:: Copyright (C) 2010-
|
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-
|
14
|
+
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
|
15
15
|
#
|
16
16
|
# This file is part of AdLint.
|
17
17
|
#
|
@@ -38,12 +38,13 @@ require "psych"
|
|
38
38
|
require "yaml"
|
39
39
|
require "strscan"
|
40
40
|
require "stringio"
|
41
|
-
require "singleton"
|
42
41
|
require "forwardable"
|
43
42
|
require "logger"
|
44
43
|
|
44
|
+
require "adlint/memo"
|
45
45
|
require "adlint/prelude"
|
46
46
|
require "adlint/analyzer"
|
47
|
+
require "adlint/annot"
|
47
48
|
require "adlint/code"
|
48
49
|
require "adlint/exam"
|
49
50
|
require "adlint/traits"
|
@@ -57,13 +58,15 @@ require "adlint/monitor"
|
|
57
58
|
require "adlint/phase"
|
58
59
|
require "adlint/report"
|
59
60
|
require "adlint/source"
|
61
|
+
require "adlint/supp"
|
60
62
|
require "adlint/symbol"
|
63
|
+
require "adlint/location"
|
61
64
|
require "adlint/token"
|
62
65
|
require "adlint/util"
|
63
66
|
require "adlint/version"
|
64
67
|
|
65
68
|
require "adlint/cpp"
|
66
|
-
require "adlint/
|
69
|
+
require "adlint/cc1"
|
67
70
|
require "adlint/ld"
|
68
71
|
|
69
72
|
module AdLint #:nodoc:
|
data/lib/adlint/analyzer.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Analyzer classes.
|
2
2
|
#
|
3
3
|
# Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
4
|
-
# Copyright:: Copyright (C) 2010-
|
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-
|
14
|
+
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
|
15
15
|
#
|
16
16
|
# This file is part of AdLint.
|
17
17
|
#
|
@@ -36,274 +36,248 @@ require "adlint/metric"
|
|
36
36
|
require "adlint/phase"
|
37
37
|
require "adlint/lang"
|
38
38
|
require "adlint/source"
|
39
|
+
require "adlint/supp"
|
39
40
|
require "adlint/symbol"
|
40
41
|
require "adlint/monitor"
|
42
|
+
require "adlint/util"
|
41
43
|
require "adlint/ld/phase"
|
42
44
|
|
43
45
|
module AdLint #:nodoc:
|
44
46
|
|
45
47
|
class Analyzer
|
46
|
-
def
|
47
|
-
|
48
|
+
def initialize(name, traits, msg_catalog, target_name, output_dpath,
|
49
|
+
log_basename, verbose)
|
50
|
+
@name = name
|
51
|
+
@traits = traits
|
52
|
+
@message_catalog = msg_catalog
|
53
|
+
@target_name = target_name
|
54
|
+
@output_dpath = output_dpath
|
55
|
+
@log_basename = log_basename
|
56
|
+
@verbose = verbose
|
57
|
+
@logger = nil
|
48
58
|
end
|
49
59
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
def initialize(name, log_base_fpath, output_dpath = nil)
|
55
|
-
@name = name
|
56
|
-
@log_base_fpath = log_base_fpath
|
57
|
-
@output_dpath = output_dpath
|
58
|
-
end
|
60
|
+
attr_reader :traits
|
61
|
+
attr_reader :message_catalog
|
62
|
+
attr_reader :logger
|
59
63
|
|
60
64
|
def run
|
61
65
|
File.open(log_fpath, "w") do |log_io|
|
62
|
-
@logger = Logger.new(log_io)
|
63
|
-
|
64
|
-
|
66
|
+
@logger = Logger.new(log_io).tap { |logger|
|
67
|
+
logger.progname = @name
|
68
|
+
logger.datetime_format = "%F %T "
|
69
|
+
}
|
65
70
|
begin
|
66
|
-
Analyzer.current = self
|
67
71
|
log_start_analysis
|
68
|
-
execute
|
72
|
+
execute(ProgressMonitor.new(@target_name, phases.size, @verbose))
|
69
73
|
rescue => ex
|
70
|
-
fatal(ex)
|
74
|
+
@logger.fatal(ex)
|
71
75
|
return false
|
72
|
-
ensure
|
73
|
-
Analyzer.current = nil
|
74
76
|
end
|
75
77
|
end
|
76
78
|
true
|
77
79
|
end
|
78
80
|
|
79
|
-
extend Forwardable
|
80
|
-
|
81
|
-
def_delegator :@logger, :fatal
|
82
|
-
def_delegator :@logger, :error
|
83
|
-
def_delegator :@logger, :warn
|
84
|
-
def_delegator :@logger, :info
|
85
|
-
def_delegator :@logger, :debug
|
86
|
-
|
87
81
|
private
|
88
|
-
def execute
|
82
|
+
def execute(monitor)
|
83
|
+
subclass_responsibility
|
84
|
+
end
|
85
|
+
|
86
|
+
def phases
|
89
87
|
subclass_responsibility
|
90
88
|
end
|
91
89
|
|
92
90
|
def log_fpath
|
93
|
-
|
94
|
-
|
95
|
-
else
|
96
|
-
@log_base_fpath.add_ext(".log")
|
97
|
-
end
|
91
|
+
log_fname = @log_basename.add_ext(".log")
|
92
|
+
@output_dpath ? @output_dpath.join(log_fname) : log_fname
|
98
93
|
end
|
99
94
|
|
100
95
|
def log_start_analysis
|
101
|
-
|
102
|
-
|
103
|
-
}.map { |
|
96
|
+
exam_vers = @traits.exam_packages.map { |exam_pkg|
|
97
|
+
exam_pkg.catalog
|
98
|
+
}.map { |exam_cat| "#{exam_cat.name}-#{exam_cat.short_version}" }
|
104
99
|
|
105
|
-
|
106
|
-
if
|
107
|
-
|
100
|
+
msg = "start analysis by adlint-#{SHORT_VERSION} with "
|
101
|
+
if exam_vers.size < 3
|
102
|
+
msg += exam_vers.join(" and ")
|
108
103
|
else
|
109
|
-
|
104
|
+
msg += exam_vers[0..-2].join(", ") + " and " + exam_vers.last
|
110
105
|
end
|
111
106
|
|
112
|
-
info("#{
|
107
|
+
@logger.info("#{msg}.")
|
113
108
|
end
|
114
109
|
end
|
115
110
|
|
116
111
|
# == Single module analysis driver.
|
117
112
|
class SingleModuleAnalyzer < Analyzer
|
118
|
-
def initialize(
|
119
|
-
|
120
|
-
|
121
|
-
|
113
|
+
def initialize(traits, msg_catalog, src_fpath, strip_num, output_dpath,
|
114
|
+
verbose)
|
115
|
+
super("SMA-#{SHORT_VERSION}", traits, msg_catalog, src_fpath.to_s,
|
116
|
+
output_dpath, src_fpath.strip(strip_num), verbose)
|
117
|
+
@src_fpath = src_fpath
|
122
118
|
@strip_num = strip_num
|
123
119
|
end
|
124
120
|
|
125
121
|
private
|
126
|
-
def execute
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
ProgressMonitor.instance.reset(@fpath, lang.single_module_phases.size)
|
131
|
-
|
132
|
-
Report.new(msg_fpath, met_fpath) do |report|
|
133
|
-
context = PhaseContext.new(report, log_fpath)
|
122
|
+
def execute(monitor)
|
123
|
+
Report.new(msg_fpath, met_fpath, log_fpath, @verbose) do |report|
|
124
|
+
src = Source.new(@src_fpath, @traits.of_project.file_encoding)
|
134
125
|
|
135
|
-
|
136
|
-
|
126
|
+
phase_ctxt = PhaseContext.new(self, report, monitor)
|
127
|
+
phase_ctxt[:sources] = [src]
|
128
|
+
phase_ctxt[:annotations] = []
|
129
|
+
phase_ctxt[:suppressors] = MessageSuppressorSet.new
|
130
|
+
phase_ctxt[:symbol_table] = SymbolTable.new
|
137
131
|
|
138
132
|
begin
|
139
|
-
|
140
|
-
|
141
|
-
end
|
133
|
+
phases.each { |phase| phase.new(phase_ctxt).execute }
|
134
|
+
phase_ctxt.flush_deferred_report!
|
142
135
|
ensure
|
143
136
|
File.open(i_fpath, "w") do |io|
|
144
137
|
io.set_encoding(Encoding.default_external)
|
145
|
-
io.puts(
|
138
|
+
io.puts(phase_ctxt[:cc1_source].to_s)
|
146
139
|
end
|
147
140
|
end
|
148
141
|
end
|
149
142
|
rescue
|
150
|
-
if verbose
|
151
|
-
$stderr.puts "An error was occurred while processing `#{@
|
143
|
+
if @verbose
|
144
|
+
$stderr.puts "An error was occurred while processing `#{@src_fpath}'."
|
152
145
|
$stderr.puts "See `#{msg_fpath}' and `#{log_fpath}' for more details."
|
153
146
|
end
|
154
147
|
raise
|
155
148
|
end
|
156
149
|
|
150
|
+
def phases
|
151
|
+
(lang = Language.of(@src_fpath)) ? lang.single_module_phases : []
|
152
|
+
end
|
153
|
+
|
157
154
|
def msg_fpath
|
158
|
-
|
159
|
-
|
160
|
-
else
|
161
|
-
@fpath.strip(@strip_num).add_ext(".msg.csv")
|
162
|
-
end
|
155
|
+
msg_fname = @src_fpath.strip(@strip_num).add_ext(".msg.csv")
|
156
|
+
@output_dpath ? @output_dpath.join(msg_fname) : msg_fname
|
163
157
|
end
|
164
158
|
|
165
159
|
def met_fpath
|
166
|
-
|
167
|
-
|
168
|
-
else
|
169
|
-
@fpath.strip(@strip_num).add_ext(".met.csv")
|
170
|
-
end
|
160
|
+
met_fname = @src_fpath.strip(@strip_num).add_ext(".met.csv")
|
161
|
+
@output_dpath ? @output_dpath.join(met_fname) : met_fname
|
171
162
|
end
|
172
163
|
|
173
164
|
def i_fpath
|
174
|
-
|
175
|
-
|
176
|
-
else
|
177
|
-
@fpath.strip(@strip_num).sub_ext(".i")
|
178
|
-
end
|
165
|
+
i_fname = @src_fpath.strip(@strip_num).sub_ext(".i")
|
166
|
+
@output_dpath ? @output_dpath.join(i_fname) : i_fname
|
179
167
|
end
|
180
168
|
end
|
181
169
|
|
182
170
|
class CrossModuleAnalyzer < Analyzer
|
183
|
-
def initialize(
|
184
|
-
|
185
|
-
super("CMA-#{SHORT_VERSION}",
|
186
|
-
|
187
|
-
@
|
171
|
+
def initialize(traits, msg_catalog, met_fpaths, output_dpath, verbose)
|
172
|
+
proj_name = traits.of_project.project_name
|
173
|
+
super("CMA-#{SHORT_VERSION}", traits, msg_catalog, proj_name,
|
174
|
+
output_dpath, Pathname.new(proj_name), verbose)
|
175
|
+
@met_fpaths = met_fpaths
|
188
176
|
end
|
189
177
|
|
190
178
|
private
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
AdLint::Ld::VariableReviewPhase,
|
201
|
-
AdLint::Ld::ExaminationPhase
|
202
|
-
].freeze
|
203
|
-
private_constant :PHASE_CLASSES
|
204
|
-
|
205
|
-
def execute
|
206
|
-
ProgressMonitor.instance.reset(@project_name, PHASE_CLASSES.size)
|
207
|
-
|
208
|
-
Report.new(msg_fpath, met_fpath) do |report|
|
209
|
-
context = PhaseContext.new(report, log_fpath)
|
210
|
-
|
211
|
-
context[:project_name] = @project_name
|
212
|
-
context[:metric_fpaths] = @fpaths
|
213
|
-
|
214
|
-
PHASE_CLASSES.each do |phase_class|
|
215
|
-
phase_class.new(context).execute
|
216
|
-
end
|
179
|
+
def execute(monitor)
|
180
|
+
Report.new(msg_fpath, met_fpath, log_fpath, @verbose) do |report|
|
181
|
+
phase_ctxt = PhaseContext.new(self, report, monitor)
|
182
|
+
phase_ctxt[:metric_fpaths] = @met_fpaths
|
183
|
+
phase_ctxt[:annotations] = []
|
184
|
+
phase_ctxt[:suppressors] = MessageSuppressorSet.new
|
185
|
+
|
186
|
+
phases.each { |phase| phase.new(phase_ctxt).execute }
|
187
|
+
phase_ctxt.flush_deferred_report!
|
217
188
|
end
|
218
189
|
rescue
|
219
|
-
if verbose
|
220
|
-
$stderr.puts "
|
221
|
-
"cross module analysis."
|
190
|
+
if @verbose
|
191
|
+
$stderr.puts "Error was occurred in cross module analysis."
|
222
192
|
$stderr.puts "See `#{log_fpath}' for more details."
|
223
193
|
end
|
224
194
|
raise
|
225
195
|
end
|
226
196
|
|
197
|
+
def phases
|
198
|
+
[
|
199
|
+
Ld::MapTypedefPhase,
|
200
|
+
Ld::MapFunctionPhase,
|
201
|
+
Ld::MapVariablePhase,
|
202
|
+
Ld::LinkFunctionPhase,
|
203
|
+
Ld::LinkVariablePhase,
|
204
|
+
Ld::PreparePhase,
|
205
|
+
Ld::TypedefReviewPhase,
|
206
|
+
Ld::FunctionReviewPhase,
|
207
|
+
Ld::VariableReviewPhase,
|
208
|
+
Ld::ExaminationPhase
|
209
|
+
]
|
210
|
+
end
|
211
|
+
|
227
212
|
def msg_fpath
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
Pathname.new(@project_name).add_ext(".msg.csv")
|
232
|
-
end
|
213
|
+
proj_name = @traits.of_project.project_name
|
214
|
+
msg_fname = Pathname.new(proj_name).add_ext(".msg.csv")
|
215
|
+
@output_dpath ? @output_dpath.join(msg_fname) : msg_fname
|
233
216
|
end
|
234
217
|
|
235
218
|
def met_fpath
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
Pathname.new(@project_name).add_ext(".met.csv")
|
240
|
-
end
|
219
|
+
proj_name = @traits.of_project.project_name
|
220
|
+
met_fname = Pathname.new(proj_name).add_ext(".met.csv")
|
221
|
+
@output_dpath ? @output_dpath.join(met_fname) : met_fname
|
241
222
|
end
|
242
223
|
end
|
243
224
|
|
244
225
|
# == Configuration files validator.
|
245
226
|
class ConfigurationValidator < Analyzer
|
246
|
-
def initialize(
|
247
|
-
|
248
|
-
|
249
|
-
|
227
|
+
def initialize(traits, msg_catalog, src_fpath, strip_num, output_dpath,
|
228
|
+
verbose)
|
229
|
+
super("CHK-#{SHORT_VERSION}", traits, msg_catalog, src_fpath.to_s,
|
230
|
+
output_dpath, src_fpath.strip(strip_num), verbose)
|
231
|
+
@src_fpath = src_fpath
|
250
232
|
@strip_num = strip_num
|
251
233
|
end
|
252
234
|
|
253
235
|
private
|
254
|
-
def execute
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
ProgressMonitor.instance.reset(@fpath, lang.check_phases.size)
|
236
|
+
def execute(monitor)
|
237
|
+
Report.new(msg_fpath, met_fpath, log_fpath, @verbose) do |report|
|
238
|
+
src = Source.new(@src_fpath, @traits.of_project.file_encoding)
|
259
239
|
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
240
|
+
phase_ctxt = PhaseContext.new(self, report, monitor)
|
241
|
+
phase_ctxt[:sources] = [src]
|
242
|
+
phase_ctxt[:annotations] = []
|
243
|
+
phase_ctxt[:suppressors] = MessageSuppressorSet.new
|
244
|
+
phase_ctxt[:symbol_table] = SymbolTable.new
|
265
245
|
|
266
246
|
begin
|
267
|
-
|
268
|
-
|
269
|
-
end
|
247
|
+
phases.each { |phase| phase.new(phase_ctxt).execute }
|
248
|
+
phase_ctxt.flush_deferred_report!
|
270
249
|
ensure
|
271
250
|
File.open(i_fpath, "w") do |io|
|
272
251
|
io.set_encoding(Encoding.default_external)
|
273
|
-
io.puts(
|
252
|
+
io.puts(phase_ctxt[:cc1_source].to_s)
|
274
253
|
end
|
275
254
|
end
|
276
255
|
end
|
277
256
|
rescue
|
278
|
-
if verbose
|
279
|
-
$stderr.puts "An error was occurred while processing `#{@
|
257
|
+
if @verbose
|
258
|
+
$stderr.puts "An error was occurred while processing `#{@src_fpath}'."
|
280
259
|
$stderr.puts "See `#{msg_fpath}' and `#{log_fpath}' for more details."
|
281
260
|
end
|
282
261
|
raise
|
283
262
|
end
|
284
263
|
|
264
|
+
def phases
|
265
|
+
(lang = Language.of(@src_fpath)) ? lang.check_phases : []
|
266
|
+
end
|
267
|
+
|
285
268
|
def msg_fpath
|
286
|
-
|
287
|
-
|
288
|
-
else
|
289
|
-
@fpath.strip(@strip_num).add_ext(".msg.csv")
|
290
|
-
end
|
269
|
+
msg_fname = @src_fpath.strip(@strip_num).add_ext(".msg.csv")
|
270
|
+
@output_dpath ? @output_dpath.join(msg_fname) : msg_fname
|
291
271
|
end
|
292
272
|
|
293
273
|
def met_fpath
|
294
|
-
|
295
|
-
|
296
|
-
else
|
297
|
-
@fpath.strip(@strip_num).add_ext(".met.csv")
|
298
|
-
end
|
274
|
+
met_fname = @fpath.strip(@strip_num).add_ext(".met.csv")
|
275
|
+
@output_dpath ? @output_dpath.join(met_fname) : met_fname
|
299
276
|
end
|
300
277
|
|
301
278
|
def i_fpath
|
302
|
-
|
303
|
-
|
304
|
-
else
|
305
|
-
@fpath.strip(@strip_num).sub_ext(".i")
|
306
|
-
end
|
279
|
+
i_fname = @fpath.strip(@strip_num).sub_ext(".i")
|
280
|
+
@output_dpath ? @output_dpath.join(i_fname) : i_fname
|
307
281
|
end
|
308
282
|
end
|
309
283
|
|