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 Enumerators.
|
|
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,7 +30,7 @@
|
|
|
30
30
|
#++
|
|
31
31
|
|
|
32
32
|
module AdLint #:nodoc:
|
|
33
|
-
module
|
|
33
|
+
module Cc1 #:nodoc:
|
|
34
34
|
|
|
35
35
|
class EnumeratorTable
|
|
36
36
|
def initialize
|
|
@@ -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-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,14 +29,14 @@
|
|
|
29
29
|
#
|
|
30
30
|
#++
|
|
31
31
|
|
|
32
|
-
require "adlint/
|
|
33
|
-
require "adlint/
|
|
34
|
-
require "adlint/
|
|
35
|
-
require "adlint/
|
|
36
|
-
require "adlint/
|
|
32
|
+
require "adlint/cc1/enum"
|
|
33
|
+
require "adlint/cc1/object"
|
|
34
|
+
require "adlint/cc1/builtin"
|
|
35
|
+
require "adlint/cc1/branch"
|
|
36
|
+
require "adlint/cc1/mediator"
|
|
37
37
|
|
|
38
38
|
module AdLint #:nodoc:
|
|
39
|
-
module
|
|
39
|
+
module Cc1 #:nodoc:
|
|
40
40
|
|
|
41
41
|
class Environment
|
|
42
42
|
include TypeTableMediator
|
|
@@ -45,11 +45,11 @@ module C #:nodoc:
|
|
|
45
45
|
include FunctionTableMediator
|
|
46
46
|
include EnumeratorTableMediator
|
|
47
47
|
|
|
48
|
-
def initialize(
|
|
49
|
-
@type_table
|
|
50
|
-
@memory_pool
|
|
51
|
-
@variable_table
|
|
52
|
-
@function_table
|
|
48
|
+
def initialize(type_tbl)
|
|
49
|
+
@type_table = type_tbl
|
|
50
|
+
@memory_pool = MemoryPool.new
|
|
51
|
+
@variable_table = VariableTable.new(@memory_pool)
|
|
52
|
+
@function_table = FunctionTable.new(@memory_pool)
|
|
53
53
|
@enumerator_table = EnumeratorTable.new
|
|
54
54
|
install_builtin_functions
|
|
55
55
|
reset
|
|
@@ -64,7 +64,7 @@ module C #:nodoc:
|
|
|
64
64
|
|
|
65
65
|
def reset
|
|
66
66
|
@current_scope = GlobalScope.new
|
|
67
|
-
@branch_depth
|
|
67
|
+
@branch_depth = 0
|
|
68
68
|
@branch_groups = {}
|
|
69
69
|
end
|
|
70
70
|
|
|
@@ -80,8 +80,8 @@ module C #:nodoc:
|
|
|
80
80
|
@function_table.leave_scope
|
|
81
81
|
end
|
|
82
82
|
|
|
83
|
-
def enter_branch_group(*
|
|
84
|
-
@branch_groups[@branch_depth] = BranchGroup.new(self, *
|
|
83
|
+
def enter_branch_group(*opts)
|
|
84
|
+
@branch_groups[@branch_depth] = BranchGroup.new(self, *opts)
|
|
85
85
|
end
|
|
86
86
|
|
|
87
87
|
def current_branch_group
|
|
@@ -92,15 +92,15 @@ module C #:nodoc:
|
|
|
92
92
|
@branch_groups.delete(@branch_depth)
|
|
93
93
|
end
|
|
94
94
|
|
|
95
|
-
def enter_branch(*
|
|
95
|
+
def enter_branch(*opts)
|
|
96
96
|
@branch_depth += 1
|
|
97
97
|
|
|
98
98
|
if group = current_branch_group
|
|
99
|
-
group.add_options(*
|
|
100
|
-
group.create_trailing_branch(*
|
|
99
|
+
group.add_options(*opts)
|
|
100
|
+
group.create_trailing_branch(*opts)
|
|
101
101
|
else
|
|
102
|
-
group = enter_branch_group(*
|
|
103
|
-
group.create_first_branch(*
|
|
102
|
+
group = enter_branch_group(*opts)
|
|
103
|
+
group.create_first_branch(*opts)
|
|
104
104
|
end
|
|
105
105
|
end
|
|
106
106
|
|
|
@@ -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-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,13 +29,13 @@
|
|
|
29
29
|
#
|
|
30
30
|
#++
|
|
31
31
|
|
|
32
|
-
require "adlint/
|
|
33
|
-
require "adlint/
|
|
34
|
-
require "adlint/
|
|
35
|
-
require "adlint/
|
|
32
|
+
require "adlint/cc1/mediator"
|
|
33
|
+
require "adlint/cc1/const"
|
|
34
|
+
require "adlint/cc1/conv"
|
|
35
|
+
require "adlint/cc1/seqp"
|
|
36
36
|
|
|
37
37
|
module AdLint #:nodoc:
|
|
38
|
-
module
|
|
38
|
+
module Cc1 #:nodoc:
|
|
39
39
|
|
|
40
40
|
module ExpressionEvaluator
|
|
41
41
|
# NOTE: Host class of this module must include InterpreterMediator and
|
|
@@ -47,7 +47,7 @@ module C #:nodoc:
|
|
|
47
47
|
|
|
48
48
|
def visit_error_expression(node)
|
|
49
49
|
checkpoint(node.location)
|
|
50
|
-
|
|
50
|
+
create_tmpvar
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
def visit_object_specifier(node)
|
|
@@ -62,7 +62,7 @@ module C #:nodoc:
|
|
|
62
62
|
notify_constant_referred(node, const_var)
|
|
63
63
|
const_var
|
|
64
64
|
else
|
|
65
|
-
|
|
65
|
+
create_tmpvar
|
|
66
66
|
end
|
|
67
67
|
end
|
|
68
68
|
|
|
@@ -71,13 +71,13 @@ module C #:nodoc:
|
|
|
71
71
|
|
|
72
72
|
case node.literal.value
|
|
73
73
|
when /\A"(.*)"\z/
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
create_tmpvar(array_type(char_t, $1.length + 1),
|
|
75
|
+
create_array_value_of_string($1))
|
|
76
76
|
when /\AL"(.*)"\z/i
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
create_tmpvar(array_type(wchar_t, $1.length + 1),
|
|
78
|
+
create_array_value_of_string($1))
|
|
79
79
|
else
|
|
80
|
-
|
|
80
|
+
create_tmpvar(array_type(char_t))
|
|
81
81
|
end
|
|
82
82
|
end
|
|
83
83
|
|
|
@@ -85,7 +85,7 @@ module C #:nodoc:
|
|
|
85
85
|
checkpoint(node.location)
|
|
86
86
|
# TODO: NULL may not be 0 on some environments.
|
|
87
87
|
# Representation of NULL should be configurable?
|
|
88
|
-
|
|
88
|
+
create_tmpvar(pointer_type(void_t), scalar_value_of(0))
|
|
89
89
|
end
|
|
90
90
|
|
|
91
91
|
def visit_grouped_expression(node)
|
|
@@ -118,13 +118,13 @@ module C #:nodoc:
|
|
|
118
118
|
def visit_bit_access_by_value_expression(node)
|
|
119
119
|
checkpoint(node.location)
|
|
120
120
|
# TODO: Should support the GCC extension.
|
|
121
|
-
|
|
121
|
+
create_tmpvar
|
|
122
122
|
end
|
|
123
123
|
|
|
124
124
|
def visit_bit_access_by_pointer_expression(node)
|
|
125
125
|
checkpoint(node.location)
|
|
126
126
|
# TODO: Should support the GCC extension.
|
|
127
|
-
|
|
127
|
+
create_tmpvar
|
|
128
128
|
end
|
|
129
129
|
|
|
130
130
|
def visit_postfix_increment_expression(node)
|
|
@@ -140,7 +140,7 @@ module C #:nodoc:
|
|
|
140
140
|
def visit_compound_literal_expression(node)
|
|
141
141
|
checkpoint(node.location)
|
|
142
142
|
# TODO: Should support C99 features.
|
|
143
|
-
|
|
143
|
+
create_tmpvar(node.type_name.type)
|
|
144
144
|
end
|
|
145
145
|
|
|
146
146
|
def visit_prefix_increment_expression(node)
|
|
@@ -171,48 +171,48 @@ module C #:nodoc:
|
|
|
171
171
|
def visit_sizeof_expression(node)
|
|
172
172
|
checkpoint(node.location)
|
|
173
173
|
|
|
174
|
-
|
|
174
|
+
ope_obj = res_var = nil
|
|
175
175
|
eval_without_side_effect do
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
if
|
|
179
|
-
size =
|
|
180
|
-
|
|
176
|
+
res_type = type_of(UserTypeId.new("size_t")) || unsigned_long_t
|
|
177
|
+
ope_obj = node.operand.accept(self)
|
|
178
|
+
if ope_obj.variable?
|
|
179
|
+
size = ope_obj.type.aligned_byte_size
|
|
180
|
+
res_var = create_tmpvar(res_type, scalar_value_of(size))
|
|
181
181
|
else
|
|
182
|
-
return
|
|
182
|
+
return create_tmpvar(res_type)
|
|
183
183
|
end
|
|
184
184
|
end
|
|
185
185
|
|
|
186
|
-
notify_sizeof_expr_evaled(node,
|
|
187
|
-
|
|
186
|
+
notify_sizeof_expr_evaled(node, ope_obj, res_var)
|
|
187
|
+
res_var
|
|
188
188
|
end
|
|
189
189
|
|
|
190
190
|
def visit_sizeof_type_expression(node)
|
|
191
191
|
checkpoint(node.location)
|
|
192
192
|
resolve_unresolved_type(node.operand)
|
|
193
193
|
|
|
194
|
-
|
|
194
|
+
res_var = nil
|
|
195
195
|
eval_without_side_effect do
|
|
196
|
-
|
|
196
|
+
res_type = type_of(UserTypeId.new("size_t")) || unsigned_long_t
|
|
197
197
|
size = node.operand.type.aligned_byte_size
|
|
198
|
-
|
|
198
|
+
res_var = create_tmpvar(res_type, scalar_value_of(size))
|
|
199
199
|
end
|
|
200
200
|
|
|
201
|
-
notify_sizeof_type_expr_evaled(node, node.operand.type,
|
|
202
|
-
|
|
201
|
+
notify_sizeof_type_expr_evaled(node, node.operand.type, res_var)
|
|
202
|
+
res_var
|
|
203
203
|
end
|
|
204
204
|
|
|
205
205
|
def visit_alignof_expression(node)
|
|
206
206
|
checkpoint(node.location)
|
|
207
207
|
|
|
208
208
|
eval_without_side_effect do
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
if
|
|
212
|
-
align =
|
|
213
|
-
|
|
209
|
+
res_type = type_of(UserTypeId.new("size_t")) || unsigned_long_t
|
|
210
|
+
ope_obj = node.operand.accept(self)
|
|
211
|
+
if ope_obj.variable?
|
|
212
|
+
align = ope_obj.type.byte_alignment
|
|
213
|
+
create_tmpvar(res_type, scalar_value_of(align))
|
|
214
214
|
else
|
|
215
|
-
|
|
215
|
+
create_tmpvar(res_type)
|
|
216
216
|
end
|
|
217
217
|
end
|
|
218
218
|
end
|
|
@@ -222,9 +222,9 @@ module C #:nodoc:
|
|
|
222
222
|
resolve_unresolved_type(node.operand)
|
|
223
223
|
|
|
224
224
|
eval_without_side_effect do
|
|
225
|
-
|
|
225
|
+
res_type = type_of(UserTypeId.new("size_t")) || unsigned_long_t
|
|
226
226
|
align = node.operand.type.aligned_byte_size
|
|
227
|
-
|
|
227
|
+
create_tmpvar(res_type, scalar_value_of(align))
|
|
228
228
|
end
|
|
229
229
|
end
|
|
230
230
|
|
|
@@ -288,7 +288,7 @@ module C #:nodoc:
|
|
|
288
288
|
if lhs_obj.variable?
|
|
289
289
|
lhs_var = lhs_obj
|
|
290
290
|
else
|
|
291
|
-
return
|
|
291
|
+
return create_tmpvar(int_t)
|
|
292
292
|
end
|
|
293
293
|
|
|
294
294
|
# NOTE: The ISO C99 standard says;
|
|
@@ -307,14 +307,14 @@ module C #:nodoc:
|
|
|
307
307
|
if lhs_val.scalar? && lhs_val.must_be_false?
|
|
308
308
|
# NOTE: Doing the short-circuit evaluation.
|
|
309
309
|
notify_variable_value_referred(node, lhs_var)
|
|
310
|
-
return
|
|
310
|
+
return create_tmpvar(int_t, scalar_value_of_false)
|
|
311
311
|
end
|
|
312
312
|
|
|
313
313
|
rhs_obj = node.rhs_operand.accept(self)
|
|
314
314
|
if rhs_obj.variable?
|
|
315
315
|
rhs_var = rhs_obj
|
|
316
316
|
else
|
|
317
|
-
return
|
|
317
|
+
return create_tmpvar(int_t)
|
|
318
318
|
end
|
|
319
319
|
|
|
320
320
|
notify_sequence_point_reached(SequencePoint.new(node.rhs_operand))
|
|
@@ -322,15 +322,15 @@ module C #:nodoc:
|
|
|
322
322
|
|
|
323
323
|
if lhs_val.scalar? && rhs_val.scalar?
|
|
324
324
|
# NOTE: No usual-arithmetic-conversion.
|
|
325
|
-
|
|
325
|
+
res_var = create_tmpvar(int_t, lhs_val.logical_and(rhs_val))
|
|
326
326
|
else
|
|
327
|
-
|
|
327
|
+
res_var = create_tmpvar(int_t)
|
|
328
328
|
end
|
|
329
329
|
notify_variable_value_referred(node, lhs_var)
|
|
330
330
|
notify_variable_value_referred(node, rhs_var)
|
|
331
331
|
|
|
332
|
-
notify_logical_and_expr_evaled(node, lhs_var, rhs_var,
|
|
333
|
-
|
|
332
|
+
notify_logical_and_expr_evaled(node, lhs_var, rhs_var, res_var)
|
|
333
|
+
res_var
|
|
334
334
|
end
|
|
335
335
|
|
|
336
336
|
def visit_logical_or_expression(node)
|
|
@@ -340,7 +340,7 @@ module C #:nodoc:
|
|
|
340
340
|
if lhs_obj.variable?
|
|
341
341
|
lhs_var = lhs_obj
|
|
342
342
|
else
|
|
343
|
-
return
|
|
343
|
+
return create_tmpvar(int_t)
|
|
344
344
|
end
|
|
345
345
|
|
|
346
346
|
# NOTE: The ISO C99 standard says;
|
|
@@ -359,14 +359,14 @@ module C #:nodoc:
|
|
|
359
359
|
if lhs_val.scalar? && lhs_val.must_be_true?
|
|
360
360
|
# NOTE: Doing the short-circuit evaluation.
|
|
361
361
|
notify_variable_value_referred(node, lhs_var)
|
|
362
|
-
return
|
|
362
|
+
return create_tmpvar(int_t, scalar_value_of_true)
|
|
363
363
|
end
|
|
364
364
|
|
|
365
365
|
rhs_obj = node.rhs_operand.accept(self)
|
|
366
366
|
if rhs_obj.variable?
|
|
367
367
|
rhs_var = rhs_obj
|
|
368
368
|
else
|
|
369
|
-
return
|
|
369
|
+
return create_tmpvar(int_t)
|
|
370
370
|
end
|
|
371
371
|
|
|
372
372
|
notify_sequence_point_reached(SequencePoint.new(node.rhs_operand))
|
|
@@ -374,15 +374,15 @@ module C #:nodoc:
|
|
|
374
374
|
|
|
375
375
|
if lhs_val.scalar? && rhs_val.scalar?
|
|
376
376
|
# NOTE: No usual-arithmetic-conversion.
|
|
377
|
-
|
|
377
|
+
res_var = create_tmpvar(int_t, lhs_val.logical_or(rhs_val))
|
|
378
378
|
else
|
|
379
|
-
|
|
379
|
+
res_var = create_tmpvar(int_t)
|
|
380
380
|
end
|
|
381
381
|
notify_variable_value_referred(node, lhs_var)
|
|
382
382
|
notify_variable_value_referred(node, rhs_var)
|
|
383
383
|
|
|
384
|
-
notify_logical_or_expr_evaled(node, lhs_var, rhs_var,
|
|
385
|
-
|
|
384
|
+
notify_logical_or_expr_evaled(node, lhs_var, rhs_var, res_var)
|
|
385
|
+
res_var
|
|
386
386
|
end
|
|
387
387
|
|
|
388
388
|
def visit_simple_assignment_expression(node)
|
|
@@ -421,8 +421,8 @@ module C #:nodoc:
|
|
|
421
421
|
end
|
|
422
422
|
|
|
423
423
|
def create_array_value_of_string(str)
|
|
424
|
-
ArrayValue.new(str.chars.map { |ch|
|
|
425
|
-
[
|
|
424
|
+
ArrayValue.new(str.chars.map { |ch| scalar_value_of(ch.ord) } +
|
|
425
|
+
[scalar_value_of("\0".ord)])
|
|
426
426
|
end
|
|
427
427
|
|
|
428
428
|
module Impl
|
|
@@ -441,38 +441,40 @@ module C #:nodoc:
|
|
|
441
441
|
return var
|
|
442
442
|
end
|
|
443
443
|
|
|
444
|
-
if
|
|
445
|
-
|
|
444
|
+
if fun = function_named(node.identifier.value)
|
|
445
|
+
fun.declarations_and_definitions.each do |dcl_or_def|
|
|
446
446
|
dcl_or_def.mark_as_referred_by(node.identifier)
|
|
447
447
|
end
|
|
448
|
-
_notify_object_referred(node,
|
|
449
|
-
return
|
|
448
|
+
_notify_object_referred(node, fun)
|
|
449
|
+
return fun
|
|
450
450
|
end
|
|
451
451
|
|
|
452
452
|
if enum = enumerator_named(node.identifier.value)
|
|
453
453
|
enum.mark_as_referred_by(node.identifier)
|
|
454
|
-
return
|
|
454
|
+
return create_tmpvar(enum.type, scalar_value_of(enum.value))
|
|
455
455
|
end
|
|
456
456
|
|
|
457
|
-
|
|
457
|
+
fun = declare_implicit_function(node.identifier.value)
|
|
458
|
+
_notify_implicit_function_declared(node, fun)
|
|
459
|
+
_notify_object_referred(node, fun)
|
|
460
|
+
fun
|
|
458
461
|
end
|
|
459
462
|
|
|
460
463
|
def eval_array_subscript_expr(node, obj, subs)
|
|
461
464
|
unless obj.variable? && (obj.type.array? || obj.type.pointer?)
|
|
462
|
-
return
|
|
465
|
+
return create_tmpvar
|
|
463
466
|
end
|
|
464
467
|
|
|
465
|
-
|
|
466
|
-
result_type = ary_or_ptr.type.unqualify.base_type
|
|
468
|
+
res_type = obj.type.unqualify.base_type
|
|
467
469
|
|
|
468
470
|
case
|
|
469
|
-
when
|
|
470
|
-
ary =
|
|
471
|
+
when obj.type.array?
|
|
472
|
+
ary = obj
|
|
471
473
|
# NOTE: An array-subscript-expression with an array object only
|
|
472
474
|
# refers the array object, never refer the value of the array
|
|
473
475
|
# object.
|
|
474
|
-
when
|
|
475
|
-
ptr =
|
|
476
|
+
when obj.type.pointer?
|
|
477
|
+
ptr = obj
|
|
476
478
|
if pointee = pointee_of(ptr) and pointee.type.array?
|
|
477
479
|
ary = pointee
|
|
478
480
|
end
|
|
@@ -484,18 +486,18 @@ module C #:nodoc:
|
|
|
484
486
|
unless subs.variable? and
|
|
485
487
|
subs.value.scalar? && subs.value.exist? or subs.type.void?
|
|
486
488
|
# NOTE: To detect bad value reference of `void' expressions.
|
|
487
|
-
return
|
|
489
|
+
return create_tmpvar(res_type)
|
|
488
490
|
end
|
|
489
491
|
_notify_variable_value_referred(node, subs)
|
|
490
492
|
|
|
491
493
|
# NOTE: An array subscript converted to `int' implicitly.
|
|
492
|
-
unless subs.type.same_as?(
|
|
493
|
-
if int_subs = do_conversion(subs,
|
|
494
|
+
unless subs.type.same_as?(int_t)
|
|
495
|
+
if int_subs = do_conversion(subs, int_t)
|
|
494
496
|
notify_implicit_conv_performed(node.array_subscript,
|
|
495
497
|
subs, int_subs)
|
|
496
498
|
subs = int_subs
|
|
497
499
|
else
|
|
498
|
-
return
|
|
500
|
+
return create_tmpvar(res_type)
|
|
499
501
|
end
|
|
500
502
|
end
|
|
501
503
|
|
|
@@ -503,28 +505,27 @@ module C #:nodoc:
|
|
|
503
505
|
subs_val = subs.value.unique_sample
|
|
504
506
|
if ary and inner_var = ary.inner_variable_at(subs_val)
|
|
505
507
|
_notify_object_referred(node, inner_var)
|
|
506
|
-
if inner_var.type.same_as?(
|
|
507
|
-
|
|
508
|
+
if inner_var.type.same_as?(res_type)
|
|
509
|
+
res_var = inner_var
|
|
508
510
|
end
|
|
509
511
|
end
|
|
510
|
-
|
|
512
|
+
res_var ||= create_tmpvar(res_type)
|
|
511
513
|
|
|
512
|
-
notify_array_subscript_expr_evaled(node,
|
|
513
|
-
|
|
514
|
-
result_var
|
|
514
|
+
notify_array_subscript_expr_evaled(node, obj, subs, ary, res_var)
|
|
515
|
+
res_var
|
|
515
516
|
end
|
|
516
517
|
|
|
517
518
|
def eval_function_call_expr(node, obj, args)
|
|
518
519
|
if obj.function?
|
|
519
|
-
|
|
520
|
+
fun = obj
|
|
520
521
|
else
|
|
521
|
-
return
|
|
522
|
+
return create_tmpvar unless obj.type.pointer?
|
|
522
523
|
obj_base_type = obj.type.unqualify.base_type
|
|
523
524
|
if obj_base_type.function?
|
|
524
525
|
if pointee = pointee_of(obj) and pointee.function?
|
|
525
|
-
|
|
526
|
+
fun = pointee
|
|
526
527
|
else
|
|
527
|
-
|
|
528
|
+
fun = define_anonymous_function(obj_base_type)
|
|
528
529
|
end
|
|
529
530
|
end
|
|
530
531
|
end
|
|
@@ -543,20 +544,28 @@ module C #:nodoc:
|
|
|
543
544
|
notify_sequence_point_reached(SequencePoint.new(node))
|
|
544
545
|
end
|
|
545
546
|
|
|
546
|
-
|
|
547
|
-
|
|
547
|
+
res_var = nil
|
|
548
|
+
break_event = BreakEvent.catch {
|
|
549
|
+
res_var = fun.call(interpreter, node, args)
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
unless fun.builtin?
|
|
548
553
|
arg_vars = args.map { |arg_obj, *| object_to_variable(arg_obj) }
|
|
549
|
-
notify_function_call_expr_evaled(node,
|
|
554
|
+
notify_function_call_expr_evaled(node, fun, arg_vars, res_var)
|
|
550
555
|
end
|
|
551
556
|
|
|
552
|
-
|
|
557
|
+
if break_event
|
|
558
|
+
break_event.throw
|
|
559
|
+
else
|
|
560
|
+
res_var
|
|
561
|
+
end
|
|
553
562
|
end
|
|
554
563
|
|
|
555
564
|
def eval_member_access_by_value_expr(node, obj)
|
|
556
565
|
if obj.variable? && obj.type.composite?
|
|
557
566
|
outer_var = obj
|
|
558
567
|
else
|
|
559
|
-
return
|
|
568
|
+
return create_tmpvar
|
|
560
569
|
end
|
|
561
570
|
|
|
562
571
|
memb_var = outer_var.inner_variable_named(node.identifier.value)
|
|
@@ -571,7 +580,7 @@ module C #:nodoc:
|
|
|
571
580
|
_notify_object_referred(node, memb_var)
|
|
572
581
|
memb_var
|
|
573
582
|
else
|
|
574
|
-
|
|
583
|
+
create_tmpvar
|
|
575
584
|
end
|
|
576
585
|
end
|
|
577
586
|
|
|
@@ -580,7 +589,7 @@ module C #:nodoc:
|
|
|
580
589
|
if obj.variable? && obj_type.pointer? && obj_type.base_type.composite?
|
|
581
590
|
ptr = obj
|
|
582
591
|
else
|
|
583
|
-
return
|
|
592
|
+
return create_tmpvar
|
|
584
593
|
end
|
|
585
594
|
|
|
586
595
|
if pointee = pointee_of(ptr)
|
|
@@ -588,7 +597,7 @@ module C #:nodoc:
|
|
|
588
597
|
if first_elem = pointee.inner_variable_at(0)
|
|
589
598
|
pointee = first_elem
|
|
590
599
|
else
|
|
591
|
-
pointee =
|
|
600
|
+
pointee = create_tmpvar(obj_type.base_type)
|
|
592
601
|
end
|
|
593
602
|
end
|
|
594
603
|
end
|
|
@@ -601,7 +610,7 @@ module C #:nodoc:
|
|
|
601
610
|
memb_var = outer_var.inner_variable_named(node.identifier.value)
|
|
602
611
|
else
|
|
603
612
|
if memb = obj_type.base_type.member_named(node.identifier.value)
|
|
604
|
-
memb_var =
|
|
613
|
+
memb_var = create_tmpvar(memb.type)
|
|
605
614
|
end
|
|
606
615
|
end
|
|
607
616
|
|
|
@@ -613,7 +622,7 @@ module C #:nodoc:
|
|
|
613
622
|
_notify_object_referred(node, memb_var)
|
|
614
623
|
memb_var
|
|
615
624
|
else
|
|
616
|
-
|
|
625
|
+
create_tmpvar
|
|
617
626
|
end
|
|
618
627
|
end
|
|
619
628
|
|
|
@@ -621,10 +630,10 @@ module C #:nodoc:
|
|
|
621
630
|
if obj.variable? && obj.type.scalar?
|
|
622
631
|
var = obj
|
|
623
632
|
else
|
|
624
|
-
return
|
|
633
|
+
return create_tmpvar
|
|
625
634
|
end
|
|
626
635
|
|
|
627
|
-
|
|
636
|
+
res_var = create_tmpvar(var.type, var.value.dup)
|
|
628
637
|
|
|
629
638
|
# NOTE: Value of the variable is referred at this point. But value
|
|
630
639
|
# reference should not be notified not to confuse sequence-point
|
|
@@ -632,22 +641,22 @@ module C #:nodoc:
|
|
|
632
641
|
# _notify_variable_value_referred(node, var)
|
|
633
642
|
|
|
634
643
|
if var.value.scalar?
|
|
635
|
-
var.assign!(var.value +
|
|
644
|
+
var.assign!(var.value + scalar_value_of(1))
|
|
636
645
|
_notify_variable_value_updated(node, var)
|
|
637
646
|
end
|
|
638
647
|
|
|
639
|
-
notify_postfix_increment_expr_evaled(node, var,
|
|
640
|
-
|
|
648
|
+
notify_postfix_increment_expr_evaled(node, var, res_var)
|
|
649
|
+
res_var
|
|
641
650
|
end
|
|
642
651
|
|
|
643
652
|
def eval_postfix_decrement_expr(node, obj)
|
|
644
653
|
if obj.variable? && obj.type.scalar?
|
|
645
654
|
var = obj
|
|
646
655
|
else
|
|
647
|
-
return
|
|
656
|
+
return create_tmpvar
|
|
648
657
|
end
|
|
649
658
|
|
|
650
|
-
|
|
659
|
+
res_var = create_tmpvar(var.type, var.value.dup)
|
|
651
660
|
|
|
652
661
|
# NOTE: Value of the variable is referred at this point. But value
|
|
653
662
|
# reference should not be notified not to confuse sequence-point
|
|
@@ -655,22 +664,22 @@ module C #:nodoc:
|
|
|
655
664
|
# _notify_variable_value_referred(node, var)
|
|
656
665
|
|
|
657
666
|
if var.value.scalar?
|
|
658
|
-
var.assign!(var.value -
|
|
667
|
+
var.assign!(var.value - scalar_value_of(1))
|
|
659
668
|
_notify_variable_value_updated(node, var)
|
|
660
669
|
end
|
|
661
670
|
|
|
662
|
-
notify_postfix_decrement_expr_evaled(node, var,
|
|
663
|
-
|
|
671
|
+
notify_postfix_decrement_expr_evaled(node, var, res_var)
|
|
672
|
+
res_var
|
|
664
673
|
end
|
|
665
674
|
|
|
666
675
|
def eval_prefix_increment_expr(node, obj)
|
|
667
676
|
if obj.variable? && obj.type.scalar?
|
|
668
677
|
var = obj
|
|
669
678
|
else
|
|
670
|
-
return
|
|
679
|
+
return create_tmpvar
|
|
671
680
|
end
|
|
672
681
|
|
|
673
|
-
|
|
682
|
+
org_val = var.value.dup
|
|
674
683
|
|
|
675
684
|
# NOTE: Value of the variable is referred at this point. But value
|
|
676
685
|
# reference should not be notified not to confuse sequence-point
|
|
@@ -678,22 +687,22 @@ module C #:nodoc:
|
|
|
678
687
|
# _notify_variable_value_referred(node, var)
|
|
679
688
|
|
|
680
689
|
if var.value.scalar?
|
|
681
|
-
var.assign!(var.value +
|
|
690
|
+
var.assign!(var.value + scalar_value_of(1))
|
|
682
691
|
_notify_variable_value_updated(node, var)
|
|
683
692
|
end
|
|
684
693
|
|
|
685
|
-
notify_prefix_increment_expr_evaled(node, var,
|
|
686
|
-
|
|
694
|
+
notify_prefix_increment_expr_evaled(node, var, org_val)
|
|
695
|
+
create_tmpvar(var.type, var.value)
|
|
687
696
|
end
|
|
688
697
|
|
|
689
698
|
def eval_prefix_decrement_expr(node, obj)
|
|
690
699
|
if obj.variable? && obj.type.scalar?
|
|
691
700
|
var = obj
|
|
692
701
|
else
|
|
693
|
-
return
|
|
702
|
+
return create_tmpvar
|
|
694
703
|
end
|
|
695
704
|
|
|
696
|
-
|
|
705
|
+
org_val = var.value.dup
|
|
697
706
|
|
|
698
707
|
# NOTE: Value of the variable is referred at this point. But value
|
|
699
708
|
# reference should not be notified not to confuse sequence-point
|
|
@@ -701,12 +710,12 @@ module C #:nodoc:
|
|
|
701
710
|
# _notify_variable_value_referred(node, var)
|
|
702
711
|
|
|
703
712
|
if var.value.scalar?
|
|
704
|
-
var.assign!(var.value -
|
|
713
|
+
var.assign!(var.value - scalar_value_of(1))
|
|
705
714
|
_notify_variable_value_updated(node, var)
|
|
706
715
|
end
|
|
707
716
|
|
|
708
|
-
notify_prefix_decrement_expr_evaled(node, var,
|
|
709
|
-
|
|
717
|
+
notify_prefix_decrement_expr_evaled(node, var, org_val)
|
|
718
|
+
create_tmpvar(var.type, var.value)
|
|
710
719
|
end
|
|
711
720
|
|
|
712
721
|
def eval_address_expr(node, obj)
|
|
@@ -715,7 +724,7 @@ module C #:nodoc:
|
|
|
715
724
|
# variable cross-references.
|
|
716
725
|
_notify_variable_value_referred(node, obj)
|
|
717
726
|
|
|
718
|
-
ptr =
|
|
727
|
+
ptr = create_tmpvar(pointer_type(obj.type), pointer_value_of(obj))
|
|
719
728
|
notify_address_expr_evaled(node, obj, ptr)
|
|
720
729
|
ptr
|
|
721
730
|
end
|
|
@@ -724,7 +733,7 @@ module C #:nodoc:
|
|
|
724
733
|
if obj.variable? && obj.type.pointer?
|
|
725
734
|
ptr = obj
|
|
726
735
|
else
|
|
727
|
-
return
|
|
736
|
+
return create_tmpvar
|
|
728
737
|
end
|
|
729
738
|
|
|
730
739
|
pointee = pointee_of(ptr)
|
|
@@ -739,18 +748,18 @@ module C #:nodoc:
|
|
|
739
748
|
if first_elem = pointee.inner_variable_at(0)
|
|
740
749
|
pointee = first_elem
|
|
741
750
|
else
|
|
742
|
-
pointee =
|
|
751
|
+
pointee = create_tmpvar(ptr_base_type)
|
|
743
752
|
end
|
|
744
753
|
end
|
|
745
754
|
|
|
746
755
|
unless ptr_base_type.same_as?(pointee.type)
|
|
747
756
|
pointee = do_conversion(pointee, ptr_base_type) ||
|
|
748
|
-
|
|
757
|
+
create_tmpvar(ptr_base_type)
|
|
749
758
|
end
|
|
750
759
|
when ptr_base_type.function?
|
|
751
760
|
pointee = define_anonymous_function(ptr_base_type)
|
|
752
761
|
else
|
|
753
|
-
pointee =
|
|
762
|
+
pointee = create_tmpvar(ptr_base_type)
|
|
754
763
|
end
|
|
755
764
|
|
|
756
765
|
notify_indirection_expr_evaled(node, ptr, pointee)
|
|
@@ -762,44 +771,44 @@ module C #:nodoc:
|
|
|
762
771
|
case
|
|
763
772
|
when !var.type.scalar? && !var.type.void?
|
|
764
773
|
# NOTE: To detect bad value reference of `void' expressions.
|
|
765
|
-
return
|
|
774
|
+
return create_tmpvar
|
|
766
775
|
when var != obj
|
|
767
776
|
notify_implicit_conv_performed(node.operand, obj, var)
|
|
768
777
|
end
|
|
769
778
|
|
|
770
779
|
case node.operator.type
|
|
771
780
|
when "+"
|
|
772
|
-
|
|
781
|
+
res_var = create_tmpvar(var.type, +var.value)
|
|
773
782
|
when "-"
|
|
774
|
-
|
|
783
|
+
res_var = create_tmpvar(var.type, -var.value)
|
|
775
784
|
when "~"
|
|
776
|
-
|
|
785
|
+
res_var = create_tmpvar(var.type, ~var.value)
|
|
777
786
|
when "!"
|
|
778
|
-
|
|
787
|
+
res_var = create_tmpvar(int_t, !var.value)
|
|
779
788
|
else
|
|
780
789
|
__NOTREACHED__
|
|
781
790
|
end
|
|
782
791
|
_notify_variable_value_referred(node, var)
|
|
783
792
|
|
|
784
|
-
notify_unary_arithmetic_expr_evaled(node, var,
|
|
785
|
-
|
|
793
|
+
notify_unary_arithmetic_expr_evaled(node, var, res_var)
|
|
794
|
+
res_var
|
|
786
795
|
end
|
|
787
796
|
|
|
788
797
|
def eval_cast_expr(node, obj)
|
|
789
798
|
resolve_unresolved_type(node.type_name)
|
|
790
799
|
|
|
791
800
|
var = object_to_variable(obj)
|
|
792
|
-
|
|
793
|
-
|
|
801
|
+
res_var = do_conversion(var, node.type_name.type) ||
|
|
802
|
+
create_tmpvar(node.type_name.type)
|
|
794
803
|
|
|
795
|
-
notify_explicit_conv_performed(node, var,
|
|
804
|
+
notify_explicit_conv_performed(node, var, res_var)
|
|
796
805
|
|
|
797
806
|
# NOTE: A cast-expression does not refer a source value essentially.
|
|
798
807
|
# But, to avoid misunderstand that a return value of a function
|
|
799
808
|
# is discarded when the return value is casted before assigning
|
|
800
809
|
# to a variable.
|
|
801
810
|
_notify_variable_value_referred(node, var)
|
|
802
|
-
|
|
811
|
+
res_var
|
|
803
812
|
end
|
|
804
813
|
|
|
805
814
|
def eval_multiplicative_expr(node, lhs_obj, rhs_obj)
|
|
@@ -807,7 +816,7 @@ module C #:nodoc:
|
|
|
807
816
|
case
|
|
808
817
|
when !lhs_var.type.scalar? && !lhs_var.type.void?
|
|
809
818
|
# NOTE: To detect bad value reference of `void' expressions.
|
|
810
|
-
return
|
|
819
|
+
return create_tmpvar
|
|
811
820
|
when lhs_var != lhs_obj
|
|
812
821
|
notify_implicit_conv_performed(node.lhs_operand, lhs_obj, lhs_var)
|
|
813
822
|
end
|
|
@@ -816,7 +825,7 @@ module C #:nodoc:
|
|
|
816
825
|
case
|
|
817
826
|
when !rhs_var.type.scalar? && !rhs_var.type.void?
|
|
818
827
|
# NOTE: To detect bad value reference of `void' expressions.
|
|
819
|
-
return
|
|
828
|
+
return create_tmpvar
|
|
820
829
|
when rhs_var != rhs_obj
|
|
821
830
|
notify_implicit_conv_performed(node.rhs_operand, rhs_obj, rhs_var)
|
|
822
831
|
end
|
|
@@ -838,27 +847,27 @@ module C #:nodoc:
|
|
|
838
847
|
when "*"
|
|
839
848
|
# NOTE: Domain of the arithmetic result value will be restricted by
|
|
840
849
|
# min-max of the variable type.
|
|
841
|
-
|
|
850
|
+
res_var = create_tmpvar(lhs_conved.type, lhs_val * rhs_val)
|
|
842
851
|
when "/"
|
|
843
852
|
# NOTE: Domain of the arithmetic result value will be restricted by
|
|
844
853
|
# min-max of the variable type.
|
|
845
854
|
# NOTE: "Div by 0" semantics is implemented in value-value
|
|
846
855
|
# arithmetic.
|
|
847
|
-
|
|
856
|
+
res_var = create_tmpvar(lhs_conved.type, lhs_val / rhs_val)
|
|
848
857
|
when "%"
|
|
849
858
|
# NOTE: Domain of the arithmetic result value will be restricted by
|
|
850
859
|
# min-max of the variable type.
|
|
851
860
|
# NOTE: "Div by 0" semantics is implemented in value-value
|
|
852
861
|
# arithmetic.
|
|
853
|
-
|
|
862
|
+
res_var = create_tmpvar(lhs_conved.type, lhs_val % rhs_val)
|
|
854
863
|
else
|
|
855
864
|
__NOTREACHED__
|
|
856
865
|
end
|
|
857
866
|
_notify_variable_value_referred(node, lhs_var)
|
|
858
867
|
_notify_variable_value_referred(node, rhs_var)
|
|
859
868
|
|
|
860
|
-
notify_multiplicative_expr_evaled(node, lhs_var, rhs_var,
|
|
861
|
-
|
|
869
|
+
notify_multiplicative_expr_evaled(node, lhs_var, rhs_var, res_var)
|
|
870
|
+
res_var
|
|
862
871
|
end
|
|
863
872
|
|
|
864
873
|
def eval_additive_expr(node, lhs_obj, rhs_obj)
|
|
@@ -866,7 +875,7 @@ module C #:nodoc:
|
|
|
866
875
|
case
|
|
867
876
|
when !lhs_var.type.scalar? && !lhs_var.type.void?
|
|
868
877
|
# NOTE: To detect bad value reference of `void' expressions.
|
|
869
|
-
return
|
|
878
|
+
return create_tmpvar
|
|
870
879
|
when lhs_var != lhs_obj
|
|
871
880
|
notify_implicit_conv_performed(node.lhs_operand, lhs_obj, lhs_var)
|
|
872
881
|
end
|
|
@@ -875,7 +884,7 @@ module C #:nodoc:
|
|
|
875
884
|
case
|
|
876
885
|
when !rhs_var.type.scalar? && !rhs_var.type.void?
|
|
877
886
|
# NOTE: To detect bad value reference of `void' expressions.
|
|
878
|
-
return
|
|
887
|
+
return create_tmpvar
|
|
879
888
|
when rhs_var != rhs_obj
|
|
880
889
|
notify_implicit_conv_performed(node.rhs_operand, rhs_obj, rhs_var)
|
|
881
890
|
end
|
|
@@ -897,19 +906,19 @@ module C #:nodoc:
|
|
|
897
906
|
when "+"
|
|
898
907
|
# NOTE: Domain of the arithmetic result value will be restricted by
|
|
899
908
|
# min-max of the variable type.
|
|
900
|
-
|
|
909
|
+
res_var = create_tmpvar(lhs_conved.type, lhs_val + rhs_val)
|
|
901
910
|
when "-"
|
|
902
911
|
# NOTE: Domain of the arithmetic result value will be restricted by
|
|
903
912
|
# min-max of the variable type.
|
|
904
|
-
|
|
913
|
+
res_var = create_tmpvar(lhs_conved.type, lhs_val - rhs_val)
|
|
905
914
|
else
|
|
906
915
|
__NOTREACHED__
|
|
907
916
|
end
|
|
908
917
|
_notify_variable_value_referred(node, lhs_var)
|
|
909
918
|
_notify_variable_value_referred(node, rhs_var)
|
|
910
919
|
|
|
911
|
-
notify_additive_expr_evaled(node, lhs_var, rhs_var,
|
|
912
|
-
|
|
920
|
+
notify_additive_expr_evaled(node, lhs_var, rhs_var, res_var)
|
|
921
|
+
res_var
|
|
913
922
|
end
|
|
914
923
|
|
|
915
924
|
def eval_shift_expr(node, lhs_obj, rhs_obj)
|
|
@@ -917,7 +926,7 @@ module C #:nodoc:
|
|
|
917
926
|
case
|
|
918
927
|
when !lhs_var.type.scalar? && !lhs_var.type.void?
|
|
919
928
|
# NOTE: To detect bad value reference of `void' expressions.
|
|
920
|
-
return
|
|
929
|
+
return create_tmpvar
|
|
921
930
|
when lhs_var != lhs_obj
|
|
922
931
|
notify_implicit_conv_performed(node.lhs_operand, lhs_obj, lhs_var)
|
|
923
932
|
end
|
|
@@ -926,7 +935,7 @@ module C #:nodoc:
|
|
|
926
935
|
case
|
|
927
936
|
when !rhs_var.type.scalar? && !rhs_var.type.void?
|
|
928
937
|
# NOTE: To detect bad value reference of `void' expressions.
|
|
929
|
-
return
|
|
938
|
+
return create_tmpvar
|
|
930
939
|
when rhs_var != rhs_obj
|
|
931
940
|
notify_implicit_conv_performed(node.rhs_operand, rhs_obj, rhs_var)
|
|
932
941
|
end
|
|
@@ -958,19 +967,19 @@ module C #:nodoc:
|
|
|
958
967
|
when "<<"
|
|
959
968
|
# NOTE: Domain of the arithmetic result value will be restricted by
|
|
960
969
|
# min-max of the variable type.
|
|
961
|
-
|
|
970
|
+
res_var = create_tmpvar(lhs_conved.type, lhs_val << rhs_val)
|
|
962
971
|
when ">>"
|
|
963
972
|
# NOTE: Domain of the arithmetic result value will be restricted by
|
|
964
973
|
# min-max of the variable type.
|
|
965
|
-
|
|
974
|
+
res_var = create_tmpvar(lhs_conved.type, lhs_val >> rhs_val)
|
|
966
975
|
else
|
|
967
976
|
__NOTREACHED__
|
|
968
977
|
end
|
|
969
978
|
_notify_variable_value_referred(node, lhs_var)
|
|
970
979
|
_notify_variable_value_referred(node, rhs_var)
|
|
971
980
|
|
|
972
|
-
notify_shift_expr_evaled(node, lhs_var, rhs_var,
|
|
973
|
-
|
|
981
|
+
notify_shift_expr_evaled(node, lhs_var, rhs_var, res_var)
|
|
982
|
+
res_var
|
|
974
983
|
end
|
|
975
984
|
|
|
976
985
|
def eval_relational_expr(node, lhs_obj, rhs_obj)
|
|
@@ -978,7 +987,7 @@ module C #:nodoc:
|
|
|
978
987
|
case
|
|
979
988
|
when !lhs_var.type.scalar? && !lhs_var.type.void?
|
|
980
989
|
# NOTE: To detect bad value reference of `void' expressions.
|
|
981
|
-
return
|
|
990
|
+
return create_tmpvar(int_t, scalar_value_of_arbitrary)
|
|
982
991
|
when lhs_var != lhs_obj
|
|
983
992
|
notify_implicit_conv_performed(node.lhs_operand, lhs_obj, lhs_var)
|
|
984
993
|
end
|
|
@@ -987,7 +996,7 @@ module C #:nodoc:
|
|
|
987
996
|
case
|
|
988
997
|
when !rhs_var.type.scalar? && !rhs_var.type.void?
|
|
989
998
|
# NOTE: To detect bad value reference of `void' expressions.
|
|
990
|
-
return
|
|
999
|
+
return create_tmpvar(int_t, scalar_value_of_arbitrary)
|
|
991
1000
|
when rhs_var != rhs_obj
|
|
992
1001
|
notify_implicit_conv_performed(node.rhs_operand, rhs_obj, rhs_var)
|
|
993
1002
|
end
|
|
@@ -1007,21 +1016,21 @@ module C #:nodoc:
|
|
|
1007
1016
|
|
|
1008
1017
|
case node.operator.type
|
|
1009
1018
|
when "<"
|
|
1010
|
-
|
|
1019
|
+
res_var = create_tmpvar(int_t, lhs_val < rhs_val)
|
|
1011
1020
|
when ">"
|
|
1012
|
-
|
|
1021
|
+
res_var = create_tmpvar(int_t, lhs_val > rhs_val)
|
|
1013
1022
|
when "<="
|
|
1014
|
-
|
|
1023
|
+
res_var = create_tmpvar(int_t, lhs_val <= rhs_val)
|
|
1015
1024
|
when ">="
|
|
1016
|
-
|
|
1025
|
+
res_var = create_tmpvar(int_t, lhs_val >= rhs_val)
|
|
1017
1026
|
else
|
|
1018
1027
|
__NOTREACHED__
|
|
1019
1028
|
end
|
|
1020
1029
|
_notify_variable_value_referred(node, lhs_var)
|
|
1021
1030
|
_notify_variable_value_referred(node, rhs_var)
|
|
1022
1031
|
|
|
1023
|
-
notify_relational_expr_evaled(node, lhs_var, rhs_var,
|
|
1024
|
-
|
|
1032
|
+
notify_relational_expr_evaled(node, lhs_var, rhs_var, res_var)
|
|
1033
|
+
res_var
|
|
1025
1034
|
end
|
|
1026
1035
|
|
|
1027
1036
|
def eval_equality_expr(node, lhs_obj, rhs_obj)
|
|
@@ -1029,7 +1038,7 @@ module C #:nodoc:
|
|
|
1029
1038
|
case
|
|
1030
1039
|
when !lhs_var.type.scalar? && !lhs_var.type.void?
|
|
1031
1040
|
# NOTE: To detect bad value reference of `void' expressions.
|
|
1032
|
-
return
|
|
1041
|
+
return create_tmpvar(int_t, scalar_value_of_arbitrary)
|
|
1033
1042
|
when lhs_var != lhs_obj
|
|
1034
1043
|
notify_implicit_conv_performed(node.lhs_operand, lhs_obj, lhs_var)
|
|
1035
1044
|
end
|
|
@@ -1038,7 +1047,7 @@ module C #:nodoc:
|
|
|
1038
1047
|
case
|
|
1039
1048
|
when !rhs_var.type.scalar? && !rhs_var.type.void?
|
|
1040
1049
|
# NOTE: To detect bad value reference of `void' expressions.
|
|
1041
|
-
return
|
|
1050
|
+
return create_tmpvar(int_t, scalar_value_of_arbitrary)
|
|
1042
1051
|
when rhs_var != rhs_obj
|
|
1043
1052
|
notify_implicit_conv_performed(node.rhs_operand, rhs_obj, rhs_var)
|
|
1044
1053
|
end
|
|
@@ -1058,17 +1067,17 @@ module C #:nodoc:
|
|
|
1058
1067
|
|
|
1059
1068
|
case node.operator.type
|
|
1060
1069
|
when "=="
|
|
1061
|
-
|
|
1070
|
+
res_var = create_tmpvar(int_t, lhs_val == rhs_val)
|
|
1062
1071
|
when "!="
|
|
1063
|
-
|
|
1072
|
+
res_var = create_tmpvar(int_t, lhs_val != rhs_val)
|
|
1064
1073
|
else
|
|
1065
1074
|
__NOTREACHED__
|
|
1066
1075
|
end
|
|
1067
1076
|
_notify_variable_value_referred(node, lhs_var)
|
|
1068
1077
|
_notify_variable_value_referred(node, rhs_var)
|
|
1069
1078
|
|
|
1070
|
-
notify_equality_expr_evaled(node, lhs_var, rhs_var,
|
|
1071
|
-
|
|
1079
|
+
notify_equality_expr_evaled(node, lhs_var, rhs_var, res_var)
|
|
1080
|
+
res_var
|
|
1072
1081
|
end
|
|
1073
1082
|
|
|
1074
1083
|
def eval_and_expr(node, lhs_obj, rhs_obj)
|
|
@@ -1076,7 +1085,7 @@ module C #:nodoc:
|
|
|
1076
1085
|
case
|
|
1077
1086
|
when !lhs_var.type.scalar? && !lhs_var.type.void?
|
|
1078
1087
|
# NOTE: To detect bad value reference of `void' expressions.
|
|
1079
|
-
return
|
|
1088
|
+
return create_tmpvar
|
|
1080
1089
|
when lhs_var != lhs_obj
|
|
1081
1090
|
notify_implicit_conv_performed(node.lhs_operand, lhs_obj, lhs_var)
|
|
1082
1091
|
end
|
|
@@ -1085,7 +1094,7 @@ module C #:nodoc:
|
|
|
1085
1094
|
case
|
|
1086
1095
|
when !rhs_var.type.scalar? && !rhs_var.type.void?
|
|
1087
1096
|
# NOTE: To detect bad value reference of `void' expressions.
|
|
1088
|
-
return
|
|
1097
|
+
return create_tmpvar
|
|
1089
1098
|
when rhs_var != rhs_obj
|
|
1090
1099
|
notify_implicit_conv_performed(node.rhs_operand, rhs_obj, rhs_var)
|
|
1091
1100
|
end
|
|
@@ -1105,12 +1114,12 @@ module C #:nodoc:
|
|
|
1105
1114
|
|
|
1106
1115
|
# NOTE: Domain of the arithmetic result value will be restricted by
|
|
1107
1116
|
# min-max of the variable type.
|
|
1108
|
-
|
|
1117
|
+
res_var = create_tmpvar(lhs_conved.type, lhs_val & rhs_val)
|
|
1109
1118
|
_notify_variable_value_referred(node, lhs_var)
|
|
1110
1119
|
_notify_variable_value_referred(node, rhs_var)
|
|
1111
1120
|
|
|
1112
|
-
notify_and_expr_evaled(node, lhs_var, rhs_var,
|
|
1113
|
-
|
|
1121
|
+
notify_and_expr_evaled(node, lhs_var, rhs_var, res_var)
|
|
1122
|
+
res_var
|
|
1114
1123
|
end
|
|
1115
1124
|
|
|
1116
1125
|
def eval_exclusive_or_expr(node, lhs_obj, rhs_obj)
|
|
@@ -1118,7 +1127,7 @@ module C #:nodoc:
|
|
|
1118
1127
|
case
|
|
1119
1128
|
when !lhs_var.type.scalar? && !lhs_var.type.void?
|
|
1120
1129
|
# NOTE: To detect bad value reference of `void' expressions.
|
|
1121
|
-
return
|
|
1130
|
+
return create_tmpvar
|
|
1122
1131
|
when lhs_var != lhs_obj
|
|
1123
1132
|
notify_implicit_conv_performed(node.lhs_operand, lhs_obj, lhs_var)
|
|
1124
1133
|
end
|
|
@@ -1127,7 +1136,7 @@ module C #:nodoc:
|
|
|
1127
1136
|
case
|
|
1128
1137
|
when !rhs_var.type.scalar? && !rhs_var.type.void?
|
|
1129
1138
|
# NOTE: To detect bad value reference of `void' expressions.
|
|
1130
|
-
return
|
|
1139
|
+
return create_tmpvar
|
|
1131
1140
|
when rhs_var != rhs_obj
|
|
1132
1141
|
notify_implicit_conv_performed(node.rhs_operand, rhs_obj, rhs_var)
|
|
1133
1142
|
end
|
|
@@ -1147,12 +1156,12 @@ module C #:nodoc:
|
|
|
1147
1156
|
|
|
1148
1157
|
# NOTE: Domain of the arithmetic result value will be restricted by
|
|
1149
1158
|
# min-max of the variable type.
|
|
1150
|
-
|
|
1159
|
+
res_var = create_tmpvar(lhs_conved.type, lhs_val ^ rhs_val)
|
|
1151
1160
|
_notify_variable_value_referred(node, lhs_var)
|
|
1152
1161
|
_notify_variable_value_referred(node, rhs_var)
|
|
1153
1162
|
|
|
1154
|
-
notify_exclusive_or_expr_evaled(node, lhs_var, rhs_var,
|
|
1155
|
-
|
|
1163
|
+
notify_exclusive_or_expr_evaled(node, lhs_var, rhs_var, res_var)
|
|
1164
|
+
res_var
|
|
1156
1165
|
end
|
|
1157
1166
|
|
|
1158
1167
|
def eval_inclusive_or_expr(node, lhs_obj, rhs_obj)
|
|
@@ -1160,7 +1169,7 @@ module C #:nodoc:
|
|
|
1160
1169
|
case
|
|
1161
1170
|
when !lhs_var.type.scalar? && !lhs_var.type.void?
|
|
1162
1171
|
# NOTE: To detect bad value reference of `void' expressions.
|
|
1163
|
-
return
|
|
1172
|
+
return create_tmpvar
|
|
1164
1173
|
when lhs_var != lhs_obj
|
|
1165
1174
|
notify_implicit_conv_performed(node.lhs_operand, lhs_obj, lhs_var)
|
|
1166
1175
|
end
|
|
@@ -1169,7 +1178,7 @@ module C #:nodoc:
|
|
|
1169
1178
|
case
|
|
1170
1179
|
when !rhs_var.type.scalar? && !rhs_var.type.void?
|
|
1171
1180
|
# NOTE: To detect bad value reference of `void' expressions.
|
|
1172
|
-
return
|
|
1181
|
+
return create_tmpvar
|
|
1173
1182
|
when rhs_var != rhs_obj
|
|
1174
1183
|
notify_implicit_conv_performed(node.rhs_operand, rhs_obj, rhs_var)
|
|
1175
1184
|
end
|
|
@@ -1189,12 +1198,12 @@ module C #:nodoc:
|
|
|
1189
1198
|
|
|
1190
1199
|
# NOTE: Domain of the arithmetic result value will be restricted by
|
|
1191
1200
|
# min-max of the variable type.
|
|
1192
|
-
|
|
1201
|
+
res_var = create_tmpvar(lhs_conved.type, lhs_val | rhs_val)
|
|
1193
1202
|
_notify_variable_value_referred(node, lhs_var)
|
|
1194
1203
|
_notify_variable_value_referred(node, rhs_var)
|
|
1195
1204
|
|
|
1196
|
-
notify_inclusive_or_expr_evaled(node, lhs_var, rhs_var,
|
|
1197
|
-
|
|
1205
|
+
notify_inclusive_or_expr_evaled(node, lhs_var, rhs_var, res_var)
|
|
1206
|
+
res_var
|
|
1198
1207
|
end
|
|
1199
1208
|
|
|
1200
1209
|
def eval_simple_assignment_expr(node, lhs_obj, rhs_obj)
|
|
@@ -1213,7 +1222,7 @@ module C #:nodoc:
|
|
|
1213
1222
|
rhs_conved = rhs_var
|
|
1214
1223
|
else
|
|
1215
1224
|
rhs_conved = do_conversion(rhs_var, lhs_var.type) ||
|
|
1216
|
-
|
|
1225
|
+
create_tmpvar(lhs_var.type)
|
|
1217
1226
|
notify_implicit_conv_performed(node.rhs_operand, rhs_var, rhs_conved)
|
|
1218
1227
|
end
|
|
1219
1228
|
|
|
@@ -1241,7 +1250,7 @@ module C #:nodoc:
|
|
|
1241
1250
|
case
|
|
1242
1251
|
when !rhs_var.type.scalar? && !rhs_var.type.void?
|
|
1243
1252
|
# NOTE: To detect bad value reference of `void' expressions.
|
|
1244
|
-
return
|
|
1253
|
+
return create_tmpvar
|
|
1245
1254
|
when rhs_var != rhs_obj
|
|
1246
1255
|
notify_implicit_conv_performed(node.rhs_operand, rhs_obj, rhs_var)
|
|
1247
1256
|
end
|
|
@@ -1278,7 +1287,7 @@ module C #:nodoc:
|
|
|
1278
1287
|
|
|
1279
1288
|
lhs_val = lhs_conved.value
|
|
1280
1289
|
rhs_val = rhs_conved.value
|
|
1281
|
-
|
|
1290
|
+
res_var = create_tmpvar(lhs_conved.type, lhs_val * rhs_val)
|
|
1282
1291
|
|
|
1283
1292
|
# NOTE: Value of the lhs_var is referred at this point. But value
|
|
1284
1293
|
# reference should not be notified not to confuse sequence-point
|
|
@@ -1286,9 +1295,9 @@ module C #:nodoc:
|
|
|
1286
1295
|
# _notify_variable_value_referred(node, lhs_var)
|
|
1287
1296
|
_notify_variable_value_referred(node, rhs_var)
|
|
1288
1297
|
|
|
1289
|
-
notify_multiplicative_expr_evaled(node, lhs_var, rhs_var,
|
|
1298
|
+
notify_multiplicative_expr_evaled(node, lhs_var, rhs_var, res_var)
|
|
1290
1299
|
|
|
1291
|
-
_do_assign(node, lhs_var,
|
|
1300
|
+
_do_assign(node, lhs_var, res_var)
|
|
1292
1301
|
end
|
|
1293
1302
|
|
|
1294
1303
|
def _do_div_then_assign(node, lhs_var, rhs_var)
|
|
@@ -1297,7 +1306,7 @@ module C #:nodoc:
|
|
|
1297
1306
|
lhs_val = lhs_conved.value
|
|
1298
1307
|
rhs_val = rhs_conved.value
|
|
1299
1308
|
# NOTE: "Div by 0" semantics is implemented in value-value arithmetic.
|
|
1300
|
-
|
|
1309
|
+
res_var = create_tmpvar(lhs_conved.type, lhs_val / rhs_val)
|
|
1301
1310
|
|
|
1302
1311
|
# NOTE: Value of the lhs_var is referred at this point. But value
|
|
1303
1312
|
# reference should not be notified not to confuse sequence-point
|
|
@@ -1305,9 +1314,9 @@ module C #:nodoc:
|
|
|
1305
1314
|
# _notify_variable_value_referred(node, lhs_var)
|
|
1306
1315
|
_notify_variable_value_referred(node, rhs_var)
|
|
1307
1316
|
|
|
1308
|
-
notify_multiplicative_expr_evaled(node, lhs_var, rhs_var,
|
|
1317
|
+
notify_multiplicative_expr_evaled(node, lhs_var, rhs_var, res_var)
|
|
1309
1318
|
|
|
1310
|
-
_do_assign(node, lhs_var,
|
|
1319
|
+
_do_assign(node, lhs_var, res_var)
|
|
1311
1320
|
end
|
|
1312
1321
|
|
|
1313
1322
|
def _do_mod_then_assign(node, lhs_var, rhs_var)
|
|
@@ -1316,7 +1325,7 @@ module C #:nodoc:
|
|
|
1316
1325
|
lhs_val = lhs_conved.value
|
|
1317
1326
|
rhs_val = rhs_conved.value
|
|
1318
1327
|
# NOTE: "Div by 0" semantics is implemented in value-value arithmetic.
|
|
1319
|
-
|
|
1328
|
+
res_var = create_tmpvar(lhs_conved.type, lhs_val % rhs_val)
|
|
1320
1329
|
|
|
1321
1330
|
# NOTE: Value of the lhs_var is referred at this point. But value
|
|
1322
1331
|
# reference should not be notified not to confuse sequence-point
|
|
@@ -1324,9 +1333,9 @@ module C #:nodoc:
|
|
|
1324
1333
|
# _notify_variable_value_referred(node, lhs_var)
|
|
1325
1334
|
_notify_variable_value_referred(node, rhs_var)
|
|
1326
1335
|
|
|
1327
|
-
notify_multiplicative_expr_evaled(node, lhs_var, rhs_var,
|
|
1336
|
+
notify_multiplicative_expr_evaled(node, lhs_var, rhs_var, res_var)
|
|
1328
1337
|
|
|
1329
|
-
_do_assign(node, lhs_var,
|
|
1338
|
+
_do_assign(node, lhs_var, res_var)
|
|
1330
1339
|
end
|
|
1331
1340
|
|
|
1332
1341
|
def _do_add_then_assign(node, lhs_var, rhs_var)
|
|
@@ -1334,7 +1343,7 @@ module C #:nodoc:
|
|
|
1334
1343
|
|
|
1335
1344
|
lhs_val = lhs_conved.value
|
|
1336
1345
|
rhs_val = rhs_conved.value
|
|
1337
|
-
|
|
1346
|
+
res_var = create_tmpvar(lhs_conved.type, lhs_val + rhs_val)
|
|
1338
1347
|
|
|
1339
1348
|
# NOTE: Value of the lhs_var is referred at this point. But value
|
|
1340
1349
|
# reference should not be notified not to confuse sequence-point
|
|
@@ -1342,9 +1351,9 @@ module C #:nodoc:
|
|
|
1342
1351
|
# _notify_variable_value_referred(node, lhs_var)
|
|
1343
1352
|
_notify_variable_value_referred(node, rhs_var)
|
|
1344
1353
|
|
|
1345
|
-
notify_additive_expr_evaled(node, lhs_var, rhs_var,
|
|
1354
|
+
notify_additive_expr_evaled(node, lhs_var, rhs_var, res_var)
|
|
1346
1355
|
|
|
1347
|
-
_do_assign(node, lhs_var,
|
|
1356
|
+
_do_assign(node, lhs_var, res_var)
|
|
1348
1357
|
end
|
|
1349
1358
|
|
|
1350
1359
|
def _do_sub_then_assign(node, lhs_var, rhs_var)
|
|
@@ -1352,7 +1361,7 @@ module C #:nodoc:
|
|
|
1352
1361
|
|
|
1353
1362
|
lhs_val = lhs_conved.value
|
|
1354
1363
|
rhs_val = rhs_conved.value
|
|
1355
|
-
|
|
1364
|
+
res_var = create_tmpvar(lhs_conved.type, lhs_val - rhs_val)
|
|
1356
1365
|
|
|
1357
1366
|
# NOTE: Value of the lhs_var is referred at this point. But value
|
|
1358
1367
|
# reference should not be notified not to confuse sequence-point
|
|
@@ -1360,9 +1369,9 @@ module C #:nodoc:
|
|
|
1360
1369
|
# _notify_variable_value_referred(node, lhs_var)
|
|
1361
1370
|
_notify_variable_value_referred(node, rhs_var)
|
|
1362
1371
|
|
|
1363
|
-
notify_additive_expr_evaled(node, lhs_var, rhs_var,
|
|
1372
|
+
notify_additive_expr_evaled(node, lhs_var, rhs_var, res_var)
|
|
1364
1373
|
|
|
1365
|
-
_do_assign(node, lhs_var,
|
|
1374
|
+
_do_assign(node, lhs_var, res_var)
|
|
1366
1375
|
end
|
|
1367
1376
|
|
|
1368
1377
|
def _do_shl_then_assign(node, lhs_var, rhs_var)
|
|
@@ -1379,7 +1388,7 @@ module C #:nodoc:
|
|
|
1379
1388
|
|
|
1380
1389
|
lhs_val = lhs_conved.value
|
|
1381
1390
|
rhs_val = rhs_conved.value
|
|
1382
|
-
|
|
1391
|
+
res_var = create_tmpvar(lhs_conved.type, lhs_val << rhs_val)
|
|
1383
1392
|
|
|
1384
1393
|
# NOTE: Value of the lhs_var is referred at this point. But value
|
|
1385
1394
|
# reference should not be notified not to confuse sequence-point
|
|
@@ -1387,9 +1396,9 @@ module C #:nodoc:
|
|
|
1387
1396
|
# _notify_variable_value_referred(node, lhs_var)
|
|
1388
1397
|
_notify_variable_value_referred(node, rhs_var)
|
|
1389
1398
|
|
|
1390
|
-
notify_shift_expr_evaled(node, lhs_var, rhs_var,
|
|
1399
|
+
notify_shift_expr_evaled(node, lhs_var, rhs_var, res_var)
|
|
1391
1400
|
|
|
1392
|
-
_do_assign(node, lhs_var,
|
|
1401
|
+
_do_assign(node, lhs_var, res_var)
|
|
1393
1402
|
end
|
|
1394
1403
|
|
|
1395
1404
|
def _do_shr_then_assign(node, lhs_var, rhs_var)
|
|
@@ -1406,7 +1415,7 @@ module C #:nodoc:
|
|
|
1406
1415
|
|
|
1407
1416
|
lhs_val = lhs_conved.value
|
|
1408
1417
|
rhs_val = rhs_conved.value
|
|
1409
|
-
|
|
1418
|
+
res_var = create_tmpvar(lhs_conved.type, lhs_val >> rhs_val)
|
|
1410
1419
|
|
|
1411
1420
|
# NOTE: Value of the lhs_var is referred at this point. But value
|
|
1412
1421
|
# reference should not be notified not to confuse sequence-point
|
|
@@ -1414,9 +1423,9 @@ module C #:nodoc:
|
|
|
1414
1423
|
# _notify_variable_value_referred(node, lhs_var)
|
|
1415
1424
|
_notify_variable_value_referred(node, rhs_var)
|
|
1416
1425
|
|
|
1417
|
-
notify_shift_expr_evaled(node, lhs_var, rhs_var,
|
|
1426
|
+
notify_shift_expr_evaled(node, lhs_var, rhs_var, res_var)
|
|
1418
1427
|
|
|
1419
|
-
_do_assign(node, lhs_var,
|
|
1428
|
+
_do_assign(node, lhs_var, res_var)
|
|
1420
1429
|
end
|
|
1421
1430
|
|
|
1422
1431
|
def _do_and_then_assign(node, lhs_var, rhs_var)
|
|
@@ -1424,7 +1433,7 @@ module C #:nodoc:
|
|
|
1424
1433
|
|
|
1425
1434
|
lhs_val = lhs_conved.value
|
|
1426
1435
|
rhs_val = rhs_conved.value
|
|
1427
|
-
|
|
1436
|
+
res_var = create_tmpvar(lhs_conved.type, lhs_val & rhs_val)
|
|
1428
1437
|
|
|
1429
1438
|
# NOTE: Value of the lhs_var is referred at this point. But value
|
|
1430
1439
|
# reference should not be notified not to confuse sequence-point
|
|
@@ -1432,9 +1441,9 @@ module C #:nodoc:
|
|
|
1432
1441
|
# _notify_variable_value_referred(node, lhs_var)
|
|
1433
1442
|
_notify_variable_value_referred(node, rhs_var)
|
|
1434
1443
|
|
|
1435
|
-
notify_and_expr_evaled(node, lhs_var, rhs_var,
|
|
1444
|
+
notify_and_expr_evaled(node, lhs_var, rhs_var, res_var)
|
|
1436
1445
|
|
|
1437
|
-
_do_assign(node, lhs_var,
|
|
1446
|
+
_do_assign(node, lhs_var, res_var)
|
|
1438
1447
|
end
|
|
1439
1448
|
|
|
1440
1449
|
def _do_xor_then_assign(node, lhs_var, rhs_var)
|
|
@@ -1442,7 +1451,7 @@ module C #:nodoc:
|
|
|
1442
1451
|
|
|
1443
1452
|
lhs_val = lhs_conved.value
|
|
1444
1453
|
rhs_val = rhs_conved.value
|
|
1445
|
-
|
|
1454
|
+
res_var = create_tmpvar(lhs_conved.type, lhs_val ^ rhs_val)
|
|
1446
1455
|
|
|
1447
1456
|
# NOTE: Value of the lhs_var is referred at this point. But value
|
|
1448
1457
|
# reference should not be notified not to confuse sequence-point
|
|
@@ -1450,9 +1459,9 @@ module C #:nodoc:
|
|
|
1450
1459
|
# _notify_variable_value_referred(node, lhs_var)
|
|
1451
1460
|
_notify_variable_value_referred(node, rhs_var)
|
|
1452
1461
|
|
|
1453
|
-
notify_exclusive_or_expr_evaled(node, lhs_var, rhs_var,
|
|
1462
|
+
notify_exclusive_or_expr_evaled(node, lhs_var, rhs_var, res_var)
|
|
1454
1463
|
|
|
1455
|
-
_do_assign(node, lhs_var,
|
|
1464
|
+
_do_assign(node, lhs_var, res_var)
|
|
1456
1465
|
end
|
|
1457
1466
|
|
|
1458
1467
|
def _do_ior_then_assign(node, lhs_var, rhs_var)
|
|
@@ -1460,7 +1469,7 @@ module C #:nodoc:
|
|
|
1460
1469
|
|
|
1461
1470
|
lhs_val = lhs_conved.value
|
|
1462
1471
|
rhs_val = rhs_conved.value
|
|
1463
|
-
|
|
1472
|
+
res_var = create_tmpvar(lhs_conved.type, lhs_val | rhs_val)
|
|
1464
1473
|
|
|
1465
1474
|
# NOTE: Value of the lhs_var is referred at this point. But value
|
|
1466
1475
|
# reference should not be notified not to confuse sequence-point
|
|
@@ -1468,9 +1477,9 @@ module C #:nodoc:
|
|
|
1468
1477
|
# _notify_variable_value_referred(node, lhs_var)
|
|
1469
1478
|
_notify_variable_value_referred(node, rhs_var)
|
|
1470
1479
|
|
|
1471
|
-
notify_inclusive_or_expr_evaled(node, lhs_var, rhs_var,
|
|
1480
|
+
notify_inclusive_or_expr_evaled(node, lhs_var, rhs_var, res_var)
|
|
1472
1481
|
|
|
1473
|
-
_do_assign(node, lhs_var,
|
|
1482
|
+
_do_assign(node, lhs_var, res_var)
|
|
1474
1483
|
end
|
|
1475
1484
|
|
|
1476
1485
|
def _do_uarith_conversion(node, lhs_var, rhs_var)
|
|
@@ -1501,22 +1510,21 @@ module C #:nodoc:
|
|
|
1501
1510
|
return lhs_conved, rhs_conved
|
|
1502
1511
|
end
|
|
1503
1512
|
|
|
1504
|
-
def _do_assign(node, lhs_var,
|
|
1505
|
-
if
|
|
1506
|
-
|
|
1513
|
+
def _do_assign(node, lhs_var, rhs_var)
|
|
1514
|
+
if rhs_var.type.same_as?(lhs_var.type)
|
|
1515
|
+
rhs_conved = rhs_var
|
|
1507
1516
|
else
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
notify_implicit_conv_performed(node.lhs_operand,
|
|
1511
|
-
result_var, result_conved)
|
|
1517
|
+
rhs_conved = do_conversion(rhs_var, lhs_var.type) ||
|
|
1518
|
+
create_tmpvar(lhs_var.type)
|
|
1519
|
+
notify_implicit_conv_performed(node.lhs_operand, rhs_var, rhs_conved)
|
|
1512
1520
|
end
|
|
1513
1521
|
|
|
1514
1522
|
# NOTE: Domain of the arithmetic result value will be restricted by
|
|
1515
1523
|
# min-max of the variable type.
|
|
1516
|
-
lhs_var.assign!(
|
|
1524
|
+
lhs_var.assign!(rhs_conved.value.to_defined_value)
|
|
1517
1525
|
_notify_variable_value_updated(node, lhs_var)
|
|
1518
1526
|
|
|
1519
|
-
notify_assignment_expr_evaled(node, lhs_var,
|
|
1527
|
+
notify_assignment_expr_evaled(node, lhs_var, rhs_conved)
|
|
1520
1528
|
end
|
|
1521
1529
|
|
|
1522
1530
|
def _notify_object_referred(node, obj)
|
|
@@ -1549,6 +1557,12 @@ module C #:nodoc:
|
|
|
1549
1557
|
end
|
|
1550
1558
|
end
|
|
1551
1559
|
end
|
|
1560
|
+
|
|
1561
|
+
def _notify_implicit_function_declared(node, obj)
|
|
1562
|
+
if obj.function? && obj.implicit?
|
|
1563
|
+
interpreter.notify_implicit_function_declared(node, obj)
|
|
1564
|
+
end
|
|
1565
|
+
end
|
|
1552
1566
|
end
|
|
1553
1567
|
|
|
1554
1568
|
include Impl
|