adlint 2.6.14 → 3.0.0
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.
- 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
|
@@ -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-2013, OGIS-RI Co.,Ltd.
|
|
5
5
|
# License:: GPLv3+: GNU General Public License version 3 or later
|
|
6
6
|
#
|
|
7
7
|
# Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
# / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
|
|
12
12
|
# / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
|
|
13
13
|
# / __ |/ /_/ / /___/ / /| / / /
|
|
14
|
-
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-
|
|
14
|
+
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
|
|
15
15
|
#
|
|
16
16
|
# This file is part of AdLint.
|
|
17
17
|
#
|
|
@@ -30,63 +30,64 @@
|
|
|
30
30
|
#++
|
|
31
31
|
|
|
32
32
|
module AdLint #:nodoc:
|
|
33
|
-
module
|
|
33
|
+
module Cc1 #:nodoc:
|
|
34
34
|
|
|
35
|
-
# Host class of this module must include InterpreterMediator.
|
|
36
35
|
module Conversion
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
# NOTE: Host class of this module must include InterpreterMediator.
|
|
37
|
+
|
|
38
|
+
def do_conversion(org_var, to_type)
|
|
39
|
+
if org_var.type.coercible?(to_type)
|
|
39
40
|
# NOTE: Value will be coerced into the destination type in
|
|
40
|
-
# VariableTableMediator#
|
|
41
|
-
|
|
41
|
+
# VariableTableMediator#create_tmpvar.
|
|
42
|
+
create_tmpvar(to_type, wrap_around_value(org_var, to_type))
|
|
42
43
|
else
|
|
43
44
|
nil
|
|
44
45
|
end
|
|
45
46
|
end
|
|
46
47
|
|
|
47
|
-
def do_integer_promotion(
|
|
48
|
-
return
|
|
48
|
+
def do_integer_promotion(org_var)
|
|
49
|
+
return org_var unless org_var.type.integer?
|
|
49
50
|
|
|
50
|
-
promoted_type =
|
|
51
|
-
if
|
|
52
|
-
|
|
51
|
+
promoted_type = org_var.type.integer_promoted_type
|
|
52
|
+
if org_var.type.same_as?(promoted_type)
|
|
53
|
+
org_var
|
|
53
54
|
else
|
|
54
|
-
do_conversion(
|
|
55
|
+
do_conversion(org_var, promoted_type) || org_var
|
|
55
56
|
end
|
|
56
57
|
end
|
|
57
58
|
|
|
58
|
-
def do_usual_arithmetic_conversion(
|
|
59
|
-
if
|
|
60
|
-
return
|
|
59
|
+
def do_usual_arithmetic_conversion(lhs_org, rhs_org)
|
|
60
|
+
if lhs_org.type.pointer? && rhs_org.type.pointer?
|
|
61
|
+
return lhs_org, rhs_org
|
|
61
62
|
end
|
|
62
63
|
|
|
63
|
-
arith_type =
|
|
64
|
+
arith_type = lhs_org.type.arithmetic_type_with(rhs_org.type)
|
|
64
65
|
|
|
65
|
-
if
|
|
66
|
-
|
|
66
|
+
if lhs_org.type.same_as?(arith_type)
|
|
67
|
+
lhs_conved = lhs_org
|
|
67
68
|
else
|
|
68
|
-
|
|
69
|
+
lhs_conved = do_conversion(lhs_org, arith_type) || lhs_org
|
|
69
70
|
end
|
|
70
71
|
|
|
71
|
-
if
|
|
72
|
-
|
|
72
|
+
if rhs_org.type.same_as?(arith_type)
|
|
73
|
+
rhs_conved = rhs_org
|
|
73
74
|
else
|
|
74
|
-
|
|
75
|
+
rhs_conved = do_conversion(rhs_org, arith_type) || rhs_org
|
|
75
76
|
end
|
|
76
77
|
|
|
77
|
-
return
|
|
78
|
+
return lhs_conved, rhs_conved
|
|
78
79
|
end
|
|
79
80
|
|
|
80
|
-
def do_default_argument_promotion(
|
|
81
|
-
promoted_type =
|
|
82
|
-
if
|
|
83
|
-
|
|
81
|
+
def do_default_argument_promotion(org_var)
|
|
82
|
+
promoted_type = org_var.type.argument_promoted_type
|
|
83
|
+
if org_var.type.same_as?(promoted_type)
|
|
84
|
+
org_var
|
|
84
85
|
else
|
|
85
|
-
do_conversion(
|
|
86
|
+
do_conversion(org_var, promoted_type) || org_var
|
|
86
87
|
end
|
|
87
88
|
end
|
|
88
89
|
|
|
89
|
-
def untyped_pointer_conversion?(from_type, to_type,
|
|
90
|
+
def untyped_pointer_conversion?(from_type, to_type, from_val)
|
|
90
91
|
return false unless to_type.pointer?
|
|
91
92
|
|
|
92
93
|
# NOTE: Untyped pointer conversion is defined as below;
|
|
@@ -97,8 +98,8 @@ module C #:nodoc:
|
|
|
97
98
|
# void pointer | non-void pointer | true
|
|
98
99
|
# non-void pointer | void pointer | true
|
|
99
100
|
# non-void pointer | non-void pointer | false
|
|
100
|
-
# non-enum integer | void pointer |
|
|
101
|
-
# non-enum integer | non-void pointer |
|
|
101
|
+
# non-enum integer | void pointer | from_val == 0
|
|
102
|
+
# non-enum integer | non-void pointer | from_val == 0
|
|
102
103
|
# enum | void pointer | false
|
|
103
104
|
# enum | non-void pointer | false
|
|
104
105
|
# other | void pointer | true
|
|
@@ -107,41 +108,41 @@ module C #:nodoc:
|
|
|
107
108
|
when from_type.pointer?
|
|
108
109
|
void_pointer?(from_type) || void_pointer?(to_type)
|
|
109
110
|
when from_type.integer?
|
|
110
|
-
!from_type.enum? &&
|
|
111
|
+
!from_type.enum? && from_val.must_be_equal_to?(scalar_value_of(0))
|
|
111
112
|
else
|
|
112
113
|
void_pointer?(to_type)
|
|
113
114
|
end
|
|
114
115
|
end
|
|
115
116
|
|
|
116
117
|
private
|
|
117
|
-
def wrap_around_value(
|
|
118
|
-
return
|
|
118
|
+
def wrap_around_value(org_var, to_type)
|
|
119
|
+
return org_var.value unless org_var.type.scalar? && to_type.scalar?
|
|
119
120
|
|
|
120
121
|
case
|
|
121
|
-
when
|
|
122
|
-
|
|
123
|
-
if (
|
|
124
|
-
return
|
|
122
|
+
when org_var.type.signed? && to_type.unsigned?
|
|
123
|
+
min_val = scalar_value_of(to_type.min)
|
|
124
|
+
if (org_var.value < min_val).may_be_true?
|
|
125
|
+
return min_val - org_var.value + scalar_value_of(1)
|
|
125
126
|
end
|
|
126
|
-
when
|
|
127
|
-
|
|
128
|
-
if (
|
|
129
|
-
return
|
|
127
|
+
when org_var.type.unsigned? && to_type.signed?
|
|
128
|
+
max_val = scalar_value_of(to_type.max)
|
|
129
|
+
if (org_var.value > max_val).may_be_true?
|
|
130
|
+
return max_val - org_var.value + scalar_value_of(1)
|
|
130
131
|
end
|
|
131
132
|
end
|
|
132
133
|
|
|
133
|
-
|
|
134
|
+
org_var.value
|
|
134
135
|
end
|
|
135
136
|
|
|
136
137
|
def void_pointer?(type)
|
|
137
|
-
|
|
138
|
-
|
|
138
|
+
unqual_type = type.unqualify
|
|
139
|
+
unqual_type.pointer? && unqual_type.base_type.void?
|
|
139
140
|
end
|
|
140
141
|
end
|
|
141
142
|
|
|
142
143
|
# Host class of this module must include StandardTypeCatalogAccessor.
|
|
143
144
|
module UsualArithmeticTypeConversion
|
|
144
|
-
def do_usual_arithmetic_type_conversion(
|
|
145
|
+
def do_usual_arithmetic_type_conversion(lhs, rhs)
|
|
145
146
|
# NOTE: The ISO C99 standard says;
|
|
146
147
|
#
|
|
147
148
|
# 6.3.1.8 Usual arithmetic conversions
|
|
@@ -194,46 +195,43 @@ module C #:nodoc:
|
|
|
194
195
|
# type corresponding to the type of the operand with signed integer
|
|
195
196
|
# type.
|
|
196
197
|
|
|
197
|
-
if
|
|
198
|
-
|
|
199
|
-
return long_double_type
|
|
198
|
+
if lhs.same_as?(long_double_t) || rhs.same_as?(long_double_t)
|
|
199
|
+
return long_double_t
|
|
200
200
|
end
|
|
201
201
|
|
|
202
|
-
if
|
|
203
|
-
return
|
|
202
|
+
if lhs.same_as?(double_t) || rhs.same_as?(double_t)
|
|
203
|
+
return double_t
|
|
204
204
|
end
|
|
205
205
|
|
|
206
|
-
if
|
|
207
|
-
return
|
|
206
|
+
if lhs.same_as?(float_t) || rhs.same_as?(float_t)
|
|
207
|
+
return float_t
|
|
208
208
|
end
|
|
209
209
|
|
|
210
|
-
|
|
211
|
-
|
|
210
|
+
lhs_promoted = lhs.integer_promoted_type
|
|
211
|
+
rhs_promoted = rhs.integer_promoted_type
|
|
212
212
|
|
|
213
|
-
return
|
|
213
|
+
return lhs_promoted if lhs_promoted.same_as?(rhs_promoted)
|
|
214
214
|
|
|
215
|
-
lhs_rank =
|
|
216
|
-
rhs_rank =
|
|
215
|
+
lhs_rank = lhs_promoted.integer_conversion_rank
|
|
216
|
+
rhs_rank = rhs_promoted.integer_conversion_rank
|
|
217
217
|
|
|
218
218
|
case
|
|
219
|
-
when
|
|
220
|
-
return lhs_rank < rhs_rank ?
|
|
221
|
-
when
|
|
222
|
-
return lhs_rank < rhs_rank ?
|
|
223
|
-
when
|
|
224
|
-
return
|
|
225
|
-
when
|
|
226
|
-
return
|
|
227
|
-
when
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
return
|
|
233
|
-
when
|
|
234
|
-
return
|
|
235
|
-
when rhs_promoted_type.signed?
|
|
236
|
-
return rhs_promoted_type.corresponding_unsigned_type
|
|
219
|
+
when lhs_promoted.signed? && rhs_promoted.signed?
|
|
220
|
+
return lhs_rank < rhs_rank ? rhs_promoted : lhs_promoted
|
|
221
|
+
when lhs_promoted.unsigned? && rhs_promoted.unsigned?
|
|
222
|
+
return lhs_rank < rhs_rank ? rhs_promoted : lhs_promoted
|
|
223
|
+
when lhs_promoted.unsigned? && lhs_rank >= rhs_rank
|
|
224
|
+
return lhs_promoted
|
|
225
|
+
when rhs_promoted.unsigned? && lhs_rank <= rhs_rank
|
|
226
|
+
return rhs_promoted
|
|
227
|
+
when lhs_promoted.signed? && rhs_promoted.compatible?(lhs_promoted)
|
|
228
|
+
return lhs_promoted
|
|
229
|
+
when rhs_promoted.signed? && lhs_promoted.compatible?(rhs_promoted)
|
|
230
|
+
return rhs_promoted
|
|
231
|
+
when lhs_promoted.signed?
|
|
232
|
+
return lhs_promoted.corresponding_unsigned_type
|
|
233
|
+
when rhs_promoted.signed?
|
|
234
|
+
return rhs_promoted.corresponding_unsigned_type
|
|
237
235
|
end
|
|
238
236
|
|
|
239
237
|
raise TypeError, "cannot do usual arithmetic conversion."
|
|
@@ -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-2013, OGIS-RI Co.,Ltd.
|
|
5
5
|
# License:: GPLv3+: GNU General Public License version 3 or later
|
|
6
6
|
#
|
|
7
7
|
# Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
# / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
|
|
12
12
|
# / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
|
|
13
13
|
# / __ |/ /_/ / /___/ / /| / / /
|
|
14
|
-
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-
|
|
14
|
+
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
|
|
15
15
|
#
|
|
16
16
|
# This file is part of AdLint.
|
|
17
17
|
#
|
|
@@ -29,16 +29,16 @@
|
|
|
29
29
|
#
|
|
30
30
|
#++
|
|
31
31
|
|
|
32
|
-
require "adlint/
|
|
33
|
-
require "adlint/
|
|
34
|
-
require "adlint/
|
|
35
|
-
require "adlint/
|
|
36
|
-
require "adlint/
|
|
37
|
-
require "adlint/
|
|
38
|
-
require "adlint/
|
|
32
|
+
require "adlint/cc1/syntax"
|
|
33
|
+
require "adlint/cc1/object"
|
|
34
|
+
require "adlint/cc1/mediator"
|
|
35
|
+
require "adlint/cc1/expr"
|
|
36
|
+
require "adlint/cc1/conv"
|
|
37
|
+
require "adlint/cc1/operator"
|
|
38
|
+
require "adlint/cc1/seqp"
|
|
39
39
|
|
|
40
40
|
module AdLint #:nodoc:
|
|
41
|
-
module
|
|
41
|
+
module Cc1 #:nodoc:
|
|
42
42
|
|
|
43
43
|
# == DESCRIPTION
|
|
44
44
|
# === Class structure
|
|
@@ -59,15 +59,15 @@ module C #:nodoc:
|
|
|
59
59
|
class ControllingExpression
|
|
60
60
|
include SyntaxNodeCollector
|
|
61
61
|
|
|
62
|
-
def initialize(
|
|
63
|
-
@interpreter =
|
|
62
|
+
def initialize(interp, branch, target_expr = nil)
|
|
63
|
+
@interpreter = interp
|
|
64
64
|
@branch = branch
|
|
65
65
|
@target_expr = target_expr
|
|
66
66
|
@manipulators = []
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
def ensure_true_by_narrowing(alt_expr = nil)
|
|
70
|
-
target_expr = alt_expr
|
|
70
|
+
target_expr = alt_expr || @target_expr
|
|
71
71
|
|
|
72
72
|
if target_expr
|
|
73
73
|
new_manip = ValueDomainNarrower.new(@interpreter, target_expr)
|
|
@@ -85,7 +85,7 @@ module C #:nodoc:
|
|
|
85
85
|
end
|
|
86
86
|
|
|
87
87
|
def ensure_true_by_widening(alt_expr = nil)
|
|
88
|
-
target_expr = alt_expr
|
|
88
|
+
target_expr = alt_expr || @target_expr
|
|
89
89
|
|
|
90
90
|
if target_expr
|
|
91
91
|
new_manip = ValueDomainWidener.new(@interpreter, target_expr)
|
|
@@ -145,8 +145,8 @@ module C #:nodoc:
|
|
|
145
145
|
include ExpressionEvaluator::Impl
|
|
146
146
|
include MonitorUtil
|
|
147
147
|
|
|
148
|
-
def initialize(
|
|
149
|
-
@interpreter =
|
|
148
|
+
def initialize(interp, target_expr)
|
|
149
|
+
@interpreter = interp
|
|
150
150
|
@target_expr = target_expr
|
|
151
151
|
@affected_variables = []
|
|
152
152
|
@narrowing = nil
|
|
@@ -165,7 +165,7 @@ module C #:nodoc:
|
|
|
165
165
|
|
|
166
166
|
def commit!
|
|
167
167
|
if @narrowing
|
|
168
|
-
@narrowing.ensure_result_equal_to(
|
|
168
|
+
@narrowing.ensure_result_equal_to(scalar_value_of_true)
|
|
169
169
|
end
|
|
170
170
|
|
|
171
171
|
commit_changes(@narrowing)
|
|
@@ -179,7 +179,7 @@ module C #:nodoc:
|
|
|
179
179
|
def rollback!
|
|
180
180
|
# NOTE: Rollback narrowed version to cut out the value-domain to enter
|
|
181
181
|
# the current branch.
|
|
182
|
-
@affected_variables.each { |
|
|
182
|
+
@affected_variables.each { |var| var.value.rollback! }
|
|
183
183
|
end
|
|
184
184
|
|
|
185
185
|
def save!
|
|
@@ -213,8 +213,7 @@ module C #:nodoc:
|
|
|
213
213
|
|
|
214
214
|
def visit_array_subscript_expression(node)
|
|
215
215
|
checkpoint(node.location)
|
|
216
|
-
|
|
217
|
-
obj_manip = node.expression.accept(self)
|
|
216
|
+
obj_manip = node.expression.accept(self)
|
|
218
217
|
subs_manip = node.array_subscript.accept(self)
|
|
219
218
|
|
|
220
219
|
DelayedObjectDerivation.new(self, node, obj_manip, subs_manip) do
|
|
@@ -227,7 +226,6 @@ module C #:nodoc:
|
|
|
227
226
|
|
|
228
227
|
def visit_function_call_expression(node)
|
|
229
228
|
checkpoint(node.location)
|
|
230
|
-
|
|
231
229
|
obj_manip = node.expression.accept(self)
|
|
232
230
|
arg_manips = node.argument_expressions.map { |expr| expr.accept(self) }
|
|
233
231
|
|
|
@@ -241,7 +239,6 @@ module C #:nodoc:
|
|
|
241
239
|
|
|
242
240
|
def visit_member_access_by_value_expression(node)
|
|
243
241
|
checkpoint(node.location)
|
|
244
|
-
|
|
245
242
|
obj_manip = node.expression.accept(self)
|
|
246
243
|
|
|
247
244
|
DelayedObjectDerivation.new(self, node, obj_manip) do
|
|
@@ -253,7 +250,6 @@ module C #:nodoc:
|
|
|
253
250
|
|
|
254
251
|
def visit_member_access_by_pointer_expression(node)
|
|
255
252
|
checkpoint(node.location)
|
|
256
|
-
|
|
257
253
|
obj_manip = node.expression.accept(self)
|
|
258
254
|
|
|
259
255
|
DelayedObjectDerivation.new(self, node, obj_manip) do
|
|
@@ -268,7 +264,6 @@ module C #:nodoc:
|
|
|
268
264
|
|
|
269
265
|
def visit_postfix_increment_expression(node)
|
|
270
266
|
checkpoint(node.location)
|
|
271
|
-
|
|
272
267
|
obj_manip = node.operand.accept(self)
|
|
273
268
|
|
|
274
269
|
DelayedObjectDerivation.new(self, node, obj_manip) do
|
|
@@ -280,7 +275,6 @@ module C #:nodoc:
|
|
|
280
275
|
|
|
281
276
|
def visit_postfix_decrement_expression(node)
|
|
282
277
|
checkpoint(node.location)
|
|
283
|
-
|
|
284
278
|
obj_manip = node.operand.accept(self)
|
|
285
279
|
|
|
286
280
|
DelayedObjectDerivation.new(self, node, obj_manip) do
|
|
@@ -294,7 +288,6 @@ module C #:nodoc:
|
|
|
294
288
|
|
|
295
289
|
def visit_prefix_increment_expression(node)
|
|
296
290
|
checkpoint(node.location)
|
|
297
|
-
|
|
298
291
|
obj_manip = node.operand.accept(self)
|
|
299
292
|
|
|
300
293
|
DelayedObjectDerivation.new(self, node, obj_manip) do
|
|
@@ -306,7 +299,6 @@ module C #:nodoc:
|
|
|
306
299
|
|
|
307
300
|
def visit_prefix_decrement_expression(node)
|
|
308
301
|
checkpoint(node.location)
|
|
309
|
-
|
|
310
302
|
obj_manip = node.operand.accept(self)
|
|
311
303
|
|
|
312
304
|
DelayedObjectDerivation.new(self, node, obj_manip) do
|
|
@@ -320,7 +312,6 @@ module C #:nodoc:
|
|
|
320
312
|
|
|
321
313
|
def visit_indirection_expression(node)
|
|
322
314
|
checkpoint(node.location)
|
|
323
|
-
|
|
324
315
|
obj_manip = node.operand.accept(self)
|
|
325
316
|
|
|
326
317
|
DelayedObjectDerivation.new(self, node, obj_manip) do
|
|
@@ -332,7 +323,6 @@ module C #:nodoc:
|
|
|
332
323
|
|
|
333
324
|
def visit_unary_arithmetic_expression(node)
|
|
334
325
|
checkpoint(node.location)
|
|
335
|
-
|
|
336
326
|
obj_manip = node.operand.accept(self)
|
|
337
327
|
|
|
338
328
|
DelayedObjectDerivation.new(self, node, obj_manip) do
|
|
@@ -349,7 +339,6 @@ module C #:nodoc:
|
|
|
349
339
|
|
|
350
340
|
def visit_cast_expression(node)
|
|
351
341
|
checkpoint(node.location)
|
|
352
|
-
|
|
353
342
|
obj_manip = node.operand.accept(self)
|
|
354
343
|
|
|
355
344
|
DelayedObjectDerivation.new(self, node, obj_manip) do
|
|
@@ -361,7 +350,6 @@ module C #:nodoc:
|
|
|
361
350
|
|
|
362
351
|
def visit_multiplicative_expression(node)
|
|
363
352
|
checkpoint(node.location)
|
|
364
|
-
|
|
365
353
|
lhs_manip = node.lhs_operand.accept(self)
|
|
366
354
|
rhs_manip = node.rhs_operand.accept(self)
|
|
367
355
|
|
|
@@ -375,7 +363,6 @@ module C #:nodoc:
|
|
|
375
363
|
|
|
376
364
|
def visit_additive_expression(node)
|
|
377
365
|
checkpoint(node.location)
|
|
378
|
-
|
|
379
366
|
lhs_manip = node.lhs_operand.accept(self)
|
|
380
367
|
rhs_manip = node.rhs_operand.accept(self)
|
|
381
368
|
|
|
@@ -389,7 +376,6 @@ module C #:nodoc:
|
|
|
389
376
|
|
|
390
377
|
def visit_shift_expression(node)
|
|
391
378
|
checkpoint(node.location)
|
|
392
|
-
|
|
393
379
|
lhs_manip = node.lhs_operand.accept(self)
|
|
394
380
|
rhs_manip = node.rhs_operand.accept(self)
|
|
395
381
|
|
|
@@ -415,7 +401,6 @@ module C #:nodoc:
|
|
|
415
401
|
|
|
416
402
|
def visit_and_expression(node)
|
|
417
403
|
checkpoint(node.location)
|
|
418
|
-
|
|
419
404
|
lhs_manip = node.lhs_operand.accept(self)
|
|
420
405
|
rhs_manip = node.rhs_operand.accept(self)
|
|
421
406
|
|
|
@@ -429,7 +414,6 @@ module C #:nodoc:
|
|
|
429
414
|
|
|
430
415
|
def visit_exclusive_or_expression(node)
|
|
431
416
|
checkpoint(node.location)
|
|
432
|
-
|
|
433
417
|
lhs_manip = node.lhs_operand.accept(self)
|
|
434
418
|
rhs_manip = node.rhs_operand.accept(self)
|
|
435
419
|
|
|
@@ -443,7 +427,6 @@ module C #:nodoc:
|
|
|
443
427
|
|
|
444
428
|
def visit_inclusive_or_expression(node)
|
|
445
429
|
checkpoint(node.location)
|
|
446
|
-
|
|
447
430
|
lhs_manip = node.lhs_operand.accept(self)
|
|
448
431
|
rhs_manip = node.rhs_operand.accept(self)
|
|
449
432
|
|
|
@@ -471,7 +454,6 @@ module C #:nodoc:
|
|
|
471
454
|
|
|
472
455
|
def visit_simple_assignment_expression(node)
|
|
473
456
|
checkpoint(node.location)
|
|
474
|
-
|
|
475
457
|
lhs_manip = node.lhs_operand.accept(self)
|
|
476
458
|
rhs_manip = node.rhs_operand.accept(self)
|
|
477
459
|
|
|
@@ -485,7 +467,6 @@ module C #:nodoc:
|
|
|
485
467
|
|
|
486
468
|
def visit_compound_assignment_expression(node)
|
|
487
469
|
checkpoint(node.location)
|
|
488
|
-
|
|
489
470
|
lhs_manip = node.lhs_operand.accept(self)
|
|
490
471
|
rhs_manip = node.rhs_operand.accept(self)
|
|
491
472
|
|
|
@@ -499,7 +480,6 @@ module C #:nodoc:
|
|
|
499
480
|
|
|
500
481
|
def visit_comma_separated_expression(node)
|
|
501
482
|
checkpoint(node.location)
|
|
502
|
-
|
|
503
483
|
obj_manips = node.expressions.map { |expr| expr.accept(self) }
|
|
504
484
|
|
|
505
485
|
DelayedObjectDerivation.new(self, node, *obj_manips) do
|
|
@@ -512,6 +492,11 @@ module C #:nodoc:
|
|
|
512
492
|
def commit_changes(manip)
|
|
513
493
|
subclass_responsibility
|
|
514
494
|
end
|
|
495
|
+
|
|
496
|
+
extend Forwardable
|
|
497
|
+
|
|
498
|
+
def_delegator :@interpreter, :monitor
|
|
499
|
+
private :monitor
|
|
515
500
|
end
|
|
516
501
|
|
|
517
502
|
class ValueDomainNarrower < ValueDomainManipulator
|
|
@@ -533,9 +518,9 @@ module C #:nodoc:
|
|
|
533
518
|
end
|
|
534
519
|
|
|
535
520
|
class NilValueDomainNarrower < ValueDomainManipulator
|
|
536
|
-
def initialize(
|
|
537
|
-
super(
|
|
538
|
-
@branch_group =
|
|
521
|
+
def initialize(interp, br_group)
|
|
522
|
+
super(interp, nil)
|
|
523
|
+
@branch_group = br_group
|
|
539
524
|
end
|
|
540
525
|
|
|
541
526
|
def prepare!
|
|
@@ -552,9 +537,9 @@ module C #:nodoc:
|
|
|
552
537
|
end
|
|
553
538
|
|
|
554
539
|
class NilValueDomainWidener < ValueDomainManipulator
|
|
555
|
-
def initialize(
|
|
556
|
-
super(
|
|
557
|
-
@branch_group =
|
|
540
|
+
def initialize(interp, br_group)
|
|
541
|
+
super(interp, nil)
|
|
542
|
+
@branch_group = br_group
|
|
558
543
|
end
|
|
559
544
|
|
|
560
545
|
def prepare!
|
|
@@ -599,8 +584,8 @@ module C #:nodoc:
|
|
|
599
584
|
@narrowed_values = manip.narrowed_values.merge(@narrowed_values)
|
|
600
585
|
end
|
|
601
586
|
ensure
|
|
602
|
-
if result && result.variable?
|
|
603
|
-
notify_variable_value_referred(node, result)
|
|
587
|
+
if @result && @result.variable?
|
|
588
|
+
notify_variable_value_referred(node, @result)
|
|
604
589
|
end
|
|
605
590
|
if seqp = node.subsequent_sequence_point
|
|
606
591
|
notify_sequence_point_reached(seqp)
|
|
@@ -663,9 +648,9 @@ module C #:nodoc:
|
|
|
663
648
|
rhs_vals = rhs_manip.narrowed_values
|
|
664
649
|
|
|
665
650
|
@narrowed_values = lhs_vals.merge(rhs_vals) { |key, lhs_val, rhs_val|
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
651
|
+
res_val = lhs_val.dup
|
|
652
|
+
res_val.narrow_domain!(Operator::EQ, rhs_val)
|
|
653
|
+
res_val
|
|
669
654
|
}
|
|
670
655
|
end
|
|
671
656
|
|
|
@@ -674,18 +659,16 @@ module C #:nodoc:
|
|
|
674
659
|
rhs_vals = rhs_manip.narrowed_values
|
|
675
660
|
|
|
676
661
|
@narrowed_values = lhs_vals.merge(rhs_vals) { |key, lhs_val, rhs_val|
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
662
|
+
res_val = lhs_val.dup
|
|
663
|
+
res_val.widen_domain!(Operator::EQ, rhs_val)
|
|
664
|
+
res_val
|
|
680
665
|
}
|
|
681
666
|
end
|
|
682
667
|
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
@manipulator.interpreter
|
|
688
|
-
end
|
|
668
|
+
extend Forwardable
|
|
669
|
+
|
|
670
|
+
def_delegator :@manipulator, :interpreter
|
|
671
|
+
private :interpreter
|
|
689
672
|
end
|
|
690
673
|
|
|
691
674
|
class ValueComparison < ValueDomainNarrowing
|
|
@@ -705,11 +688,11 @@ module C #:nodoc:
|
|
|
705
688
|
rhs_var = object_to_variable(@rhs_manip.result)
|
|
706
689
|
|
|
707
690
|
unless lhs_var.type.scalar? && rhs_var.type.scalar?
|
|
708
|
-
return
|
|
691
|
+
return create_tmpvar(int_t)
|
|
709
692
|
end
|
|
710
693
|
|
|
711
694
|
unless lhs_var.value.scalar? && rhs_var.value.scalar?
|
|
712
|
-
return
|
|
695
|
+
return create_tmpvar(int_t)
|
|
713
696
|
end
|
|
714
697
|
|
|
715
698
|
lhs_conved, rhs_conved =
|
|
@@ -720,17 +703,17 @@ module C #:nodoc:
|
|
|
720
703
|
|
|
721
704
|
case @operator
|
|
722
705
|
when Operator::EQ
|
|
723
|
-
|
|
706
|
+
res_var = create_tmpvar(int_t, lhs_val == rhs_val)
|
|
724
707
|
when Operator::NE
|
|
725
|
-
|
|
708
|
+
res_var = create_tmpvar(int_t, lhs_val != rhs_val)
|
|
726
709
|
when Operator::LT
|
|
727
|
-
|
|
710
|
+
res_var = create_tmpvar(int_t, lhs_val < rhs_val)
|
|
728
711
|
when Operator::GT
|
|
729
|
-
|
|
712
|
+
res_var = create_tmpvar(int_t, lhs_val > rhs_val)
|
|
730
713
|
when Operator::LE
|
|
731
|
-
|
|
714
|
+
res_var = create_tmpvar(int_t, lhs_val <= rhs_val)
|
|
732
715
|
when Operator::GE
|
|
733
|
-
|
|
716
|
+
res_var = create_tmpvar(int_t, lhs_val >= rhs_val)
|
|
734
717
|
else
|
|
735
718
|
__NOTREACHED__
|
|
736
719
|
end
|
|
@@ -740,9 +723,9 @@ module C #:nodoc:
|
|
|
740
723
|
|
|
741
724
|
case @operator
|
|
742
725
|
when Operator::EQ, Operator::NE
|
|
743
|
-
notify_equality_expr_evaled(@node, lhs_conved, rhs_conved,
|
|
726
|
+
notify_equality_expr_evaled(@node, lhs_conved, rhs_conved, res_var)
|
|
744
727
|
when Operator::LT, Operator::GT, Operator::LE, Operator::GE
|
|
745
|
-
notify_relational_expr_evaled(@node, lhs_conved, rhs_conved,
|
|
728
|
+
notify_relational_expr_evaled(@node, lhs_conved, rhs_conved, res_var)
|
|
746
729
|
else
|
|
747
730
|
__NOTREACHED__
|
|
748
731
|
end
|
|
@@ -756,7 +739,7 @@ module C #:nodoc:
|
|
|
756
739
|
# NOTE: Domain of the rvalue should not be narrowed.
|
|
757
740
|
end
|
|
758
741
|
|
|
759
|
-
|
|
742
|
+
res_var
|
|
760
743
|
end
|
|
761
744
|
end
|
|
762
745
|
|
|
@@ -770,7 +753,7 @@ module C #:nodoc:
|
|
|
770
753
|
private
|
|
771
754
|
def do_narrowing
|
|
772
755
|
@lhs_manip.execute!
|
|
773
|
-
@lhs_manip.ensure_result_equal_to(
|
|
756
|
+
@lhs_manip.ensure_result_equal_to(scalar_value_of_true)
|
|
774
757
|
lhs_var = object_to_variable(@lhs_manip.result)
|
|
775
758
|
|
|
776
759
|
# NOTE: The ISO C99 standard says;
|
|
@@ -788,7 +771,7 @@ module C #:nodoc:
|
|
|
788
771
|
# TODO: Must look about the short-circuit evaluation.
|
|
789
772
|
@rhs_manip.load_original_values!(@lhs_manip)
|
|
790
773
|
@rhs_manip.execute!
|
|
791
|
-
@rhs_manip.ensure_result_equal_to(
|
|
774
|
+
@rhs_manip.ensure_result_equal_to(scalar_value_of_true)
|
|
792
775
|
rhs_var = object_to_variable(@rhs_manip.result)
|
|
793
776
|
|
|
794
777
|
notify_sequence_point_reached(SequencePoint.new(@node.rhs_operand))
|
|
@@ -798,11 +781,11 @@ module C #:nodoc:
|
|
|
798
781
|
notify_variable_value_referred(@node, rhs_var)
|
|
799
782
|
|
|
800
783
|
unless lhs_var.type.scalar? && rhs_var.type.scalar?
|
|
801
|
-
return
|
|
784
|
+
return create_tmpvar(int_t)
|
|
802
785
|
end
|
|
803
786
|
|
|
804
787
|
unless lhs_var.value.scalar? && rhs_var.value.scalar?
|
|
805
|
-
return
|
|
788
|
+
return create_tmpvar(int_t)
|
|
806
789
|
end
|
|
807
790
|
|
|
808
791
|
lhs_conved, rhs_conved =
|
|
@@ -811,9 +794,9 @@ module C #:nodoc:
|
|
|
811
794
|
lhs_val = lhs_conved.value
|
|
812
795
|
rhs_val = rhs_conved.value
|
|
813
796
|
|
|
814
|
-
|
|
815
|
-
notify_logical_and_expr_evaled(@node, lhs_conved, rhs_conved,
|
|
816
|
-
|
|
797
|
+
res_var = create_tmpvar(int_t, lhs_val.logical_and(rhs_val))
|
|
798
|
+
notify_logical_and_expr_evaled(@node, lhs_conved, rhs_conved, res_var)
|
|
799
|
+
res_var
|
|
817
800
|
end
|
|
818
801
|
end
|
|
819
802
|
|
|
@@ -827,7 +810,7 @@ module C #:nodoc:
|
|
|
827
810
|
private
|
|
828
811
|
def do_narrowing
|
|
829
812
|
@lhs_manip.execute!
|
|
830
|
-
@lhs_manip.ensure_result_equal_to(
|
|
813
|
+
@lhs_manip.ensure_result_equal_to(scalar_value_of_true)
|
|
831
814
|
lhs_var = object_to_variable(@lhs_manip.result)
|
|
832
815
|
|
|
833
816
|
# NOTE: The ISO C99 standard says;
|
|
@@ -846,7 +829,7 @@ module C #:nodoc:
|
|
|
846
829
|
# FIXME: Base value of the RHS narrowing should be updated to ensure that
|
|
847
830
|
# the LHS condition is false.
|
|
848
831
|
@rhs_manip.execute!
|
|
849
|
-
@rhs_manip.ensure_result_equal_to(
|
|
832
|
+
@rhs_manip.ensure_result_equal_to(scalar_value_of_true)
|
|
850
833
|
rhs_var = object_to_variable(@rhs_manip.result)
|
|
851
834
|
|
|
852
835
|
notify_sequence_point_reached(SequencePoint.new(@node.rhs_operand))
|
|
@@ -856,11 +839,11 @@ module C #:nodoc:
|
|
|
856
839
|
notify_variable_value_referred(@node, rhs_var)
|
|
857
840
|
|
|
858
841
|
unless lhs_var.type.scalar? && rhs_var.type.scalar?
|
|
859
|
-
return
|
|
842
|
+
return create_tmpvar(int_t)
|
|
860
843
|
end
|
|
861
844
|
|
|
862
845
|
unless lhs_var.value.scalar? && rhs_var.value.scalar?
|
|
863
|
-
return
|
|
846
|
+
return create_tmpvar(int_t)
|
|
864
847
|
end
|
|
865
848
|
|
|
866
849
|
lhs_conved, rhs_conved =
|
|
@@ -869,9 +852,9 @@ module C #:nodoc:
|
|
|
869
852
|
lhs_val = lhs_conved.value
|
|
870
853
|
rhs_val = rhs_conved.value
|
|
871
854
|
|
|
872
|
-
|
|
873
|
-
notify_logical_or_expr_evaled(@node, lhs_conved, rhs_conved,
|
|
874
|
-
|
|
855
|
+
res_var = create_tmpvar(int_t, lhs_val.logical_or(rhs_val))
|
|
856
|
+
notify_logical_or_expr_evaled(@node, lhs_conved, rhs_conved, res_var)
|
|
857
|
+
res_var
|
|
875
858
|
end
|
|
876
859
|
end
|
|
877
860
|
|
|
@@ -884,8 +867,8 @@ module C #:nodoc:
|
|
|
884
867
|
private
|
|
885
868
|
def do_narrowing
|
|
886
869
|
if @object.variable? && @object.named?
|
|
887
|
-
if
|
|
888
|
-
@object = PhantomVariable.new(@object,
|
|
870
|
+
if org_val = original_value_of(@object)
|
|
871
|
+
@object = PhantomVariable.new(@object, org_val)
|
|
889
872
|
end
|
|
890
873
|
end
|
|
891
874
|
@object
|