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/report.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Analysis report and its manipulation utility.
|
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,7 +29,6 @@
|
|
29
29
|
#
|
30
30
|
#++
|
31
31
|
|
32
|
-
require "adlint/exam"
|
33
32
|
require "adlint/message"
|
34
33
|
require "adlint/code"
|
35
34
|
require "adlint/metric"
|
@@ -37,19 +36,16 @@ require "adlint/util"
|
|
37
36
|
|
38
37
|
module AdLint #:nodoc:
|
39
38
|
|
40
|
-
# == DESCRIPTION
|
41
|
-
# Report information collector.
|
42
39
|
class Report
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
@
|
47
|
-
@
|
48
|
-
|
49
|
-
@
|
50
|
-
@
|
51
|
-
|
52
|
-
@unique_messages = Set.new
|
40
|
+
def initialize(msg_fpath, met_fpath, log_fpath, verbose, &block)
|
41
|
+
@msg_fpath = msg_fpath
|
42
|
+
@msg_file = open_msg_file(msg_fpath)
|
43
|
+
@met_fpath = met_fpath
|
44
|
+
@met_file = open_met_file(met_fpath)
|
45
|
+
@log_fpath = log_fpath
|
46
|
+
@verbose = verbose
|
47
|
+
@unique_msgs = Set.new
|
48
|
+
@deferred_msgs = []
|
53
49
|
|
54
50
|
yield(self)
|
55
51
|
ensure
|
@@ -59,55 +55,77 @@ module AdLint #:nodoc:
|
|
59
55
|
|
60
56
|
attr_reader :msg_fpath
|
61
57
|
attr_reader :met_fpath
|
58
|
+
attr_reader :log_fpath
|
62
59
|
|
63
60
|
# === DESCRIPTION
|
64
|
-
#
|
61
|
+
# Writes a message on this report.
|
65
62
|
#
|
66
63
|
# === PARAMETER
|
67
|
-
# _message_:: Message -- Message to be
|
64
|
+
# _message_:: Message -- Message to be written.
|
68
65
|
#
|
69
66
|
# === RETURN VALUE
|
70
67
|
# Report -- Self.
|
71
|
-
def
|
72
|
-
|
73
|
-
|
68
|
+
def write_message(msg, suppressors = nil)
|
69
|
+
if suppressors.nil? || !suppressors.suppress?(msg)
|
70
|
+
unless msg.must_be_unique? && !@unique_msgs.add?(msg)
|
71
|
+
if msg.must_be_deferred?
|
72
|
+
@deferred_msgs.push(msg)
|
73
|
+
else
|
74
|
+
rawrite_message(msg)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
74
78
|
self
|
75
79
|
end
|
76
80
|
|
77
|
-
def
|
78
|
-
|
79
|
-
|
81
|
+
def flush_deferred_messages(suppressors)
|
82
|
+
@deferred_msgs.each do |msg|
|
83
|
+
rawrite_message(msg) unless suppressors.suppress?(msg)
|
80
84
|
end
|
85
|
+
@deferred_msgs.clear
|
81
86
|
self
|
82
87
|
end
|
83
88
|
|
84
89
|
# === DESCRIPTION
|
85
|
-
#
|
90
|
+
# Writes a code structure information on this report.
|
86
91
|
#
|
87
92
|
# === PARAMETER
|
88
|
-
# _code_struct_:: CodeStructure -- Code structure
|
93
|
+
# _code_struct_:: CodeStructure -- Code structure info to be written.
|
89
94
|
#
|
90
95
|
# === RETURN VALUE
|
91
96
|
# Report -- Self.
|
92
|
-
def
|
93
|
-
@met_file
|
97
|
+
def write_code_struct(code_struct)
|
98
|
+
code_struct.print_as_csv(@met_file)
|
94
99
|
self
|
95
100
|
end
|
96
101
|
|
97
|
-
|
98
|
-
|
102
|
+
# === DESCRIPTION
|
103
|
+
# Writes a code quality metric on this report.
|
104
|
+
#
|
105
|
+
# === PARAMETER
|
106
|
+
# _code_metric_:: CodeMetric -- Code metric information to be written.
|
107
|
+
#
|
108
|
+
# === RETURN VALUE
|
109
|
+
# Report -- Self.
|
110
|
+
def write_code_metric(code_metric)
|
111
|
+
code_metric.print_as_csv(@met_file)
|
99
112
|
self
|
100
113
|
end
|
101
114
|
|
102
115
|
private
|
103
|
-
def
|
116
|
+
def rawrite_message(msg)
|
117
|
+
msg.print_as_csv(@msg_file)
|
118
|
+
msg.print_as_str($stderr) unless @verbose
|
119
|
+
end
|
120
|
+
|
121
|
+
def open_msg_file(fpath)
|
104
122
|
File.open(fpath, "w").tap do |io|
|
105
123
|
io.set_encoding(Encoding.default_external)
|
106
124
|
io.puts(["V", SHORT_VERSION, Time.now.to_s, Dir.getwd].to_csv)
|
107
125
|
end
|
108
126
|
end
|
109
127
|
|
110
|
-
def
|
128
|
+
def open_met_file(fpath)
|
111
129
|
File.open(fpath, "w").tap do |io|
|
112
130
|
io.set_encoding(Encoding.default_external)
|
113
131
|
io.puts(["VER", SHORT_VERSION, Time.now.to_s, Dir.getwd].to_csv)
|
@@ -115,513 +133,416 @@ module AdLint #:nodoc:
|
|
115
133
|
end
|
116
134
|
end
|
117
135
|
|
118
|
-
module MessageUniqueness
|
119
|
-
@@messages_to_be_unique = Set.new
|
120
|
-
|
121
|
-
def ensure_uniqueness_of(message_id)
|
122
|
-
@@messages_to_be_unique.add(message_id)
|
123
|
-
nil
|
124
|
-
end
|
125
|
-
|
126
|
-
def must_be_unique?(message_id)
|
127
|
-
@@messages_to_be_unique.include?(message_id)
|
128
|
-
end
|
129
|
-
module_function :must_be_unique?
|
130
|
-
end
|
131
|
-
|
132
|
-
# == DESCRIPTION
|
133
|
-
# Report manipulation utility.
|
134
136
|
module ReportUtil
|
137
|
+
# NOTE: Host class must respond to #report.
|
138
|
+
# NOTE: Host class must respond to #message_catalog.
|
139
|
+
# NOTE: Host class which needs #write_warning_message must respond to
|
140
|
+
# #suppressors.
|
141
|
+
|
135
142
|
# === DESCRIPTION
|
136
|
-
#
|
143
|
+
# Writes an error message on the report.
|
137
144
|
#
|
138
145
|
# Abbreviation below is available.
|
139
|
-
#
|
146
|
+
# write_error_message(msg_name, loc, ...) => E(msg_name, loc, ...)
|
140
147
|
#
|
141
148
|
# === PARAMETER
|
142
|
-
#
|
143
|
-
#
|
149
|
+
# _msg_name_:: Symbol -- Message name.
|
150
|
+
# _loc_:: Location -- Location where the message points to.
|
144
151
|
# _parts_:: Array< Object > -- Message formatting parts.
|
145
152
|
#
|
146
153
|
# === RETURN VALUE
|
147
154
|
# None.
|
148
|
-
def
|
149
|
-
|
155
|
+
def write_error_message(msg_name, loc, *parts)
|
156
|
+
report.write_message(
|
157
|
+
ErrorMessage.new(message_catalog, msg_name, loc, *parts))
|
150
158
|
end
|
151
|
-
alias :E :
|
152
|
-
module_function :add_error_message, :E
|
159
|
+
alias :E :write_error_message
|
153
160
|
|
154
161
|
# === DESCRIPTION
|
155
|
-
#
|
162
|
+
# Writes a warning message on the report.
|
156
163
|
#
|
157
164
|
# Abbreviation below is available.
|
158
|
-
#
|
165
|
+
# write_warning_message(loc, ...) => W(loc, ...)
|
159
166
|
#
|
160
167
|
# === PARAMETER
|
161
|
-
#
|
162
|
-
# _location_:: Location -- Location where the message detected.
|
163
|
-
# _parts_:: Array< Object > -- Message formatting parts.
|
168
|
+
# _loc_:: Location -- Location where the message points to.
|
164
169
|
#
|
165
170
|
# === RETURN VALUE
|
166
171
|
# None.
|
167
|
-
def
|
168
|
-
|
169
|
-
|
170
|
-
|
172
|
+
def write_warning_message(*args)
|
173
|
+
check_class = self.class
|
174
|
+
check_class = check_class.outer_module until check_class < CodeCheck
|
175
|
+
|
176
|
+
head_msg = nil
|
177
|
+
args.chunk { |arg| arg.kind_of?(Message) }.each do |*, chunk|
|
178
|
+
case chunk.first
|
179
|
+
when Message
|
180
|
+
if head_msg
|
181
|
+
chunk.each { |ctxt_msg| head_msg.complement_with(ctxt_msg) }
|
182
|
+
end
|
183
|
+
else
|
184
|
+
head_msg = WarningMessage.new(message_catalog, check_class, *chunk)
|
185
|
+
end
|
186
|
+
end
|
171
187
|
|
172
|
-
|
173
|
-
add_warning_message(PackageResolver.package_name_of(self.class),
|
174
|
-
id, location, *parts)
|
188
|
+
report.write_message(head_msg, suppressors) if head_msg
|
175
189
|
end
|
176
|
-
|
190
|
+
alias :W :write_warning_message
|
177
191
|
|
178
192
|
# === DESCRIPTION
|
179
|
-
#
|
193
|
+
# Creates a context message.
|
180
194
|
#
|
181
195
|
# Abbreviation below is available.
|
182
|
-
#
|
196
|
+
# create_context_message(msg_name, loc, ...) => C(msg_name, loc, ...)
|
183
197
|
#
|
184
198
|
# === PARAMETER
|
185
|
-
#
|
186
|
-
#
|
199
|
+
# _msg_name_:: Symbol -- Message name.
|
200
|
+
# _loc_:: Location -- Location where the message points to.
|
187
201
|
# _parts_:: Array< Object > -- Message formatting parts.
|
188
202
|
#
|
189
203
|
# === RETURN VALUE
|
190
|
-
#
|
191
|
-
def
|
192
|
-
|
193
|
-
end
|
194
|
-
module_function :add_context_message
|
195
|
-
|
196
|
-
def C(id, location, *parts)
|
197
|
-
add_context_message(PackageResolver.package_name_of(self.class),
|
198
|
-
id, location, *parts)
|
204
|
+
# ContextMessage -- New context message.
|
205
|
+
def create_context_message(msg_name, loc, *parts)
|
206
|
+
ContextMessage.new(message_catalog, msg_name, self.class, loc, *parts)
|
199
207
|
end
|
200
|
-
|
208
|
+
alias :C :create_context_message
|
201
209
|
|
202
210
|
# === DESCRIPTION
|
203
|
-
#
|
204
|
-
#
|
205
|
-
# === PARAMETER
|
206
|
-
# _message_:: Message -- Message to be added.
|
207
|
-
#
|
208
|
-
# === RETURN VALUE
|
209
|
-
# None.
|
210
|
-
def add_message(message)
|
211
|
-
if MessageUniqueness.must_be_unique?(message.id)
|
212
|
-
report.add_unique_message(message)
|
213
|
-
else
|
214
|
-
report.add_message(message)
|
215
|
-
end
|
216
|
-
nil
|
217
|
-
end
|
218
|
-
module_function :add_message
|
219
|
-
|
220
|
-
# === DESCRIPTION
|
221
|
-
# Adds type declaration information to the report.
|
211
|
+
# Writes a type declaration information on the report.
|
222
212
|
#
|
223
213
|
# Abbreviation below is available.
|
224
|
-
#
|
214
|
+
# write_typedcl(...) => TYPEDCL(...)
|
225
215
|
#
|
226
216
|
# === PARAMETER
|
227
|
-
#
|
228
|
-
#
|
217
|
+
# _loc_:: Location -- Location where the declaration appears.
|
218
|
+
# _dcl_type_:: String -- Type declaration type.
|
229
219
|
# _type_name_:: String -- Type name.
|
230
220
|
# _type_rep_:: String -- Type representation string.
|
231
221
|
#
|
232
222
|
# === RETURN VALUE
|
233
223
|
# None.
|
234
|
-
def
|
235
|
-
|
224
|
+
def write_typedcl(loc, dcl_type, type_name, type_rep)
|
225
|
+
write_code_struct(TypeDcl.new(loc, dcl_type, type_name, type_rep))
|
236
226
|
end
|
237
|
-
alias :TYPEDCL :
|
238
|
-
module_function :add_typedcl, :TYPEDCL
|
227
|
+
alias :TYPEDCL :write_typedcl
|
239
228
|
|
240
229
|
# === DESCRIPTION
|
241
|
-
#
|
230
|
+
# Writes a global variable decaration information on the report.
|
242
231
|
#
|
243
232
|
# Abbreviation below is available.
|
244
|
-
#
|
233
|
+
# write_gvardcl(...) => GVARDCL(...)
|
245
234
|
#
|
246
235
|
# === PARAMETER
|
247
|
-
#
|
248
|
-
#
|
236
|
+
# _loc_:: Location -- Location where the declaration appears.
|
237
|
+
# _var_name_:: String -- Global variable name.
|
249
238
|
# _type_rep_:: String -- Type representation string.
|
250
239
|
#
|
251
240
|
# === RETURN VALUE
|
252
241
|
# None.
|
253
|
-
def
|
254
|
-
|
242
|
+
def write_gvardcl(loc, var_name, type_rep)
|
243
|
+
write_code_struct(GVarDcl.new(loc, var_name, type_rep))
|
255
244
|
end
|
256
|
-
alias :GVARDCL :
|
257
|
-
module_function :add_gvardcl, :GVARDCL
|
245
|
+
alias :GVARDCL :write_gvardcl
|
258
246
|
|
259
247
|
# === DESCRIPTION
|
260
|
-
#
|
248
|
+
# Writes a function declaration information on the report.
|
261
249
|
#
|
262
250
|
# Abbreviation below is available.
|
263
|
-
#
|
251
|
+
# write_funcdcl(...) => FUNCDCL(...)
|
264
252
|
#
|
265
253
|
# === PARAMETER
|
266
|
-
#
|
267
|
-
#
|
268
|
-
#
|
269
|
-
#
|
254
|
+
# _loc_:: Location -- Location where the declaration appears.
|
255
|
+
# _linkage_:: String -- Function linkage type string.
|
256
|
+
# _scope_type_:: String -- Declaration scope type string.
|
257
|
+
# _dcl_type_:: String -- Declaration type string.
|
258
|
+
# _fun_id_:: FunctionId -- Identifier of the function.
|
270
259
|
#
|
271
260
|
# === RETURN VALUE
|
272
261
|
# None.
|
273
|
-
def
|
274
|
-
|
275
|
-
|
276
|
-
function_scope_type, function_identifier))
|
262
|
+
def write_funcdcl(loc, linkage, scope_type, dcl_type, fun_id)
|
263
|
+
write_code_struct(FuncDcl.new(loc, linkage, scope_type, dcl_type,
|
264
|
+
fun_id))
|
277
265
|
end
|
278
|
-
alias :FUNCDCL :
|
279
|
-
module_function :add_funcdcl, :FUNCDCL
|
266
|
+
alias :FUNCDCL :write_funcdcl
|
280
267
|
|
281
268
|
# === DESCRIPTION
|
282
|
-
#
|
269
|
+
# Writes a variable definition information on the report.
|
283
270
|
#
|
284
271
|
# Abbreviation below is available.
|
285
|
-
#
|
272
|
+
# write_vardef(...) => VARDEF(...)
|
286
273
|
#
|
287
274
|
# === PARAMETER
|
288
|
-
#
|
289
|
-
#
|
290
|
-
#
|
291
|
-
#
|
292
|
-
#
|
275
|
+
# _loc_:: Location -- Location where the definition appears.
|
276
|
+
# _linkage_type_:: String -- Variable linkage type string.
|
277
|
+
# _scope_type_:: String -- Variable scope type string.
|
278
|
+
# _sc_type_:: String -- Variable storage class type.
|
279
|
+
# _var_name_:: String -- Variable name.
|
293
280
|
# _type_rep_:: String -- Variable type representation string.
|
294
281
|
#
|
295
282
|
# === RETURN VALUE
|
296
283
|
# None.
|
297
|
-
def
|
298
|
-
|
299
|
-
|
300
|
-
storage_class_type, variable_name, type_rep))
|
284
|
+
def write_vardef(loc, linkage, scope_type, sc_type, var_name, type_rep)
|
285
|
+
write_code_struct(VarDef.new(loc, linkage, scope_type, sc_type, var_name,
|
286
|
+
type_rep))
|
301
287
|
end
|
302
|
-
alias :VARDEF :
|
303
|
-
module_function :add_vardef, :VARDEF
|
288
|
+
alias :VARDEF :write_vardef
|
304
289
|
|
305
290
|
# === DESCRIPTION
|
306
|
-
#
|
291
|
+
# Writes a function definition information on the report.
|
307
292
|
#
|
308
293
|
# Abbreviation below is available.
|
309
|
-
#
|
294
|
+
# write_funcdef(...) => FUNCDEF(...)
|
310
295
|
#
|
311
296
|
# === PARAMETER
|
312
|
-
#
|
313
|
-
#
|
314
|
-
#
|
315
|
-
#
|
297
|
+
# _loc_:: Location -- Location where the definition appears.
|
298
|
+
# _linkage_:: String -- Function linkage type string.
|
299
|
+
# _scope_type_:: String -- Definition scope type string.
|
300
|
+
# _fun_id_:: FunctionId -- Identifier of the function.
|
316
301
|
# _lines_:: Integer -- Physical lines.
|
317
302
|
#
|
318
303
|
# === RETURN VALUE
|
319
304
|
# None.
|
320
|
-
def
|
321
|
-
|
322
|
-
add_code_struct(FuncDef.new(location, function_linkage_type,
|
323
|
-
function_scope_type, function_identifier,
|
324
|
-
lines))
|
305
|
+
def write_funcdef(loc, linkage, scope_type, fun_id, lines)
|
306
|
+
write_code_struct(FuncDef.new(loc, linkage, scope_type, fun_id, lines))
|
325
307
|
end
|
326
|
-
alias :FUNCDEF :
|
327
|
-
module_function :add_funcdef, :FUNCDEF
|
308
|
+
alias :FUNCDEF :write_funcdef
|
328
309
|
|
329
310
|
# === DESCRIPTION
|
330
|
-
#
|
311
|
+
# Writes a macro definition information on the report.
|
331
312
|
#
|
332
313
|
# Abbreviation below is available.
|
333
|
-
#
|
314
|
+
# write_macrodef(...) => MACRODEF(...)
|
334
315
|
#
|
335
316
|
# === PARAMETER
|
336
|
-
#
|
317
|
+
# _loc_:: Location -- Location where the definition appears.
|
337
318
|
# _macro_name_:: String -- Macro name.
|
338
319
|
# _macro_type_:: String -- Macro type string.
|
339
320
|
#
|
340
321
|
# === RETURN VALUE
|
341
322
|
# None.
|
342
|
-
def
|
343
|
-
|
323
|
+
def write_macrodef(loc, macro_name, macro_type)
|
324
|
+
write_code_struct(MacroDef.new(loc, macro_name, macro_type))
|
344
325
|
end
|
345
|
-
alias :MACRODEF :
|
346
|
-
module_function :add_macrodef, :MACRODEF
|
326
|
+
alias :MACRODEF :write_macrodef
|
347
327
|
|
348
328
|
# === DESCRIPTION
|
349
|
-
#
|
329
|
+
# Writes a label definition information on the report.
|
350
330
|
#
|
351
331
|
# Abbreviation below is available.
|
352
|
-
#
|
332
|
+
# write_labeldef(...) => LABELDEF(...)
|
353
333
|
#
|
354
334
|
# === PARAMETER
|
355
|
-
#
|
335
|
+
# _loc_:: Location -- Location where the definition appears.
|
356
336
|
# _label_name_:: String -- Label name.
|
357
337
|
#
|
358
338
|
# === RETURN VALUE
|
359
339
|
# None.
|
360
|
-
def
|
361
|
-
|
340
|
+
def write_labeldef(loc, label_name)
|
341
|
+
write_code_struct(LabelDef.new(loc, label_name))
|
362
342
|
end
|
363
|
-
alias :LABELDEF :
|
364
|
-
module_function :add_labeldef, :LABELDEF
|
343
|
+
alias :LABELDEF :write_labeldef
|
365
344
|
|
366
345
|
# === DESCRIPTION
|
367
|
-
#
|
346
|
+
# Writes an initialization information on the report.
|
368
347
|
#
|
369
348
|
# Abbreviation below is available.
|
370
|
-
#
|
349
|
+
# write_initialization(...) => INITIALIZATION(...)
|
371
350
|
#
|
372
351
|
# === PARAMETER
|
373
|
-
#
|
374
|
-
#
|
375
|
-
#
|
352
|
+
# _loc_:: Location -- Location where the variable appears.
|
353
|
+
# _var_name_:: String -- Initialized variable name.
|
354
|
+
# _init_rep_:: String -- String representation of the initializer.
|
376
355
|
#
|
377
356
|
# === RETURN VALUE
|
378
357
|
# None.
|
379
|
-
def
|
380
|
-
|
381
|
-
initializer_rep))
|
358
|
+
def write_initialization(loc, var_name, init_rep)
|
359
|
+
write_code_struct(Initialization.new(loc, var_name, init_rep))
|
382
360
|
end
|
383
|
-
alias :INITIALIZATION :
|
384
|
-
module_function :add_initialization, :INITIALIZATION
|
361
|
+
alias :INITIALIZATION :write_initialization
|
385
362
|
|
386
363
|
# === DESCRIPTION
|
387
|
-
#
|
364
|
+
# Writes an assignment information on the report.
|
388
365
|
#
|
389
366
|
# Abbreviation below is available.
|
390
|
-
#
|
367
|
+
# write_assignment(...) => ASSIGNMENT(...)
|
391
368
|
#
|
392
369
|
# === PARAMETER
|
393
|
-
#
|
394
|
-
#
|
395
|
-
#
|
370
|
+
# _loc_:: Location -- Location where the variable appears.
|
371
|
+
# _var_name_:: String -- Assigned variable name.
|
372
|
+
# _assign_rep_:: String -- String representation of the assignment.
|
396
373
|
#
|
397
374
|
# === RETURN VALUE
|
398
375
|
# None.
|
399
|
-
def
|
400
|
-
|
401
|
-
assignment_rep))
|
376
|
+
def write_assignment(loc, var_name, assign_rep)
|
377
|
+
write_code_struct(Assignment.new(loc, var_name, assign_rep))
|
402
378
|
end
|
403
|
-
alias :ASSIGNMENT :
|
404
|
-
module_function :add_assignment, :ASSIGNMENT
|
379
|
+
alias :ASSIGNMENT :write_assignment
|
405
380
|
|
406
381
|
# === DESCRIPTION
|
407
|
-
#
|
382
|
+
# Writes a header include information on the report.
|
408
383
|
#
|
409
384
|
# Abbreviation below is available.
|
410
|
-
#
|
385
|
+
# write_include(...) => INCLUDE(...)
|
411
386
|
#
|
412
387
|
# === PARAMETER
|
413
|
-
#
|
414
|
-
#
|
388
|
+
# _loc_:: Location -- Location where the directive appears.
|
389
|
+
# _fpath_:: Pathname -- Path name of the included file.
|
415
390
|
#
|
416
391
|
# === RETURN VALUE
|
417
392
|
# None.
|
418
|
-
def
|
419
|
-
|
393
|
+
def write_include(loc, fpath)
|
394
|
+
write_code_struct(Include.new(loc, fpath))
|
420
395
|
end
|
421
|
-
alias :INCLUDE :
|
422
|
-
module_function :add_include, :INCLUDE
|
396
|
+
alias :INCLUDE :write_include
|
423
397
|
|
424
398
|
# === DESCRIPTION
|
425
|
-
#
|
399
|
+
# Writes a function call information on the report.
|
426
400
|
#
|
427
401
|
# Abbreviation below is available.
|
428
|
-
#
|
402
|
+
# write_call(...) => CALL(...)
|
429
403
|
#
|
430
404
|
# === PARAMETER
|
431
|
-
#
|
432
|
-
#
|
433
|
-
#
|
434
|
-
def
|
435
|
-
|
405
|
+
# _loc_:: Location -- Location where the function call appears.
|
406
|
+
# _caller_fun_:: FunctionId -- Calling function identifier.
|
407
|
+
# _callee_fun_:: FunctionId -- Called function identifier.
|
408
|
+
def write_call(loc, caller_fun, callee_fun)
|
409
|
+
write_code_struct(Call.new(loc, caller_fun, callee_fun))
|
436
410
|
end
|
437
|
-
alias :CALL :
|
438
|
-
module_function :add_call, :CALL
|
411
|
+
alias :CALL :write_call
|
439
412
|
|
440
413
|
# === DESCRIPTION
|
441
|
-
#
|
414
|
+
# Writes a variable cross reference information on the report.
|
442
415
|
#
|
443
416
|
# Abbreviation below is available.
|
444
|
-
#
|
417
|
+
# write_xref_variable(...) => XREF_VAR(...)
|
445
418
|
#
|
446
419
|
# === PARAMETER
|
447
|
-
#
|
448
|
-
#
|
449
|
-
#
|
450
|
-
#
|
451
|
-
# _accessee_variable_:: String -- Accessed variable name.
|
420
|
+
# _loc_:: Location -- Location where the cross-ref appears.
|
421
|
+
# _referrer_:: FunctionId -- Accessing function identifier.
|
422
|
+
# _ref_type_:: String -- Access type string.
|
423
|
+
# _var_name_:: String -- Accessed variable name.
|
452
424
|
#
|
453
425
|
# === RETURN VALUE
|
454
426
|
# None.
|
455
|
-
def
|
456
|
-
|
457
|
-
add_code_struct(XRefVar.new(location, accessor_function, access_type,
|
458
|
-
accessee_variable))
|
427
|
+
def write_xref_variable(loc, referrer, ref_type, var_name)
|
428
|
+
write_code_struct(XRefVar.new(loc, referrer, ref_type, var_name))
|
459
429
|
end
|
460
|
-
alias :XREF_VAR :
|
461
|
-
module_function :add_xref_variable, :XREF_VAR
|
430
|
+
alias :XREF_VAR :write_xref_variable
|
462
431
|
|
463
432
|
# === DESCRIPTION
|
464
|
-
#
|
433
|
+
# Writes a function cross reference information on the report.
|
465
434
|
#
|
466
435
|
# Abbreviation below is available.
|
467
|
-
#
|
436
|
+
# write_xref_function(...) => XREF_FUNC(...)
|
468
437
|
#
|
469
438
|
# === PARAMETER
|
470
|
-
#
|
471
|
-
#
|
472
|
-
#
|
473
|
-
#
|
474
|
-
# _accessee_function_:: FunctionIdentifier -- Accessed function identifier.
|
439
|
+
# _loc_:: Location -- Location where the cross-ref appears.
|
440
|
+
# _referrer_:: FunctionId -- Accessing function identifier.
|
441
|
+
# _ref_type_:: String -- Access type string.
|
442
|
+
# _fun_:: FunctionId -- Accessed function identifier.
|
475
443
|
#
|
476
444
|
# === RETURN VALUE
|
477
445
|
# None.
|
478
|
-
def
|
479
|
-
|
480
|
-
add_code_struct(XRefFunc.new(location, accessor_function, access_type,
|
481
|
-
accessee_function))
|
446
|
+
def write_xref_function(loc, referrer, ref_type, fun)
|
447
|
+
write_code_struct(XRefFunc.new(loc, referrer, ref_type, fun))
|
482
448
|
end
|
483
|
-
alias :XREF_FUNC :
|
484
|
-
module_function :add_xref_function, :XREF_FUNC
|
449
|
+
alias :XREF_FUNC :write_xref_function
|
485
450
|
|
486
|
-
def
|
487
|
-
|
488
|
-
add_code_struct(Literal.new(location, literal_type, literal_prefix,
|
489
|
-
literal_suffix, literal_value))
|
451
|
+
def write_literal(loc, lit_type, prefix, suffix, value)
|
452
|
+
write_code_struct(Literal.new(loc, lit_type, prefix, suffix, value))
|
490
453
|
end
|
491
|
-
alias :LIT :
|
492
|
-
module_function :add_literal, :LIT
|
454
|
+
alias :LIT :write_literal
|
493
455
|
|
494
|
-
def
|
495
|
-
|
456
|
+
def write_pp_directive(loc, pp_dire, pp_tokens)
|
457
|
+
write_code_struct(PPDirective.new(loc, pp_dire, pp_tokens))
|
496
458
|
end
|
497
|
-
alias :PP_DIRECTIVE :
|
498
|
-
module_function :add_pp_directive, :PP_DIRECTIVE
|
459
|
+
alias :PP_DIRECTIVE :write_pp_directive
|
499
460
|
|
500
|
-
|
501
|
-
|
502
|
-
#
|
503
|
-
# === PARAMETER
|
504
|
-
# _code_struct_:: CodeStructure -- Code structure information to be added.
|
505
|
-
#
|
506
|
-
# === RETURN VALUE
|
507
|
-
# None.
|
508
|
-
def add_code_struct(code_struct)
|
509
|
-
report.add_code_struct(code_struct)
|
510
|
-
nil
|
461
|
+
def write_FL_STMT(fpath, stmt_cnt)
|
462
|
+
write_code_metric(FL_STMT_Metric.new(fpath, stmt_cnt))
|
511
463
|
end
|
512
|
-
|
464
|
+
alias :FL_STMT :write_FL_STMT
|
513
465
|
|
514
|
-
def
|
515
|
-
|
466
|
+
def write_FL_FUNC(fpath, fun_cnt)
|
467
|
+
write_code_metric(FL_FUNC_Metric.new(fpath, fun_cnt))
|
516
468
|
end
|
517
|
-
alias :
|
518
|
-
module_function :add_FL_STMT, :FL_STMT
|
469
|
+
alias :FL_FUNC :write_FL_FUNC
|
519
470
|
|
520
|
-
def
|
521
|
-
|
471
|
+
def write_FN_STMT(fun_id, loc, stmt_cnt)
|
472
|
+
write_code_metric(FN_STMT_Metric.new(fun_id, loc, stmt_cnt))
|
522
473
|
end
|
523
|
-
alias :
|
524
|
-
module_function :add_FL_FUNC, :FL_FUNC
|
474
|
+
alias :FN_STMT :write_FN_STMT
|
525
475
|
|
526
|
-
def
|
527
|
-
|
528
|
-
statement_count))
|
476
|
+
def write_FN_UNRC(fun_id, loc, unreached_stmt_cnt)
|
477
|
+
write_code_metric(FN_UNRC_Metric.new(fun_id, loc, unreached_stmt_cnt))
|
529
478
|
end
|
530
|
-
alias :
|
531
|
-
module_function :add_FN_STMT, :FN_STMT
|
479
|
+
alias :FN_UNRC :write_FN_UNRC
|
532
480
|
|
533
|
-
def
|
534
|
-
|
535
|
-
unreached_statement_count))
|
481
|
+
def write_FN_LINE(fun_id, loc, fun_lines)
|
482
|
+
write_code_metric(FN_LINE_Metric.new(fun_id, loc, fun_lines))
|
536
483
|
end
|
537
|
-
alias :
|
538
|
-
module_function :add_FN_UNRC, :FN_UNRC
|
484
|
+
alias :FN_LINE :write_FN_LINE
|
539
485
|
|
540
|
-
def
|
541
|
-
|
542
|
-
total_lines))
|
486
|
+
def write_FN_PARA(fun_id, loc, param_cnt)
|
487
|
+
write_code_metric(FN_PARA_Metric.new(fun_id, loc, param_cnt))
|
543
488
|
end
|
544
|
-
alias :
|
545
|
-
module_function :add_FN_LINE, :FN_LINE
|
489
|
+
alias :FN_PARA :write_FN_PARA
|
546
490
|
|
547
|
-
def
|
548
|
-
|
549
|
-
parameter_count))
|
491
|
+
def write_FN_UNUV(fun_id, loc, useless_var_cnt)
|
492
|
+
write_code_metric(FN_UNUV_Metric.new(fun_id, loc, useless_var_cnt))
|
550
493
|
end
|
551
|
-
alias :
|
552
|
-
module_function :add_FN_PARA, :FN_PARA
|
494
|
+
alias :FN_UNUV :write_FN_UNUV
|
553
495
|
|
554
|
-
def
|
555
|
-
|
556
|
-
useless_variable_count))
|
496
|
+
def write_FN_CSUB(fun_id, loc, funcall_cnt)
|
497
|
+
write_code_metric(FN_CSUB_Metric.new(fun_id, loc, funcall_cnt))
|
557
498
|
end
|
558
|
-
alias :
|
559
|
-
module_function :add_FN_UNUV, :FN_UNUV
|
499
|
+
alias :FN_CSUB :write_FN_CSUB
|
560
500
|
|
561
|
-
def
|
562
|
-
|
563
|
-
function_call_count))
|
501
|
+
def write_FN_GOTO(fun_id, loc, goto_cnt)
|
502
|
+
write_code_metric(FN_GOTO_Metric.new(fun_id, loc, goto_cnt))
|
564
503
|
end
|
565
|
-
alias :
|
566
|
-
module_function :add_FN_CSUB, :FN_CSUB
|
504
|
+
alias :FN_GOTO :write_FN_GOTO
|
567
505
|
|
568
|
-
def
|
569
|
-
|
570
|
-
goto_count))
|
506
|
+
def write_FN_RETN(fun_id, loc, retn_cnt)
|
507
|
+
write_code_metric(FN_RETN_Metric.new(fun_id, loc, retn_cnt))
|
571
508
|
end
|
572
|
-
alias :
|
573
|
-
module_function :add_FN_GOTO, :FN_GOTO
|
509
|
+
alias :FN_RETN :write_FN_RETN
|
574
510
|
|
575
|
-
def
|
576
|
-
|
577
|
-
return_count))
|
511
|
+
def write_FN_UELS(fun_id, loc, if_stmt_cnt)
|
512
|
+
write_code_metric(FN_UELS_Metric.new(fun_id, loc, if_stmt_cnt))
|
578
513
|
end
|
579
|
-
alias :
|
580
|
-
module_function :add_FN_RETN, :FN_RETN
|
514
|
+
alias :FN_UELS :write_FN_UELS
|
581
515
|
|
582
|
-
def
|
583
|
-
|
584
|
-
if_statement_count))
|
516
|
+
def write_FN_NEST(fun_id, loc, max_nest)
|
517
|
+
write_code_metric(FN_NEST_Metric.new(fun_id, loc, max_nest))
|
585
518
|
end
|
586
|
-
alias :
|
587
|
-
module_function :add_FN_UELS, :FN_UELS
|
519
|
+
alias :FN_NEST :write_FN_NEST
|
588
520
|
|
589
|
-
def
|
590
|
-
|
591
|
-
max_nest_level))
|
521
|
+
def write_FN_PATH(fun_id, loc, path_cnt)
|
522
|
+
write_code_metric(FN_PATH_Metric.new(fun_id, loc, path_cnt))
|
592
523
|
end
|
593
|
-
alias :
|
594
|
-
module_function :add_FN_NEST, :FN_NEST
|
524
|
+
alias :FN_PATH :write_FN_PATH
|
595
525
|
|
596
|
-
def
|
597
|
-
|
598
|
-
path_count))
|
526
|
+
def write_FN_CYCM(fun_id, loc, cycl_compl)
|
527
|
+
write_code_metric(FN_CYCM_Metric.new(fun_id, loc, cycl_compl))
|
599
528
|
end
|
600
|
-
alias :
|
601
|
-
module_function :add_FN_PATH, :FN_PATH
|
529
|
+
alias :FN_CYCM :write_FN_CYCM
|
602
530
|
|
603
|
-
def
|
604
|
-
|
605
|
-
cyclomatic_complexity))
|
531
|
+
def write_FN_CALL(fun_sig, loc, caller_cnt)
|
532
|
+
write_code_metric(FN_CALL_Metric.new(fun_sig, loc, caller_cnt))
|
606
533
|
end
|
607
|
-
alias :
|
608
|
-
module_function :add_FN_CYCM, :FN_CYCM
|
534
|
+
alias :FN_CALL :write_FN_CALL
|
609
535
|
|
610
|
-
|
611
|
-
|
612
|
-
|
536
|
+
private
|
537
|
+
def write_code_struct(code_struct)
|
538
|
+
report.write_code_struct(code_struct)
|
539
|
+
nil
|
613
540
|
end
|
614
|
-
alias :FN_CALL :add_FN_CALL
|
615
|
-
module_function :add_FN_CALL, :FN_CALL
|
616
541
|
|
617
|
-
def
|
618
|
-
report.
|
542
|
+
def write_code_metric(code_metric)
|
543
|
+
report.write_code_metric(code_metric)
|
619
544
|
nil
|
620
545
|
end
|
621
|
-
module_function :add_code_metric
|
622
546
|
end
|
623
547
|
|
624
|
-
Examination.class_eval { include ReportUtil }
|
625
|
-
CodeCheck.class_eval { extend MessageUniqueness }
|
626
|
-
|
627
548
|
end
|