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/code.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Code structure information.
|
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
|
#
|
@@ -34,15 +34,8 @@ module AdLint #:nodoc:
|
|
34
34
|
# == DESCRIPTION
|
35
35
|
# Base class of code structure information.
|
36
36
|
class CodeStructure
|
37
|
-
|
38
|
-
|
39
|
-
#
|
40
|
-
# Subclasses must implement this method.
|
41
|
-
#
|
42
|
-
# === RETURN VALUE
|
43
|
-
# Array< Object > -- Array representation.
|
44
|
-
def to_a
|
45
|
-
subclass_responsibility
|
37
|
+
def print_as_csv(io)
|
38
|
+
io.puts(to_csv)
|
46
39
|
end
|
47
40
|
|
48
41
|
# === DESCRIPTION
|
@@ -55,6 +48,18 @@ module AdLint #:nodoc:
|
|
55
48
|
to_a.map { |obj| obj.to_s.to_default_external }.join(delim)
|
56
49
|
end
|
57
50
|
|
51
|
+
private
|
52
|
+
# === DESCRIPTION
|
53
|
+
# Converts this code structure information into array representation.
|
54
|
+
#
|
55
|
+
# Subclasses must implement this method.
|
56
|
+
#
|
57
|
+
# === RETURN VALUE
|
58
|
+
# Array< Object > -- Array representation.
|
59
|
+
def to_a
|
60
|
+
subclass_responsibility
|
61
|
+
end
|
62
|
+
|
58
63
|
def to_csv
|
59
64
|
to_a.map { |obj| obj ? obj.to_s.to_default_external : nil }.to_csv
|
60
65
|
end
|
@@ -67,25 +72,25 @@ module AdLint #:nodoc:
|
|
67
72
|
# Constructs the type declaration information.
|
68
73
|
#
|
69
74
|
# === PARAMETER
|
70
|
-
#
|
71
|
-
#
|
75
|
+
# _loc_:: Location -- Location where the declaration appears.
|
76
|
+
# _dcl_type_:: String -- Type string of the type declaration.
|
72
77
|
# _type_name_:: String -- Type name.
|
73
78
|
# _type_rep_:: String -- Type representation.
|
74
|
-
def initialize(
|
75
|
-
@
|
76
|
-
@
|
79
|
+
def initialize(loc, dcl_type, type_name, type_rep)
|
80
|
+
@loc = loc
|
81
|
+
@dcl_type = dcl_type
|
77
82
|
@type_name = type_name
|
78
|
-
@type_rep
|
83
|
+
@type_rep = type_rep
|
79
84
|
end
|
80
85
|
|
86
|
+
private
|
81
87
|
# === DESCRIPTION
|
82
88
|
# Converts this code structure information into array representation.
|
83
89
|
#
|
84
90
|
# === RETURN VALUE
|
85
91
|
# Array< Object > -- Array representation.
|
86
92
|
def to_a
|
87
|
-
["DCL",
|
88
|
-
@typedcl_type, @type_name, @type_rep]
|
93
|
+
["DCL", *@loc.to_a, "T", @dcl_type, @type_name, @type_rep]
|
89
94
|
end
|
90
95
|
end
|
91
96
|
|
@@ -96,23 +101,23 @@ module AdLint #:nodoc:
|
|
96
101
|
# Constructs the global variable declaration information.
|
97
102
|
#
|
98
103
|
# === PARAMETER
|
99
|
-
#
|
100
|
-
#
|
104
|
+
# _loc_:: Location -- Location where the declaration appears.
|
105
|
+
# _var_name_:: String -- Global variable name.
|
101
106
|
# _type_rep_:: String -- Type of the global variable.
|
102
|
-
def initialize(
|
103
|
-
@
|
104
|
-
@
|
107
|
+
def initialize(loc, var_name, type_rep)
|
108
|
+
@loc = loc
|
109
|
+
@var_name = var_name
|
105
110
|
@type_rep = type_rep
|
106
111
|
end
|
107
112
|
|
113
|
+
private
|
108
114
|
# === DESCRIPTION
|
109
115
|
# Converts this code structure information into array representation.
|
110
116
|
#
|
111
117
|
# === RETURN VALUE
|
112
118
|
# Array< Object > -- Array representation.
|
113
119
|
def to_a
|
114
|
-
["DCL",
|
115
|
-
@variable_name, @type_rep]
|
120
|
+
["DCL", *@loc.to_a, "V", @var_name, @type_rep]
|
116
121
|
end
|
117
122
|
end
|
118
123
|
|
@@ -123,27 +128,27 @@ module AdLint #:nodoc:
|
|
123
128
|
# Constructs the function declaration information.
|
124
129
|
#
|
125
130
|
# === PARAMETER
|
126
|
-
#
|
127
|
-
#
|
128
|
-
#
|
129
|
-
#
|
130
|
-
|
131
|
-
|
132
|
-
@
|
133
|
-
@
|
134
|
-
@
|
135
|
-
@
|
136
|
-
|
137
|
-
|
131
|
+
# _loc_:: Location -- Location where the declaration appears.
|
132
|
+
# _linkage_:: String -- Function linkage type string.
|
133
|
+
# _scope_type_:: String -- Declaration scope type string.
|
134
|
+
# _dcl_type_:: String -- Declaration type string.
|
135
|
+
# _fun_id_:: FunctionId -- Identifier of the function.
|
136
|
+
def initialize(loc, linkage, scope_type, dcl_type, fun_id)
|
137
|
+
@loc = loc
|
138
|
+
@linkage = linkage
|
139
|
+
@scope_type = scope_type
|
140
|
+
@dcl_type = dcl_type
|
141
|
+
@fun_id = fun_id
|
142
|
+
end
|
143
|
+
|
144
|
+
private
|
138
145
|
# === DESCRIPTION
|
139
146
|
# Converts this code structure information into array representation.
|
140
147
|
#
|
141
148
|
# === RETURN VALUE
|
142
149
|
# Array< Object > -- Array representation.
|
143
150
|
def to_a
|
144
|
-
["DCL",
|
145
|
-
@function_linkage_type, @function_scope_type,
|
146
|
-
@function_identifier.name, @function_identifier.signature]
|
151
|
+
["DCL", *@loc.to_a, "F", @linkage, @scope_type, @dcl_type, *@fun_id.to_a]
|
147
152
|
end
|
148
153
|
end
|
149
154
|
|
@@ -154,31 +159,30 @@ module AdLint #:nodoc:
|
|
154
159
|
# Constructs the variable definition information.
|
155
160
|
#
|
156
161
|
# === PARAMETER
|
157
|
-
#
|
158
|
-
#
|
159
|
-
#
|
160
|
-
#
|
161
|
-
#
|
162
|
+
# _loc_:: Location -- Location where the definition appears.
|
163
|
+
# _linkage_:: String -- Variable linkage type string.
|
164
|
+
# _scope_type_:: String -- Variable scope type string.
|
165
|
+
# _sc_type_:: String -- Variable storage class type.
|
166
|
+
# _var_name_:: String -- Variable name.
|
162
167
|
# _type_rep_:: String -- Variable type representation string.
|
163
|
-
def initialize(
|
164
|
-
|
165
|
-
@
|
166
|
-
@
|
167
|
-
@
|
168
|
-
@
|
169
|
-
@
|
170
|
-
@type_rep = type_rep
|
168
|
+
def initialize(loc, linkage, scope_type, sc_type, var_name, type_rep)
|
169
|
+
@loc = loc
|
170
|
+
@linkage = linkage
|
171
|
+
@scope_type = scope_type
|
172
|
+
@sc_type = sc_type
|
173
|
+
@var_name = var_name
|
174
|
+
@type_rep = type_rep
|
171
175
|
end
|
172
176
|
|
177
|
+
private
|
173
178
|
# === DESCRIPTION
|
174
179
|
# Converts this code structure information into array representation.
|
175
180
|
#
|
176
181
|
# === RETURN VALUE
|
177
182
|
# Array< Object > -- Array representation.
|
178
183
|
def to_a
|
179
|
-
["DEF",
|
180
|
-
@
|
181
|
-
@variable_name, @type_rep]
|
184
|
+
["DEF", *@loc.to_a, "V", @linkage, @scope_type, @sc_type, @var_name,
|
185
|
+
@type_rep]
|
182
186
|
end
|
183
187
|
end
|
184
188
|
|
@@ -189,29 +193,27 @@ module AdLint #:nodoc:
|
|
189
193
|
# Constructs the function definition information.
|
190
194
|
#
|
191
195
|
# === PARAMETER
|
192
|
-
#
|
193
|
-
#
|
194
|
-
#
|
195
|
-
#
|
196
|
+
# _loc_:: Location -- Location where the definition appears.
|
197
|
+
# _linkage_:: String -- Function linkage type string.
|
198
|
+
# _scope_type_:: String -- Definition scope type string.
|
199
|
+
# _fun_id_:: FunctionId -- Function identifier.
|
196
200
|
# _lines_:: Integer -- Physical lines.
|
197
|
-
def initialize(
|
198
|
-
|
199
|
-
@
|
200
|
-
@
|
201
|
-
@
|
202
|
-
@
|
203
|
-
@lines = lines
|
201
|
+
def initialize(loc, linkage, scope_type, fun_id, lines)
|
202
|
+
@loc = loc
|
203
|
+
@linkage = linkage
|
204
|
+
@scope_type = scope_type
|
205
|
+
@fun_id = fun_id
|
206
|
+
@lines = lines
|
204
207
|
end
|
205
208
|
|
209
|
+
private
|
206
210
|
# === DESCRIPTION
|
207
211
|
# Converts this code structure information into array representation.
|
208
212
|
#
|
209
213
|
# === RETURN VALUE
|
210
214
|
# Array< Object > -- Array representation.
|
211
215
|
def to_a
|
212
|
-
["DEF",
|
213
|
-
@function_linkage_type, @function_scope_type,
|
214
|
-
@function_identifier.name, @function_identifier.signature, @lines]
|
216
|
+
["DEF", *@loc.to_a, "F", @linkage, @scope_type, *@fun_id.to_a, @lines]
|
215
217
|
end
|
216
218
|
end
|
217
219
|
|
@@ -222,23 +224,23 @@ module AdLint #:nodoc:
|
|
222
224
|
# Constructs the macro definition information.
|
223
225
|
#
|
224
226
|
# === PARAMETER
|
225
|
-
#
|
227
|
+
# _loc_:: Location -- Location where the definition appears.
|
226
228
|
# _macro_name_:: String -- Macro name.
|
227
229
|
# _macro_type_:: String -- Macro type string.
|
228
|
-
def initialize(
|
229
|
-
@
|
230
|
+
def initialize(loc, macro_name, macro_type)
|
231
|
+
@loc = loc
|
230
232
|
@macro_name = macro_name
|
231
233
|
@macro_type = macro_type
|
232
234
|
end
|
233
235
|
|
236
|
+
private
|
234
237
|
# === DESCRIPTION
|
235
238
|
# Converts this code structure information into array representation.
|
236
239
|
#
|
237
240
|
# === RETURN VALUE
|
238
241
|
# Array< Object > -- Array representation.
|
239
242
|
def to_a
|
240
|
-
["DEF",
|
241
|
-
@macro_name, @macro_type]
|
243
|
+
["DEF", *@loc.to_a, "M", @macro_name, @macro_type]
|
242
244
|
end
|
243
245
|
end
|
244
246
|
|
@@ -249,21 +251,21 @@ module AdLint #:nodoc:
|
|
249
251
|
# Constructs the label definition information.
|
250
252
|
#
|
251
253
|
# === PARAMETER
|
252
|
-
#
|
254
|
+
# _loc_:: Location -- Location where the definition appears.
|
253
255
|
# _label_name_:: String -- Label name.
|
254
|
-
def initialize(
|
255
|
-
@
|
256
|
+
def initialize(loc, label_name)
|
257
|
+
@loc = loc
|
256
258
|
@label_name = label_name
|
257
259
|
end
|
258
260
|
|
261
|
+
private
|
259
262
|
# === DESCRIPTION
|
260
263
|
# Converts this code structure information into array representation.
|
261
264
|
#
|
262
265
|
# === RETURN VALUE
|
263
266
|
# Array< Object > -- Array representation.
|
264
267
|
def to_a
|
265
|
-
["DEF",
|
266
|
-
@label_name]
|
268
|
+
["DEF", *@loc.to_a, "L", @label_name]
|
267
269
|
end
|
268
270
|
end
|
269
271
|
|
@@ -274,23 +276,23 @@ module AdLint #:nodoc:
|
|
274
276
|
# Constructs the initialization information.
|
275
277
|
#
|
276
278
|
# === PARAMETER
|
277
|
-
#
|
278
|
-
#
|
279
|
-
#
|
280
|
-
def initialize(
|
281
|
-
@
|
282
|
-
@
|
283
|
-
@
|
279
|
+
# _loc_:: Location -- Location where the variable appears.
|
280
|
+
# _var_name_:: String -- Initialized variable name.
|
281
|
+
# _init_rep_:: String -- Initializer representation.
|
282
|
+
def initialize(loc, var_name, init_rep)
|
283
|
+
@loc = loc
|
284
|
+
@var_name = var_name
|
285
|
+
@init_rep = init_rep
|
284
286
|
end
|
285
287
|
|
288
|
+
private
|
286
289
|
# === DESCRIPTION
|
287
290
|
# Converts this code structure information into array representation.
|
288
291
|
#
|
289
292
|
# === RETURN VALUE
|
290
293
|
# Array< Object > -- Array representation.
|
291
294
|
def to_a
|
292
|
-
["INI",
|
293
|
-
@variable_name, @initializer_rep]
|
295
|
+
["INI", *@loc.to_a, @var_name, @init_rep]
|
294
296
|
end
|
295
297
|
end
|
296
298
|
|
@@ -301,23 +303,23 @@ module AdLint #:nodoc:
|
|
301
303
|
# Constructs the assignment information.
|
302
304
|
#
|
303
305
|
# === PARAMETER
|
304
|
-
#
|
305
|
-
#
|
306
|
-
#
|
307
|
-
def initialize(
|
308
|
-
@
|
309
|
-
@
|
310
|
-
@
|
306
|
+
# _loc_:: Location -- Location where the variable appears.
|
307
|
+
# _var_name_:: String -- Assigned variable name.
|
308
|
+
# _assign_rep_:: String -- Assignment expression representation.
|
309
|
+
def initialize(loc, var_name, assign_rep)
|
310
|
+
@loc = loc
|
311
|
+
@var_name = var_name
|
312
|
+
@assign_rep = assign_rep
|
311
313
|
end
|
312
314
|
|
315
|
+
private
|
313
316
|
# === DESCRIPTION
|
314
317
|
# Converts this code structure information into array representation.
|
315
318
|
#
|
316
319
|
# === RETURN VALUE
|
317
320
|
# Array< Object > -- Array representation.
|
318
321
|
def to_a
|
319
|
-
["ASN",
|
320
|
-
@variable_name, @assignment_rep]
|
322
|
+
["ASN", *@loc.to_a, @var_name, @assign_rep]
|
321
323
|
end
|
322
324
|
end
|
323
325
|
|
@@ -328,21 +330,21 @@ module AdLint #:nodoc:
|
|
328
330
|
# Constructs the header include information.
|
329
331
|
#
|
330
332
|
# === PARAMETER
|
331
|
-
#
|
332
|
-
#
|
333
|
-
def initialize(
|
334
|
-
@
|
335
|
-
@
|
333
|
+
# _loc_:: Location -- Location where the directive appears.
|
334
|
+
# _fpath_:: Pathname -- Path name of the included file.
|
335
|
+
def initialize(loc, fpath)
|
336
|
+
@loc = loc
|
337
|
+
@fpath = fpath
|
336
338
|
end
|
337
339
|
|
340
|
+
private
|
338
341
|
# === DESCRIPTION
|
339
342
|
# Converts this code structure information into array representation.
|
340
343
|
#
|
341
344
|
# === RETURN VALUE
|
342
345
|
# Array< Object > -- Array representation.
|
343
346
|
def to_a
|
344
|
-
["DEP",
|
345
|
-
@included_fpath]
|
347
|
+
["DEP", *@loc.to_a, "I", @fpath]
|
346
348
|
end
|
347
349
|
end
|
348
350
|
|
@@ -353,24 +355,23 @@ module AdLint #:nodoc:
|
|
353
355
|
# Constructs the function call informatin.
|
354
356
|
#
|
355
357
|
# === PARAMETER
|
356
|
-
#
|
357
|
-
#
|
358
|
-
#
|
359
|
-
def initialize(
|
360
|
-
@
|
361
|
-
@
|
362
|
-
@
|
358
|
+
# _loc_:: Location -- Location where the function call appears.
|
359
|
+
# _caller_fun_:: FunctionId -- Calling function identifier.
|
360
|
+
# _callee_fun_:: FunctionId -- Called function identifier.
|
361
|
+
def initialize(loc, caller_fun, callee_fun)
|
362
|
+
@loc = loc
|
363
|
+
@caller_fun = caller_fun
|
364
|
+
@callee_fun = callee_fun
|
363
365
|
end
|
364
366
|
|
367
|
+
private
|
365
368
|
# === DESCRIPTION
|
366
369
|
# Converts this code structure information into array representation.
|
367
370
|
#
|
368
371
|
# === RETURN VALUE
|
369
372
|
# Array< Object > -- Array representation.
|
370
373
|
def to_a
|
371
|
-
["DEP",
|
372
|
-
@caller_function.name, @caller_function.signature,
|
373
|
-
@callee_function.name, @callee_function.signature]
|
374
|
+
["DEP", *@loc.to_a, "C", *@caller_fun.to_a, *@callee_fun.to_a]
|
374
375
|
end
|
375
376
|
end
|
376
377
|
|
@@ -381,27 +382,25 @@ module AdLint #:nodoc:
|
|
381
382
|
# Constructs the cross reference information.
|
382
383
|
#
|
383
384
|
# === PARAMETER
|
384
|
-
#
|
385
|
-
#
|
386
|
-
#
|
387
|
-
#
|
388
|
-
|
389
|
-
|
390
|
-
@
|
391
|
-
@
|
392
|
-
@
|
393
|
-
|
394
|
-
|
395
|
-
|
385
|
+
# _loc_:: Location -- Location where the cross-ref appears.
|
386
|
+
# _referrer_:: FunctionId -- Accessing function identifier.
|
387
|
+
# _ref_type_:: String -- Referencing type string.
|
388
|
+
# _var_name_:: String -- Accessed variable name.
|
389
|
+
def initialize(loc, referrer, ref_type, var_name)
|
390
|
+
@loc = loc
|
391
|
+
@referrer = referrer
|
392
|
+
@ref_type = ref_type
|
393
|
+
@var_name = var_name
|
394
|
+
end
|
395
|
+
|
396
|
+
private
|
396
397
|
# === DESCRIPTION
|
397
398
|
# Converts this code structure information into array representation.
|
398
399
|
#
|
399
400
|
# === RETURN VALUE
|
400
401
|
# Array< Object > -- Array representation.
|
401
402
|
def to_a
|
402
|
-
["DEP",
|
403
|
-
"V", @accessor_function.name, @accessor_function.signature,
|
404
|
-
@access_type, @accessee_variable]
|
403
|
+
["DEP", *@loc.to_a, "X", "V", *@referrer.to_a, @ref_type, @var_name]
|
405
404
|
end
|
406
405
|
end
|
407
406
|
|
@@ -410,67 +409,67 @@ module AdLint #:nodoc:
|
|
410
409
|
# Constructs the cross reference information.
|
411
410
|
#
|
412
411
|
# === PARAMETER
|
413
|
-
#
|
414
|
-
#
|
415
|
-
#
|
416
|
-
#
|
417
|
-
|
418
|
-
|
419
|
-
@
|
420
|
-
@
|
421
|
-
@
|
422
|
-
|
423
|
-
|
424
|
-
|
412
|
+
# _loc_:: Location -- Location where the cross-ref appears.
|
413
|
+
# _referrer_:: FunctionId -- Accessing function identifier.
|
414
|
+
# _ref_type_:: String -- Referencing type string.
|
415
|
+
# _fun_:: FunctionId -- Accessed function identifier.
|
416
|
+
def initialize(loc, referrer, ref_type, fun)
|
417
|
+
@loc = loc
|
418
|
+
@referrer = referrer
|
419
|
+
@ref_type = ref_type
|
420
|
+
@fun = fun
|
421
|
+
end
|
422
|
+
|
423
|
+
private
|
425
424
|
# === DESCRIPTION
|
426
425
|
# Converts this code structure information into array representation.
|
427
426
|
#
|
428
427
|
# === RETURN VALUE
|
429
428
|
# Array< Object > -- Array representation.
|
430
429
|
def to_a
|
431
|
-
["DEP",
|
432
|
-
"F", @accessor_function.name, @accessor_function.signature,
|
433
|
-
@access_type, @accessee_function.name, @accessee_function.signature]
|
430
|
+
["DEP", *@loc.to_a, "X", "F", *@referrer.to_a, @ref_type, *@fun.to_a]
|
434
431
|
end
|
435
432
|
end
|
436
433
|
|
437
434
|
class Literal < CodeStructure
|
438
|
-
def initialize(
|
439
|
-
|
440
|
-
@
|
441
|
-
@
|
442
|
-
@
|
443
|
-
@
|
444
|
-
@literal_value = literal_value
|
435
|
+
def initialize(loc, lit_type, prefix, suffix, value)
|
436
|
+
@loc = loc
|
437
|
+
@lit_type = lit_type
|
438
|
+
@prefix = prefix
|
439
|
+
@suffix = suffix
|
440
|
+
@value = value
|
445
441
|
end
|
446
442
|
|
443
|
+
private
|
447
444
|
def to_a
|
448
|
-
["LIT",
|
449
|
-
@literal_type, @literal_prefix, @literal_suffix, @literal_value]
|
445
|
+
["LIT", *@loc.to_a, @lit_type, @prefix, @suffix, @value]
|
450
446
|
end
|
451
447
|
end
|
452
448
|
|
453
449
|
class PPDirective < CodeStructure
|
454
|
-
def initialize(
|
455
|
-
@
|
456
|
-
@
|
450
|
+
def initialize(loc, pp_dire, pp_tokens)
|
451
|
+
@loc = loc
|
452
|
+
@pp_dire = pp_dire
|
457
453
|
@pp_tokens = pp_tokens
|
458
454
|
end
|
459
455
|
|
456
|
+
private
|
460
457
|
def to_a
|
461
|
-
["PRE",
|
462
|
-
@pp_directive, @pp_tokens]
|
458
|
+
["PRE", *@loc.to_a, @pp_dire, @pp_tokens]
|
463
459
|
end
|
464
460
|
end
|
465
461
|
|
466
|
-
class
|
467
|
-
def initialize(name,
|
468
|
-
@name = name
|
469
|
-
@signature = signature
|
462
|
+
class FunctionId
|
463
|
+
def initialize(name, sig)
|
464
|
+
@name, @signature = name, sig
|
470
465
|
end
|
471
466
|
|
472
467
|
attr_reader :name
|
473
468
|
attr_reader :signature
|
469
|
+
|
470
|
+
def to_a
|
471
|
+
[@name, @signature]
|
472
|
+
end
|
474
473
|
end
|
475
474
|
|
476
475
|
end
|