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
data/lib/adlint/ld/phase.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Phases of cross module analysis.
|
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
|
#
|
@@ -30,6 +30,8 @@
|
|
30
30
|
#++
|
31
31
|
|
32
32
|
require "adlint/phase"
|
33
|
+
require "adlint/annot"
|
34
|
+
require "adlint/cpp/lexer"
|
33
35
|
require "adlint/ld/object"
|
34
36
|
require "adlint/ld/typedef"
|
35
37
|
require "adlint/ld/util"
|
@@ -38,153 +40,182 @@ module AdLint #:nodoc:
|
|
38
40
|
module Ld #:nodoc:
|
39
41
|
|
40
42
|
class LdPhase < Phase
|
41
|
-
def initialize(
|
42
|
-
super(
|
43
|
+
def initialize(phase_ctxt, phase_name)
|
44
|
+
super(phase_ctxt, "ld", phase_name)
|
43
45
|
end
|
44
46
|
end
|
45
47
|
|
46
48
|
class MapTypedefPhase < LdPhase
|
47
|
-
def initialize(
|
48
|
-
super(
|
49
|
+
def initialize(phase_ctxt)
|
50
|
+
super(phase_ctxt, "mtd")
|
49
51
|
end
|
50
52
|
|
51
53
|
private
|
52
|
-
def do_execute(
|
54
|
+
def do_execute(phase_ctxt, monitor)
|
53
55
|
mapper = TypedefMapper.new
|
54
|
-
|
56
|
+
phase_ctxt[:metric_fpaths].each do |fpath|
|
55
57
|
mapper.execute(fpath)
|
56
|
-
monitor.progress += 1.0 /
|
58
|
+
monitor.progress += 1.0 / phase_ctxt[:metric_fpaths].size
|
57
59
|
end
|
58
|
-
|
60
|
+
phase_ctxt[:ld_typedef_mapping] = mapper.result
|
59
61
|
end
|
60
62
|
end
|
61
63
|
|
62
64
|
class MapFunctionPhase < LdPhase
|
63
|
-
def initialize(
|
64
|
-
super(
|
65
|
+
def initialize(phase_ctxt)
|
66
|
+
super(phase_ctxt, "mfn")
|
65
67
|
end
|
66
68
|
|
67
69
|
private
|
68
|
-
def do_execute(
|
70
|
+
def do_execute(phase_ctxt, monitor)
|
69
71
|
mapper = FunctionMapper.new
|
70
|
-
|
72
|
+
phase_ctxt[:metric_fpaths].each do |fpath|
|
71
73
|
mapper.execute(fpath)
|
72
|
-
monitor.progress += 1.0 /
|
74
|
+
monitor.progress += 1.0 / phase_ctxt[:metric_fpaths].size
|
73
75
|
end
|
74
|
-
|
76
|
+
phase_ctxt[:ld_function_mapping] = mapper.result
|
75
77
|
end
|
76
78
|
end
|
77
79
|
|
78
80
|
class MapVariablePhase < LdPhase
|
79
|
-
def initialize(
|
80
|
-
super(
|
81
|
+
def initialize(phase_ctxt)
|
82
|
+
super(phase_ctxt, "mvr")
|
81
83
|
end
|
82
84
|
|
83
85
|
private
|
84
|
-
def do_execute(
|
86
|
+
def do_execute(phase_ctxt, monitor)
|
85
87
|
mapper = VariableMapper.new
|
86
|
-
|
88
|
+
phase_ctxt[:metric_fpaths].each do |fpath|
|
87
89
|
mapper.execute(fpath)
|
88
|
-
monitor.progress += 1.0 /
|
90
|
+
monitor.progress += 1.0 / phase_ctxt[:metric_fpaths].size
|
89
91
|
end
|
90
|
-
|
92
|
+
phase_ctxt[:ld_variable_mapping] = mapper.result
|
91
93
|
end
|
92
94
|
end
|
93
95
|
|
94
96
|
class LinkFunctionPhase < LdPhase
|
95
|
-
def initialize(
|
96
|
-
super(
|
97
|
+
def initialize(phase_ctxt)
|
98
|
+
super(phase_ctxt, "lfn")
|
97
99
|
end
|
98
100
|
|
99
101
|
private
|
100
|
-
def do_execute(
|
101
|
-
builder = FunctionCallGraphBuilder.new(
|
102
|
-
|
102
|
+
def do_execute(phase_ctxt, monitor)
|
103
|
+
builder = FunctionCallGraphBuilder.new(phase_ctxt[:ld_function_mapping])
|
104
|
+
phase_ctxt[:metric_fpaths].each do |fpath|
|
103
105
|
builder.execute(fpath)
|
104
|
-
monitor.progress += 1.0 /
|
106
|
+
monitor.progress += 1.0 / phase_ctxt[:metric_fpaths].size
|
105
107
|
end
|
106
|
-
|
108
|
+
phase_ctxt[:ld_function_call_graph] = builder.result
|
107
109
|
ensure
|
108
|
-
DebugUtil.dump_function_call_graph(
|
110
|
+
DebugUtil.dump_function_call_graph(phase_ctxt)
|
109
111
|
end
|
110
112
|
end
|
111
113
|
|
112
114
|
class LinkVariablePhase < LdPhase
|
113
|
-
def initialize(
|
114
|
-
super(
|
115
|
+
def initialize(phase_ctxt)
|
116
|
+
super(phase_ctxt, "lvr")
|
115
117
|
end
|
116
118
|
|
117
119
|
private
|
118
|
-
def do_execute(
|
120
|
+
def do_execute(phase_ctxt, monitor)
|
119
121
|
builder = VariableReferenceGraphBuilder.new(
|
120
|
-
|
121
|
-
|
122
|
-
|
122
|
+
phase_ctxt[:ld_variable_mapping], phase_ctxt[:ld_function_mapping],
|
123
|
+
phase_ctxt[:ld_function_call_graph])
|
124
|
+
phase_ctxt[:metric_fpaths].each do |fpath|
|
123
125
|
builder.execute(fpath)
|
124
|
-
monitor.progress += 1.0 /
|
126
|
+
monitor.progress += 1.0 / phase_ctxt[:metric_fpaths].size
|
125
127
|
end
|
126
|
-
|
128
|
+
phase_ctxt[:ld_variable_reference_graph] = builder.result
|
127
129
|
ensure
|
128
|
-
DebugUtil.dump_variable_reference_graph(
|
130
|
+
DebugUtil.dump_variable_reference_graph(phase_ctxt)
|
129
131
|
end
|
130
132
|
end
|
131
133
|
|
132
134
|
class PreparePhase < LdPhase
|
133
|
-
def initialize(
|
134
|
-
super(
|
135
|
+
def initialize(phase_ctxt)
|
136
|
+
super(phase_ctxt, "pre")
|
135
137
|
end
|
136
138
|
|
137
139
|
private
|
138
|
-
def do_execute(
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
140
|
+
def do_execute(phase_ctxt, *)
|
141
|
+
collect_annotations
|
142
|
+
phase_ctxt[:ld_typedef_traversal] =
|
143
|
+
TypedefTraversal.new(phase_ctxt[:ld_typedef_mapping])
|
144
|
+
phase_ctxt[:ld_function_traversal] =
|
145
|
+
FunctionTraversal.new(phase_ctxt[:ld_function_mapping])
|
146
|
+
phase_ctxt[:ld_variable_traversal] =
|
147
|
+
VariableTraversal.new(phase_ctxt[:ld_variable_mapping])
|
148
|
+
end
|
149
|
+
|
150
|
+
def collect_annotations
|
151
|
+
composing_fpaths.each do |fpath|
|
152
|
+
lexer = Cpp::Lexer.new(
|
153
|
+
Source.new(fpath, traits.of_project.file_encoding), traits)
|
154
|
+
|
155
|
+
parser = method(:parse_annotation)
|
156
|
+
lexer.on_line_comment_found += parser
|
157
|
+
lexer.on_block_comment_found += parser
|
158
|
+
while lexer.next_token; end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
def composing_fpaths
|
163
|
+
@phase_ctxt[:ld_function_mapping].composing_fpaths +
|
164
|
+
@phase_ctxt[:ld_variable_mapping].composing_fpaths +
|
165
|
+
@phase_ctxt[:ld_typedef_mapping].composing_fpaths
|
166
|
+
end
|
167
|
+
|
168
|
+
def parse_annotation(comment, loc)
|
169
|
+
if annot = Annotation.parse(comment, loc)
|
170
|
+
@phase_ctxt[:annotations].push(annot)
|
171
|
+
if annot.message_suppression_specifier? &&
|
172
|
+
traits.of_message.individual_suppression
|
173
|
+
@phase_ctxt[:suppressors].add(annot.create_suppressor)
|
174
|
+
end
|
175
|
+
end
|
145
176
|
end
|
146
177
|
end
|
147
178
|
|
148
179
|
class TypedefReviewPhase < LdPhase
|
149
|
-
def initialize(
|
150
|
-
super(
|
180
|
+
def initialize(phase_ctxt)
|
181
|
+
super(phase_ctxt, "rtd")
|
151
182
|
end
|
152
183
|
|
153
184
|
private
|
154
|
-
def do_execute(
|
155
|
-
|
185
|
+
def do_execute(phase_ctxt, *)
|
186
|
+
phase_ctxt[:ld_typedef_traversal].execute
|
156
187
|
end
|
157
188
|
end
|
158
189
|
|
159
190
|
class FunctionReviewPhase < LdPhase
|
160
|
-
def initialize(
|
161
|
-
super(
|
191
|
+
def initialize(phase_ctxt)
|
192
|
+
super(phase_ctxt, "rfn")
|
162
193
|
end
|
163
194
|
|
164
195
|
private
|
165
|
-
def do_execute(
|
166
|
-
|
196
|
+
def do_execute(phase_ctxt, *)
|
197
|
+
phase_ctxt[:ld_function_traversal].execute
|
167
198
|
end
|
168
199
|
end
|
169
200
|
|
170
201
|
class VariableReviewPhase < LdPhase
|
171
|
-
def initialize(
|
172
|
-
super(
|
202
|
+
def initialize(phase_ctxt)
|
203
|
+
super(phase_ctxt, "rvr")
|
173
204
|
end
|
174
205
|
|
175
206
|
private
|
176
|
-
def do_execute(
|
177
|
-
|
207
|
+
def do_execute(phase_ctxt, *)
|
208
|
+
phase_ctxt[:ld_variable_traversal].execute
|
178
209
|
end
|
179
210
|
end
|
180
211
|
|
181
212
|
class ExaminationPhase < LdPhase
|
182
|
-
def initialize(
|
183
|
-
super(
|
213
|
+
def initialize(phase_ctxt)
|
214
|
+
super(phase_ctxt, "exm")
|
184
215
|
end
|
185
216
|
|
186
217
|
private
|
187
|
-
def do_execute(
|
218
|
+
def do_execute(phase_ctxt, *)
|
188
219
|
examinations.each { |exam| exam.execute }
|
189
220
|
end
|
190
221
|
end
|
data/lib/adlint/ld/typedef.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# C typedef models for cross module analysis.
|
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
|
#
|
@@ -29,15 +29,18 @@
|
|
29
29
|
#
|
30
30
|
#++
|
31
31
|
|
32
|
+
require "adlint/location"
|
32
33
|
require "adlint/metric"
|
33
34
|
|
34
35
|
module AdLint #:nodoc:
|
35
36
|
module Ld #:nodoc:
|
36
37
|
|
37
38
|
class Typedef
|
38
|
-
|
39
|
+
include LocationHolder
|
40
|
+
|
41
|
+
def initialize(name, loc)
|
39
42
|
@name = name
|
40
|
-
@location =
|
43
|
+
@location = loc
|
41
44
|
end
|
42
45
|
|
43
46
|
attr_reader :name
|
@@ -57,10 +60,14 @@ module Ld #:nodoc:
|
|
57
60
|
class TypedefMapping
|
58
61
|
def initialize
|
59
62
|
@name_index = Hash.new { |hash, key| hash[key] = Set.new }
|
63
|
+
@composing_fpaths = Set.new
|
60
64
|
end
|
61
65
|
|
66
|
+
attr_reader :composing_fpaths
|
67
|
+
|
62
68
|
def add(typedef)
|
63
69
|
@name_index[typedef.name].add(typedef)
|
70
|
+
@composing_fpaths.add(typedef.location.fpath)
|
64
71
|
end
|
65
72
|
|
66
73
|
def all_typedefs
|
@@ -81,11 +88,15 @@ module Ld #:nodoc:
|
|
81
88
|
|
82
89
|
attr_reader :result
|
83
90
|
|
84
|
-
def execute(
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
91
|
+
def execute(met_fpath)
|
92
|
+
sma_wd = Pathname.pwd
|
93
|
+
CSV.foreach(met_fpath) do |csv_row|
|
94
|
+
rec = MetricRecord.of(csv_row, sma_wd)
|
95
|
+
case
|
96
|
+
when rec.version?
|
97
|
+
sma_wd = Pathname.new(rec.exec_working_directory)
|
98
|
+
when rec.typedef_declaration?
|
99
|
+
@result.add(Typedef.new(rec.type_name, rec.location))
|
89
100
|
end
|
90
101
|
end
|
91
102
|
end
|
@@ -98,10 +109,10 @@ module Ld #:nodoc:
|
|
98
109
|
|
99
110
|
extend Pluggable
|
100
111
|
|
101
|
-
def_plugin :
|
112
|
+
def_plugin :on_declaration
|
102
113
|
|
103
114
|
def execute
|
104
|
-
@typedef_mapping.all_typedefs.each { |tdef|
|
115
|
+
@typedef_mapping.all_typedefs.each { |tdef| on_declaration.invoke(tdef) }
|
105
116
|
end
|
106
117
|
end
|
107
118
|
|
data/lib/adlint/ld/util.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Miscellaneous utilities for cross module analysis.
|
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
|
#
|
@@ -33,51 +33,59 @@ module AdLint #:nodoc:
|
|
33
33
|
module Ld #:nodoc:
|
34
34
|
|
35
35
|
module DebugUtil
|
36
|
-
def dump_function_call_graph(
|
37
|
-
|
36
|
+
def dump_function_call_graph(phase_ctxt)
|
37
|
+
if $DEBUG
|
38
|
+
proj_name = phase_ctxt.traits.of_project.project_name
|
39
|
+
map_fname = Pathname.new("#{proj_name}.map")
|
40
|
+
map_fpath = map_fname.expand_path(phase_ctxt.msg_fpath.dirname)
|
38
41
|
|
39
|
-
|
40
|
-
|
41
|
-
call_graph = context[:ld_function_call_graph]
|
42
|
+
mapping = phase_ctxt[:ld_function_mapping]
|
43
|
+
call_graph = phase_ctxt[:ld_function_call_graph]
|
42
44
|
return unless mapping && call_graph
|
43
45
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
File.open(map_fpath, "w") do |io|
|
47
|
+
io.puts("-- Function Call Graph --")
|
48
|
+
mapping.all_functions.each do |callee|
|
49
|
+
io.puts("DC of #{callee.signature}")
|
50
|
+
call_graph.direct_callers_of(callee).each do |fun|
|
51
|
+
io.puts(" #{fun.signature}")
|
52
|
+
end
|
53
|
+
io.puts
|
54
|
+
io.puts("IC of #{callee.signature}")
|
55
|
+
call_graph.indirect_callers_of(callee).each do |fun|
|
56
|
+
io.puts(" #{fun.signature}")
|
57
|
+
end
|
58
|
+
io.puts
|
49
59
|
end
|
50
|
-
io.puts
|
51
|
-
io.puts("IC of #{callee.signature}")
|
52
|
-
call_graph.indirect_callers_of(callee).each do |f|
|
53
|
-
io.puts(" #{f.signature}")
|
54
|
-
end
|
55
|
-
io.puts
|
56
60
|
end
|
57
61
|
end
|
58
62
|
end
|
59
63
|
module_function :dump_function_call_graph
|
60
64
|
|
61
|
-
def dump_variable_reference_graph(
|
62
|
-
|
65
|
+
def dump_variable_reference_graph(phase_ctxt)
|
66
|
+
if $DEBUG
|
67
|
+
proj_name = phase_ctxt.traits.of_project.project_name
|
68
|
+
map_fname = Pathname.new("#{proj_name}.map")
|
69
|
+
map_fpath = map_fname.expand_path(phase_ctxt.msg_fpath.dirname)
|
63
70
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
return unless mapping && reference_graph
|
71
|
+
mapping = phase_ctxt[:ld_variable_mapping]
|
72
|
+
ref_graph = phase_ctxt[:ld_variable_reference_graph]
|
73
|
+
return unless mapping && ref_graph
|
68
74
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
75
|
+
File.open(map_fpath, "a") do |io|
|
76
|
+
io.puts("-- Variable Reference Graph --")
|
77
|
+
mapping.all_variables.each do |accessee|
|
78
|
+
io.puts("DR of #{accessee.name}")
|
79
|
+
ref_graph.direct_referrers_of(accessee).each do |fun|
|
80
|
+
io.puts(" #{fun.signature}")
|
81
|
+
end
|
82
|
+
io.puts
|
83
|
+
io.puts("IR or #{accessee.signature}")
|
84
|
+
ref_graph.indirect_referrers_of(accessee).each do |fun|
|
85
|
+
io.puts(" #{fun.signature}")
|
86
|
+
end
|
87
|
+
io.puts
|
79
88
|
end
|
80
|
-
io.puts
|
81
89
|
end
|
82
90
|
end
|
83
91
|
end
|