adlint 3.2.0 → 3.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/AUTHORS +1 -2
- data/ChangeLog +196 -5236
- data/INSTALL +1 -1
- data/MANIFEST +4 -2
- data/NEWS +30 -13
- data/README +2 -2
- data/Rakefile +2 -2
- data/TODO +1 -1
- data/bin/adlint +2 -2
- data/bin/adlint_chk +2 -2
- data/bin/adlint_cma +2 -2
- data/bin/adlint_sma +2 -2
- data/bin/adlintize +2 -2
- data/etc/conf.d/fallback/cinit.erb +1 -1
- data/etc/conf.d/fallback/traits.erb +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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-centos_6.4/cinit-gcc_4.4.7.erb +150 -0
- data/etc/conf.d/x86_64-centos_6.4/traits-gcc_4.4.7.erb +290 -0
- 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 +1 -1
- data/etc/mesg.d/c_builtin/en_US/messages.yml +2 -2
- data/etc/mesg.d/c_builtin/ja_JP/messages.yml +3 -3
- data/etc/mesg.d/core/en_US/messages.yml +6 -2
- data/etc/mesg.d/core/ja_JP/messages.yml +6 -2
- data/features/code_check/E0008.feature +122 -0
- data/features/code_check/E0016.feature +49 -0
- data/features/code_check/E0018.feature +99 -0
- data/features/code_check/W0460.feature +8 -8
- data/lib/adlint.rb +2 -2
- data/lib/adlint/analyzer.rb +2 -2
- data/lib/adlint/annot.rb +2 -2
- data/lib/adlint/cc1.rb +2 -2
- data/lib/adlint/cc1/branch.rb +2 -2
- data/lib/adlint/cc1/builtin.rb +2 -2
- data/lib/adlint/cc1/const.rb +2 -2
- data/lib/adlint/cc1/conv.rb +2 -2
- data/lib/adlint/cc1/ctrlexpr.rb +2 -2
- data/lib/adlint/cc1/domain.rb +2 -2
- data/lib/adlint/cc1/enum.rb +2 -2
- data/lib/adlint/cc1/environ.rb +2 -2
- data/lib/adlint/cc1/expr.rb +110 -48
- data/lib/adlint/cc1/format.rb +2 -2
- data/lib/adlint/cc1/interp.rb +46 -12
- data/lib/adlint/cc1/lexer.rb +44 -11
- data/lib/adlint/cc1/mediator.rb +16 -2
- data/lib/adlint/cc1/object.rb +2 -2
- data/lib/adlint/cc1/operator.rb +2 -2
- data/lib/adlint/cc1/option.rb +3 -3
- data/lib/adlint/cc1/parser.rb +1011 -999
- data/lib/adlint/cc1/parser.y +20 -11
- data/lib/adlint/cc1/phase.rb +2 -2
- data/lib/adlint/cc1/resolver.rb +2 -2
- data/lib/adlint/cc1/scanner.rb +2 -2
- data/lib/adlint/cc1/scope.rb +2 -2
- data/lib/adlint/cc1/seqp.rb +2 -2
- data/lib/adlint/cc1/syntax.rb +42 -10
- data/lib/adlint/cc1/trace.rb +2 -2
- data/lib/adlint/cc1/type.rb +72 -2
- data/lib/adlint/cc1/util.rb +2 -2
- data/lib/adlint/cc1/value.rb +9 -3
- data/lib/adlint/code.rb +2 -2
- data/lib/adlint/cpp.rb +2 -2
- data/lib/adlint/cpp/asm.rb +2 -2
- data/lib/adlint/cpp/constexpr.rb +1 -1
- data/lib/adlint/cpp/constexpr.y +2 -2
- data/lib/adlint/cpp/eval.rb +2 -2
- data/lib/adlint/cpp/lexer.rb +13 -3
- data/lib/adlint/cpp/macro.rb +2 -2
- data/lib/adlint/cpp/phase.rb +2 -2
- data/lib/adlint/cpp/scanner.rb +2 -2
- data/lib/adlint/cpp/source.rb +2 -2
- data/lib/adlint/cpp/subst.rb +6 -2
- data/lib/adlint/cpp/syntax.rb +2 -2
- data/lib/adlint/cpp/util.rb +2 -2
- data/lib/adlint/driver.rb +2 -2
- data/lib/adlint/error.rb +2 -2
- data/lib/adlint/exam.rb +20 -8
- data/lib/adlint/exam/c_builtin.rb +4 -6
- data/lib/adlint/exam/c_builtin/cc1_check.rb +1380 -461
- data/lib/adlint/exam/c_builtin/cc1_code.rb +25 -25
- data/lib/adlint/exam/c_builtin/cc1_metric.rb +180 -209
- data/lib/adlint/exam/c_builtin/cpp_check.rb +211 -50
- data/lib/adlint/exam/c_builtin/cpp_code.rb +19 -19
- data/lib/adlint/exam/c_builtin/ld_check.rb +2 -2
- data/lib/adlint/exam/c_builtin/ld_metric.rb +2 -2
- data/lib/adlint/lang.rb +2 -2
- data/lib/adlint/ld.rb +2 -2
- data/lib/adlint/ld/object.rb +3 -3
- data/lib/adlint/ld/phase.rb +2 -2
- data/lib/adlint/ld/typedef.rb +2 -2
- data/lib/adlint/ld/util.rb +2 -2
- data/lib/adlint/lexer.rb +2 -2
- data/lib/adlint/location.rb +2 -2
- data/lib/adlint/memo.rb +2 -2
- data/lib/adlint/message.rb +2 -2
- data/lib/adlint/metric.rb +2 -2
- data/lib/adlint/monitor.rb +2 -2
- data/lib/adlint/phase.rb +2 -2
- data/lib/adlint/prelude.rb +2 -2
- data/lib/adlint/report.rb +4 -4
- data/lib/adlint/source.rb +2 -2
- data/lib/adlint/supp.rb +2 -2
- data/lib/adlint/symbol.rb +2 -2
- data/lib/adlint/token.rb +2 -2
- data/lib/adlint/traits.rb +2 -2
- data/lib/adlint/util.rb +2 -2
- data/lib/adlint/version.rb +6 -6
- data/share/HEADER +2 -2
- data/share/doc/developers_guide_ja.html +20 -9
- data/share/doc/developers_guide_ja.texi +18 -7
- data/share/doc/samples/GNUmakefile +1 -1
- data/share/doc/samples/adlint_traits.yml +1 -1
- data/share/doc/users_guide_en.html +6177 -6138
- data/share/doc/users_guide_en.texi +35 -5
- data/share/doc/users_guide_ja.html +6192 -6153
- data/share/doc/users_guide_ja.texi +35 -5
- data/share/sample/bison-2.5/adlint/GNUmakefile +1 -1
- data/share/sample/bison-2.5/adlint/adlint_traits.yml +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/adlint_traits.yml +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- data/share/sample/zsh-4.3.15/adlint/GNUmakefile +1 -1
- data/share/sample/zsh-4.3.15/adlint/adlint_traits.yml +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- data/spec/adlint/cc1/ctrlexpr_spec.rb +3 -3
- data/spec/adlint/cc1/domain_spec.rb +2 -2
- data/spec/adlint/cc1/operator_spec.rb +2 -2
- data/spec/adlint/cc1/syntax_spec.rb +4 -4
- data/spec/adlint/cc1/type_spec.rb +2 -2
- data/spec/adlint/location_spec.rb +2 -2
- data/spec/conf.d/default_traits.yml +1 -1
- data/spec/conf.d/empty_cinit.h +1 -1
- data/spec/conf.d/empty_pinit.h +1 -1
- data/spec/spec_helper.rb +2 -2
- metadata +29 -28
- data/lib/adlint/exam/c_builtin/cc1_check_shima.rb +0 -963
- data/lib/adlint/exam/c_builtin/cpp_check_shima.rb +0 -204
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
Feature: E0016
|
|
2
|
+
|
|
3
|
+
E0016 detects that a block comment is not terminated in the translation unit.
|
|
4
|
+
|
|
5
|
+
Scenario: `/*' sequence in a string-literal
|
|
6
|
+
Given a target source named "fixture.c" with:
|
|
7
|
+
"""
|
|
8
|
+
#define FOO
|
|
9
|
+
|
|
10
|
+
extern void bar(const char *);
|
|
11
|
+
|
|
12
|
+
void baz(void)
|
|
13
|
+
{
|
|
14
|
+
#ifdef FOO
|
|
15
|
+
bar("1 /*\n");
|
|
16
|
+
#else
|
|
17
|
+
bar("2 /*\n");
|
|
18
|
+
#endif
|
|
19
|
+
}
|
|
20
|
+
"""
|
|
21
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
22
|
+
Then the output should exactly match with:
|
|
23
|
+
| mesg | line | column |
|
|
24
|
+
| W0118 | 3 | 13 |
|
|
25
|
+
| W0117 | 5 | 6 |
|
|
26
|
+
| W0947 | 8 | 9 |
|
|
27
|
+
| W0628 | 5 | 6 |
|
|
28
|
+
|
|
29
|
+
Scenario: `/*' sequence in a string-literal
|
|
30
|
+
Given a target source named "fixture.c" with:
|
|
31
|
+
"""
|
|
32
|
+
extern void bar(const char *);
|
|
33
|
+
|
|
34
|
+
void baz(void)
|
|
35
|
+
{
|
|
36
|
+
#ifdef FOO
|
|
37
|
+
bar("1 /*\n");
|
|
38
|
+
#else
|
|
39
|
+
bar("2 /*\n");
|
|
40
|
+
#endif
|
|
41
|
+
}
|
|
42
|
+
"""
|
|
43
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
44
|
+
Then the output should exactly match with:
|
|
45
|
+
| mesg | line | column |
|
|
46
|
+
| W0118 | 1 | 13 |
|
|
47
|
+
| W0117 | 3 | 6 |
|
|
48
|
+
| W0947 | 8 | 9 |
|
|
49
|
+
| W0628 | 3 | 6 |
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
Feature: E0018
|
|
2
|
+
|
|
3
|
+
E0018 detects that an extra semicolon appears in the global scope.
|
|
4
|
+
|
|
5
|
+
Scenario: extra semicolon after variable declaration
|
|
6
|
+
Given a target source named "fixture.c" with:
|
|
7
|
+
"""
|
|
8
|
+
int i;;
|
|
9
|
+
"""
|
|
10
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
11
|
+
Then the output should exactly match with:
|
|
12
|
+
| mesg | line | column |
|
|
13
|
+
| E0018 | 1 | 7 |
|
|
14
|
+
| W0117 | 1 | 5 |
|
|
15
|
+
|
|
16
|
+
Scenario: extra semicolon after variable definition
|
|
17
|
+
Given a target source named "fixture.c" with:
|
|
18
|
+
"""
|
|
19
|
+
int i = 1;;
|
|
20
|
+
"""
|
|
21
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
22
|
+
Then the output should exactly match with:
|
|
23
|
+
| mesg | line | column |
|
|
24
|
+
| E0018 | 1 | 11 |
|
|
25
|
+
| W0117 | 1 | 5 |
|
|
26
|
+
|
|
27
|
+
Scenario: extra semicolon before variable declaration
|
|
28
|
+
Given a target source named "fixture.c" with:
|
|
29
|
+
"""
|
|
30
|
+
;int i;
|
|
31
|
+
"""
|
|
32
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
33
|
+
Then the output should exactly match with:
|
|
34
|
+
| mesg | line | column |
|
|
35
|
+
| E0018 | 1 | 1 |
|
|
36
|
+
| W0117 | 1 | 6 |
|
|
37
|
+
|
|
38
|
+
Scenario: extra semicolon before variable definition
|
|
39
|
+
Given a target source named "fixture.c" with:
|
|
40
|
+
"""
|
|
41
|
+
;int i = 1;
|
|
42
|
+
"""
|
|
43
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
44
|
+
Then the output should exactly match with:
|
|
45
|
+
| mesg | line | column |
|
|
46
|
+
| E0018 | 1 | 1 |
|
|
47
|
+
| W0117 | 1 | 6 |
|
|
48
|
+
|
|
49
|
+
Scenario: extra semicolon after function declaration
|
|
50
|
+
Given a target source named "fixture.c" with:
|
|
51
|
+
"""
|
|
52
|
+
extern void foo(void);;
|
|
53
|
+
"""
|
|
54
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
55
|
+
Then the output should exactly match with:
|
|
56
|
+
| mesg | line | column |
|
|
57
|
+
| E0018 | 1 | 23 |
|
|
58
|
+
| W0118 | 1 | 13 |
|
|
59
|
+
|
|
60
|
+
Scenario: extra semicolon after function definition
|
|
61
|
+
Given a target source named "fixture.c" with:
|
|
62
|
+
"""
|
|
63
|
+
int foo(void)
|
|
64
|
+
{
|
|
65
|
+
return 0;
|
|
66
|
+
};
|
|
67
|
+
"""
|
|
68
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
69
|
+
Then the output should exactly match with:
|
|
70
|
+
| mesg | line | column |
|
|
71
|
+
| E0018 | 4 | 2 |
|
|
72
|
+
| W0117 | 1 | 5 |
|
|
73
|
+
| W0628 | 1 | 5 |
|
|
74
|
+
|
|
75
|
+
Scenario: extra semicolon before function declaration
|
|
76
|
+
Given a target source named "fixture.c" with:
|
|
77
|
+
"""
|
|
78
|
+
;extern void foo(void);
|
|
79
|
+
"""
|
|
80
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
81
|
+
Then the output should exactly match with:
|
|
82
|
+
| mesg | line | column |
|
|
83
|
+
| E0018 | 1 | 1 |
|
|
84
|
+
| W0118 | 1 | 14 |
|
|
85
|
+
|
|
86
|
+
Scenario: extra semicolon before function definition
|
|
87
|
+
Given a target source named "fixture.c" with:
|
|
88
|
+
"""
|
|
89
|
+
;int foo(void)
|
|
90
|
+
{
|
|
91
|
+
return 0;
|
|
92
|
+
}
|
|
93
|
+
"""
|
|
94
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
95
|
+
Then the output should exactly match with:
|
|
96
|
+
| mesg | line | column |
|
|
97
|
+
| E0018 | 1 | 1 |
|
|
98
|
+
| W0117 | 1 | 6 |
|
|
99
|
+
| W0628 | 1 | 6 |
|
|
@@ -275,13 +275,13 @@ Feature: W0460
|
|
|
275
275
|
int x;
|
|
276
276
|
int y;
|
|
277
277
|
};
|
|
278
|
-
|
|
278
|
+
|
|
279
279
|
struct bar a[3];
|
|
280
|
-
|
|
280
|
+
|
|
281
281
|
int foo(int i, int j)
|
|
282
282
|
{
|
|
283
283
|
int k;
|
|
284
|
-
|
|
284
|
+
|
|
285
285
|
if (i < 0) {
|
|
286
286
|
struct bar b;
|
|
287
287
|
if (j == 0) {
|
|
@@ -292,7 +292,7 @@ Feature: W0460
|
|
|
292
292
|
else if (i > 10) {
|
|
293
293
|
k = j ? a[0].x : a[1].y;
|
|
294
294
|
}
|
|
295
|
-
|
|
295
|
+
|
|
296
296
|
return k; /* W0460 */
|
|
297
297
|
}
|
|
298
298
|
"""
|
|
@@ -328,13 +328,13 @@ Feature: W0460
|
|
|
328
328
|
int x;
|
|
329
329
|
int y;
|
|
330
330
|
};
|
|
331
|
-
|
|
331
|
+
|
|
332
332
|
struct bar a[3];
|
|
333
|
-
|
|
333
|
+
|
|
334
334
|
int foo(int i, int j)
|
|
335
335
|
{
|
|
336
336
|
int k;
|
|
337
|
-
|
|
337
|
+
|
|
338
338
|
if (i < 0) {
|
|
339
339
|
struct bar b;
|
|
340
340
|
if (j == 0) {
|
|
@@ -345,7 +345,7 @@ Feature: W0460
|
|
|
345
345
|
else {
|
|
346
346
|
k = j ? a[0].x : a[1].y;
|
|
347
347
|
}
|
|
348
|
-
|
|
348
|
+
|
|
349
349
|
return k; /* OK */
|
|
350
350
|
}
|
|
351
351
|
"""
|
data/lib/adlint.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# AdLint package loader.
|
|
2
2
|
#
|
|
3
3
|
# Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
|
4
|
-
# Copyright:: Copyright (C) 2010-
|
|
4
|
+
# Copyright:: Copyright (C) 2010-2014, 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-2014, OGIS-RI Co.,Ltd.
|
|
15
15
|
#
|
|
16
16
|
# This file is part of AdLint.
|
|
17
17
|
#
|
data/lib/adlint/analyzer.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Analyzer classes.
|
|
2
2
|
#
|
|
3
3
|
# Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
|
4
|
-
# Copyright:: Copyright (C) 2010-
|
|
4
|
+
# Copyright:: Copyright (C) 2010-2014, 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-2014, OGIS-RI Co.,Ltd.
|
|
15
15
|
#
|
|
16
16
|
# This file is part of AdLint.
|
|
17
17
|
#
|
data/lib/adlint/annot.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Source code annotations.
|
|
2
2
|
#
|
|
3
3
|
# Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
|
4
|
-
# Copyright:: Copyright (C) 2010-
|
|
4
|
+
# Copyright:: Copyright (C) 2010-2014, 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-2014, OGIS-RI Co.,Ltd.
|
|
15
15
|
#
|
|
16
16
|
# This file is part of AdLint.
|
|
17
17
|
#
|
data/lib/adlint/cc1.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# AdLint::Cc1 package loader.
|
|
2
2
|
#
|
|
3
3
|
# Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
|
4
|
-
# Copyright:: Copyright (C) 2010-
|
|
4
|
+
# Copyright:: Copyright (C) 2010-2014, 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-2014, OGIS-RI Co.,Ltd.
|
|
15
15
|
#
|
|
16
16
|
# This file is part of AdLint.
|
|
17
17
|
#
|
data/lib/adlint/cc1/branch.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# C runtime branch of execution path.
|
|
2
2
|
#
|
|
3
3
|
# Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
|
4
|
-
# Copyright:: Copyright (C) 2010-
|
|
4
|
+
# Copyright:: Copyright (C) 2010-2014, 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-2014, OGIS-RI Co.,Ltd.
|
|
15
15
|
#
|
|
16
16
|
# This file is part of AdLint.
|
|
17
17
|
#
|
data/lib/adlint/cc1/builtin.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Builtin functions actually called by the interpreter.
|
|
2
2
|
#
|
|
3
3
|
# Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
|
4
|
-
# Copyright:: Copyright (C) 2010-
|
|
4
|
+
# Copyright:: Copyright (C) 2010-2014, 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-2014, OGIS-RI Co.,Ltd.
|
|
15
15
|
#
|
|
16
16
|
# This file is part of AdLint.
|
|
17
17
|
#
|
data/lib/adlint/cc1/const.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# C constant-expression evaluator.
|
|
2
2
|
#
|
|
3
3
|
# Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
|
4
|
-
# Copyright:: Copyright (C) 2010-
|
|
4
|
+
# Copyright:: Copyright (C) 2010-2014, 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-2014, OGIS-RI Co.,Ltd.
|
|
15
15
|
#
|
|
16
16
|
# This file is part of AdLint.
|
|
17
17
|
#
|
data/lib/adlint/cc1/conv.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# C conversion semantics.
|
|
2
2
|
#
|
|
3
3
|
# Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
|
4
|
-
# Copyright:: Copyright (C) 2010-
|
|
4
|
+
# Copyright:: Copyright (C) 2010-2014, 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-2014, OGIS-RI Co.,Ltd.
|
|
15
15
|
#
|
|
16
16
|
# This file is part of AdLint.
|
|
17
17
|
#
|
data/lib/adlint/cc1/ctrlexpr.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Controlling expression of selection-statements and iteration-statements.
|
|
2
2
|
#
|
|
3
3
|
# Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
|
4
|
-
# Copyright:: Copyright (C) 2010-
|
|
4
|
+
# Copyright:: Copyright (C) 2010-2014, 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-2014, OGIS-RI Co.,Ltd.
|
|
15
15
|
#
|
|
16
16
|
# This file is part of AdLint.
|
|
17
17
|
#
|
data/lib/adlint/cc1/domain.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Domain of values bound to variables.
|
|
2
2
|
#
|
|
3
3
|
# Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
|
4
|
-
# Copyright:: Copyright (C) 2010-
|
|
4
|
+
# Copyright:: Copyright (C) 2010-2014, 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-2014, OGIS-RI Co.,Ltd.
|
|
15
15
|
#
|
|
16
16
|
# This file is part of AdLint.
|
|
17
17
|
#
|
data/lib/adlint/cc1/enum.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# C Enumerators.
|
|
2
2
|
#
|
|
3
3
|
# Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
|
4
|
-
# Copyright:: Copyright (C) 2010-
|
|
4
|
+
# Copyright:: Copyright (C) 2010-2014, 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-2014, OGIS-RI Co.,Ltd.
|
|
15
15
|
#
|
|
16
16
|
# This file is part of AdLint.
|
|
17
17
|
#
|
data/lib/adlint/cc1/environ.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# C runtime environment.
|
|
2
2
|
#
|
|
3
3
|
# Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
|
4
|
-
# Copyright:: Copyright (C) 2010-
|
|
4
|
+
# Copyright:: Copyright (C) 2010-2014, 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-2014, OGIS-RI Co.,Ltd.
|
|
15
15
|
#
|
|
16
16
|
# This file is part of AdLint.
|
|
17
17
|
#
|
data/lib/adlint/cc1/expr.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# C expression evaluator.
|
|
2
2
|
#
|
|
3
3
|
# Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
|
4
|
-
# Copyright:: Copyright (C) 2010-
|
|
4
|
+
# Copyright:: Copyright (C) 2010-2014, 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-2014, OGIS-RI Co.,Ltd.
|
|
15
15
|
#
|
|
16
16
|
# This file is part of AdLint.
|
|
17
17
|
#
|
|
@@ -47,7 +47,7 @@ module Cc1 #:nodoc:
|
|
|
47
47
|
|
|
48
48
|
def visit_error_expression(node)
|
|
49
49
|
checkpoint(node.location)
|
|
50
|
-
create_tmpvar
|
|
50
|
+
create_tmpvar.tap { |rslt_var| notify_error_expr_evaled(node, rslt_var) }
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
def visit_object_specifier(node)
|
|
@@ -60,10 +60,13 @@ module Cc1 #:nodoc:
|
|
|
60
60
|
|
|
61
61
|
if const_var = eval_constant(node)
|
|
62
62
|
notify_constant_referred(node, const_var)
|
|
63
|
-
const_var
|
|
63
|
+
rslt_var = const_var
|
|
64
64
|
else
|
|
65
|
-
create_tmpvar
|
|
65
|
+
rslt_var = create_tmpvar
|
|
66
66
|
end
|
|
67
|
+
|
|
68
|
+
notify_constant_specifier_evaled(node, rslt_var)
|
|
69
|
+
rslt_var
|
|
67
70
|
end
|
|
68
71
|
|
|
69
72
|
def visit_string_literal_specifier(node)
|
|
@@ -71,21 +74,24 @@ module Cc1 #:nodoc:
|
|
|
71
74
|
|
|
72
75
|
case node.literal.value
|
|
73
76
|
when /\A"(.*)"\z/
|
|
74
|
-
create_tmpvar(array_type(char_t, $1.length + 1),
|
|
75
|
-
|
|
77
|
+
rslt_var = create_tmpvar(array_type(char_t, $1.length + 1),
|
|
78
|
+
create_array_value_of_string($1))
|
|
76
79
|
when /\AL"(.*)"\z/i
|
|
77
|
-
create_tmpvar(array_type(wchar_t, $1.length + 1),
|
|
78
|
-
|
|
80
|
+
rslt_var = create_tmpvar(array_type(wchar_t, $1.length + 1),
|
|
81
|
+
create_array_value_of_string($1))
|
|
79
82
|
else
|
|
80
|
-
create_tmpvar(array_type(char_t))
|
|
83
|
+
rslt_var = create_tmpvar(array_type(char_t))
|
|
81
84
|
end
|
|
85
|
+
|
|
86
|
+
notify_string_literal_specifier_evaled(node, rslt_var)
|
|
87
|
+
rslt_var
|
|
82
88
|
end
|
|
83
89
|
|
|
84
90
|
def visit_null_constant_specifier(node)
|
|
85
91
|
checkpoint(node.location)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
92
|
+
rslt_var = create_tmpvar(pointer_type(void_t), scalar_value_of_null)
|
|
93
|
+
notify_null_constant_specifier_evaled(node, rslt_var)
|
|
94
|
+
rslt_var
|
|
89
95
|
end
|
|
90
96
|
|
|
91
97
|
def visit_grouped_expression(node)
|
|
@@ -117,14 +123,12 @@ module Cc1 #:nodoc:
|
|
|
117
123
|
|
|
118
124
|
def visit_bit_access_by_value_expression(node)
|
|
119
125
|
checkpoint(node.location)
|
|
120
|
-
|
|
121
|
-
create_tmpvar
|
|
126
|
+
eval_bit_access_by_value_expr(node, node.expression.accept(self))
|
|
122
127
|
end
|
|
123
128
|
|
|
124
129
|
def visit_bit_access_by_pointer_expression(node)
|
|
125
130
|
checkpoint(node.location)
|
|
126
|
-
|
|
127
|
-
create_tmpvar
|
|
131
|
+
eval_bit_access_by_pointer_expr(node, node.expression.accept(self))
|
|
128
132
|
end
|
|
129
133
|
|
|
130
134
|
def visit_postfix_increment_expression(node)
|
|
@@ -139,8 +143,7 @@ module Cc1 #:nodoc:
|
|
|
139
143
|
|
|
140
144
|
def visit_compound_literal_expression(node)
|
|
141
145
|
checkpoint(node.location)
|
|
142
|
-
|
|
143
|
-
create_tmpvar(node.type_name.type)
|
|
146
|
+
eval_compound_literal_expr(node)
|
|
144
147
|
end
|
|
145
148
|
|
|
146
149
|
def visit_prefix_increment_expression(node)
|
|
@@ -172,14 +175,14 @@ module Cc1 #:nodoc:
|
|
|
172
175
|
checkpoint(node.location)
|
|
173
176
|
|
|
174
177
|
ope_obj = rslt_var = nil
|
|
175
|
-
|
|
178
|
+
eval_quietly_without_side_effects do
|
|
176
179
|
rslt_type = type_of(UserTypeId.new("size_t")) || unsigned_long_t
|
|
177
180
|
ope_obj = node.operand.accept(self)
|
|
178
181
|
if ope_obj.variable?
|
|
179
182
|
size = ope_obj.type.aligned_byte_size
|
|
180
183
|
rslt_var = create_tmpvar(rslt_type, scalar_value_of(size))
|
|
181
184
|
else
|
|
182
|
-
|
|
185
|
+
rslt_var = create_tmpvar(rslt_type)
|
|
183
186
|
end
|
|
184
187
|
end
|
|
185
188
|
|
|
@@ -192,7 +195,7 @@ module Cc1 #:nodoc:
|
|
|
192
195
|
resolve_unresolved_type(node.operand)
|
|
193
196
|
|
|
194
197
|
rslt_var = nil
|
|
195
|
-
|
|
198
|
+
eval_quietly_without_side_effects do
|
|
196
199
|
rslt_type = type_of(UserTypeId.new("size_t")) || unsigned_long_t
|
|
197
200
|
size = node.operand.type.aligned_byte_size
|
|
198
201
|
rslt_var = create_tmpvar(rslt_type, scalar_value_of(size))
|
|
@@ -205,27 +208,35 @@ module Cc1 #:nodoc:
|
|
|
205
208
|
def visit_alignof_expression(node)
|
|
206
209
|
checkpoint(node.location)
|
|
207
210
|
|
|
208
|
-
|
|
211
|
+
ope_obj = rslt_var = nil
|
|
212
|
+
eval_quietly_without_side_effects do
|
|
209
213
|
rslt_type = type_of(UserTypeId.new("size_t")) || unsigned_long_t
|
|
210
214
|
ope_obj = node.operand.accept(self)
|
|
211
215
|
if ope_obj.variable?
|
|
212
216
|
align = ope_obj.type.byte_alignment
|
|
213
|
-
create_tmpvar(rslt_type, scalar_value_of(align))
|
|
217
|
+
rslt_var = create_tmpvar(rslt_type, scalar_value_of(align))
|
|
214
218
|
else
|
|
215
|
-
create_tmpvar(rslt_type)
|
|
219
|
+
rslt_var = create_tmpvar(rslt_type)
|
|
216
220
|
end
|
|
217
221
|
end
|
|
222
|
+
|
|
223
|
+
notify_alignof_expr_evaled(node, ope_obj, rslt_var)
|
|
224
|
+
rslt_var
|
|
218
225
|
end
|
|
219
226
|
|
|
220
227
|
def visit_alignof_type_expression(node)
|
|
221
228
|
checkpoint(node.location)
|
|
222
229
|
resolve_unresolved_type(node.operand)
|
|
223
230
|
|
|
224
|
-
|
|
231
|
+
rslt_var = nil
|
|
232
|
+
eval_quietly_without_side_effects do
|
|
225
233
|
rslt_type = type_of(UserTypeId.new("size_t")) || unsigned_long_t
|
|
226
234
|
align = node.operand.type.aligned_byte_size
|
|
227
|
-
create_tmpvar(rslt_type, scalar_value_of(align))
|
|
235
|
+
rslt_var = create_tmpvar(rslt_type, scalar_value_of(align))
|
|
228
236
|
end
|
|
237
|
+
|
|
238
|
+
notify_alignof_type_expr_evaled(node, node.operand.type, rslt_var)
|
|
239
|
+
rslt_var
|
|
229
240
|
end
|
|
230
241
|
|
|
231
242
|
def visit_cast_expression(node)
|
|
@@ -403,21 +414,24 @@ module Cc1 #:nodoc:
|
|
|
403
414
|
end
|
|
404
415
|
|
|
405
416
|
private
|
|
406
|
-
def
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
417
|
+
def eval_quietly_without_side_effects(&block)
|
|
418
|
+
unless orig_quiet = interpreter.quiet?
|
|
419
|
+
interpreter._quiet = true
|
|
420
|
+
end
|
|
421
|
+
unless orig_without_side_effects = interpreter.without_side_effects?
|
|
422
|
+
interpreter._without_side_effects = true
|
|
410
423
|
end
|
|
411
424
|
yield
|
|
412
425
|
ensure
|
|
413
|
-
unless
|
|
414
|
-
interpreter.
|
|
426
|
+
unless orig_quiet
|
|
427
|
+
interpreter._quiet = false
|
|
415
428
|
# FIXME: Evaluation of an object-specifier doesn't refer to value
|
|
416
429
|
# of a variable. Thus, no cross-reference record on a
|
|
417
430
|
# sizeof-expression because cross-reference extraction
|
|
418
431
|
# watches variable value reference not variable reference.
|
|
419
432
|
# collect_object_specifiers(node).each { |os| os.accept(self) }
|
|
420
433
|
end
|
|
434
|
+
interpreter._without_side_effects = orig_without_side_effects
|
|
421
435
|
end
|
|
422
436
|
|
|
423
437
|
def create_array_value_of_string(str)
|
|
@@ -430,7 +444,8 @@ module Cc1 #:nodoc:
|
|
|
430
444
|
# NotifierMediator and Conversion.
|
|
431
445
|
|
|
432
446
|
def eval_object_specifier(node)
|
|
433
|
-
|
|
447
|
+
case
|
|
448
|
+
when var = variable_named(node.identifier.value)
|
|
434
449
|
var.declarations_and_definitions.each do |dcl_or_def|
|
|
435
450
|
dcl_or_def.mark_as_referred_by(node.identifier)
|
|
436
451
|
end
|
|
@@ -438,26 +453,24 @@ module Cc1 #:nodoc:
|
|
|
438
453
|
# NOTE: Array object will be converted into its start address by the
|
|
439
454
|
# outer expression. So, it is correct to return an array
|
|
440
455
|
# object itself.
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
if fun = function_named(node.identifier.value)
|
|
456
|
+
rslt_obj = var
|
|
457
|
+
when fun = function_named(node.identifier.value)
|
|
445
458
|
fun.declarations_and_definitions.each do |dcl_or_def|
|
|
446
459
|
dcl_or_def.mark_as_referred_by(node.identifier)
|
|
447
460
|
end
|
|
448
461
|
_notify_object_referred(node, fun)
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
if enum = enumerator_named(node.identifier.value)
|
|
462
|
+
rslt_obj = fun
|
|
463
|
+
when enum = enumerator_named(node.identifier.value)
|
|
453
464
|
enum.mark_as_referred_by(node.identifier)
|
|
454
|
-
|
|
465
|
+
rslt_obj = create_tmpvar(enum.type, scalar_value_of(enum.value))
|
|
466
|
+
else
|
|
467
|
+
fun = declare_implicit_function(node.identifier.value)
|
|
468
|
+
_notify_implicit_function_declared(node, fun)
|
|
469
|
+
_notify_object_referred(node, fun)
|
|
470
|
+
rslt_obj = fun
|
|
455
471
|
end
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
_notify_implicit_function_declared(node, fun)
|
|
459
|
-
_notify_object_referred(node, fun)
|
|
460
|
-
fun
|
|
472
|
+
notify_object_specifier_evaled(node, rslt_obj)
|
|
473
|
+
rslt_obj
|
|
461
474
|
end
|
|
462
475
|
|
|
463
476
|
def eval_array_subscript_expr(node, obj, subs)
|
|
@@ -619,6 +632,46 @@ module Cc1 #:nodoc:
|
|
|
619
632
|
end
|
|
620
633
|
end
|
|
621
634
|
|
|
635
|
+
def eval_bit_access_by_value_expr(node, obj)
|
|
636
|
+
if obj.variable? && obj.type.composite?
|
|
637
|
+
outer_var = obj
|
|
638
|
+
else
|
|
639
|
+
return create_tmpvar
|
|
640
|
+
end
|
|
641
|
+
|
|
642
|
+
# TODO: Should support the GCC extension.
|
|
643
|
+
create_tmpvar.tap do |rslt_var|
|
|
644
|
+
notify_bit_access_expr_evaled(node, outer_var, rslt_var)
|
|
645
|
+
end
|
|
646
|
+
end
|
|
647
|
+
|
|
648
|
+
def eval_bit_access_by_pointer_expr(node, obj)
|
|
649
|
+
obj_type = obj.type.unqualify
|
|
650
|
+
if obj.variable? && obj_type.pointer? && obj_type.base_type.composite?
|
|
651
|
+
ptr = obj
|
|
652
|
+
else
|
|
653
|
+
return create_tmpvar
|
|
654
|
+
end
|
|
655
|
+
|
|
656
|
+
if pointee = pointee_of(ptr)
|
|
657
|
+
if pointee.type.array?
|
|
658
|
+
if first_elem = pointee.inner_variable_at(0)
|
|
659
|
+
pointee = first_elem
|
|
660
|
+
else
|
|
661
|
+
pointee = create_tmpvar(obj_type.base_type)
|
|
662
|
+
end
|
|
663
|
+
end
|
|
664
|
+
end
|
|
665
|
+
# NOTE: A bit-access-by-pointer-expression do refers the value of the
|
|
666
|
+
# pointer object.
|
|
667
|
+
_notify_variable_value_referred(node, ptr)
|
|
668
|
+
|
|
669
|
+
# TODO: Should support the GCC extension.
|
|
670
|
+
create_tmpvar.tap do |rslt_var|
|
|
671
|
+
notify_bit_access_expr_evaled(node, ptr, rslt_var)
|
|
672
|
+
end
|
|
673
|
+
end
|
|
674
|
+
|
|
622
675
|
def eval_postfix_increment_expr(node, obj)
|
|
623
676
|
var = object_to_variable(obj, node)
|
|
624
677
|
if !var.type.scalar? && !var.type.void?
|
|
@@ -711,6 +764,13 @@ module Cc1 #:nodoc:
|
|
|
711
764
|
create_tmpvar(var.type, var.value)
|
|
712
765
|
end
|
|
713
766
|
|
|
767
|
+
def eval_compound_literal_expr(node)
|
|
768
|
+
# TODO: Should support C99 features.
|
|
769
|
+
create_tmpvar(node.type_name.type).tap do |rslt_var|
|
|
770
|
+
notify_compound_literal_expr_evaled(node, rslt_var)
|
|
771
|
+
end
|
|
772
|
+
end
|
|
773
|
+
|
|
714
774
|
def eval_address_expr(node, obj)
|
|
715
775
|
# NOTE: An address-expression does not read the value of the object.
|
|
716
776
|
# But value reference should be notified to emphasize global
|
|
@@ -799,6 +859,8 @@ module Cc1 #:nodoc:
|
|
|
799
859
|
# is discarded when the return value is casted before assigning
|
|
800
860
|
# to a variable.
|
|
801
861
|
_notify_variable_value_referred(node, var)
|
|
862
|
+
|
|
863
|
+
notify_cast_expr_evaled(node, var, rslt_var)
|
|
802
864
|
rslt_var
|
|
803
865
|
end
|
|
804
866
|
|