adlint 3.2.0 → 3.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/AUTHORS +1 -2
- data/ChangeLog +196 -5236
- data/INSTALL +1 -1
- data/MANIFEST +4 -2
- data/NEWS +30 -13
- data/README +2 -2
- data/Rakefile +2 -2
- data/TODO +1 -1
- data/bin/adlint +2 -2
- data/bin/adlint_chk +2 -2
- data/bin/adlint_cma +2 -2
- data/bin/adlint_sma +2 -2
- data/bin/adlintize +2 -2
- data/etc/conf.d/fallback/cinit.erb +1 -1
- data/etc/conf.d/fallback/traits.erb +1 -1
- data/etc/conf.d/i686-cygwin/cinit-gcc_4.3.4.erb +1 -1
- data/etc/conf.d/i686-cygwin/traits-gcc_4.3.4.erb +1 -1
- data/etc/conf.d/i686-devkit/cinit-gcc_4.5.2.erb +1 -1
- data/etc/conf.d/i686-devkit/traits-gcc_4.5.2.erb +1 -1
- data/etc/conf.d/i686-linux/cinit-gcc_4.5.1.erb +1 -1
- data/etc/conf.d/i686-linux/traits-gcc_4.5.1.erb +1 -1
- data/etc/conf.d/i686-mingw/cinit-gcc_4.6.1.erb +1 -1
- data/etc/conf.d/i686-mingw/traits-gcc_4.6.1.erb +1 -1
- data/etc/conf.d/noarch/GNUmakefile.erb +1 -1
- data/etc/conf.d/noarch/adlint_all_bat.erb +1 -1
- data/etc/conf.d/noarch/adlint_all_sh.erb +1 -1
- data/etc/conf.d/noarch/pinit.erb +1 -1
- data/etc/conf.d/x86_64-centos_6.4/cinit-gcc_4.4.7.erb +150 -0
- data/etc/conf.d/x86_64-centos_6.4/traits-gcc_4.4.7.erb +290 -0
- data/etc/conf.d/x86_64-ubuntu_12.04/cinit-gcc_4.6.3.erb +1 -1
- data/etc/conf.d/x86_64-ubuntu_12.04/traits-gcc_4.6.3.erb +1 -1
- data/etc/mesg.d/c_builtin/en_US/messages.yml +2 -2
- data/etc/mesg.d/c_builtin/ja_JP/messages.yml +3 -3
- data/etc/mesg.d/core/en_US/messages.yml +6 -2
- data/etc/mesg.d/core/ja_JP/messages.yml +6 -2
- data/features/code_check/E0008.feature +122 -0
- data/features/code_check/E0016.feature +49 -0
- data/features/code_check/E0018.feature +99 -0
- data/features/code_check/W0460.feature +8 -8
- data/lib/adlint.rb +2 -2
- data/lib/adlint/analyzer.rb +2 -2
- data/lib/adlint/annot.rb +2 -2
- data/lib/adlint/cc1.rb +2 -2
- data/lib/adlint/cc1/branch.rb +2 -2
- data/lib/adlint/cc1/builtin.rb +2 -2
- data/lib/adlint/cc1/const.rb +2 -2
- data/lib/adlint/cc1/conv.rb +2 -2
- data/lib/adlint/cc1/ctrlexpr.rb +2 -2
- data/lib/adlint/cc1/domain.rb +2 -2
- data/lib/adlint/cc1/enum.rb +2 -2
- data/lib/adlint/cc1/environ.rb +2 -2
- data/lib/adlint/cc1/expr.rb +110 -48
- data/lib/adlint/cc1/format.rb +2 -2
- data/lib/adlint/cc1/interp.rb +46 -12
- data/lib/adlint/cc1/lexer.rb +44 -11
- data/lib/adlint/cc1/mediator.rb +16 -2
- data/lib/adlint/cc1/object.rb +2 -2
- data/lib/adlint/cc1/operator.rb +2 -2
- data/lib/adlint/cc1/option.rb +3 -3
- data/lib/adlint/cc1/parser.rb +1011 -999
- data/lib/adlint/cc1/parser.y +20 -11
- data/lib/adlint/cc1/phase.rb +2 -2
- data/lib/adlint/cc1/resolver.rb +2 -2
- data/lib/adlint/cc1/scanner.rb +2 -2
- data/lib/adlint/cc1/scope.rb +2 -2
- data/lib/adlint/cc1/seqp.rb +2 -2
- data/lib/adlint/cc1/syntax.rb +42 -10
- data/lib/adlint/cc1/trace.rb +2 -2
- data/lib/adlint/cc1/type.rb +72 -2
- data/lib/adlint/cc1/util.rb +2 -2
- data/lib/adlint/cc1/value.rb +9 -3
- data/lib/adlint/code.rb +2 -2
- data/lib/adlint/cpp.rb +2 -2
- data/lib/adlint/cpp/asm.rb +2 -2
- data/lib/adlint/cpp/constexpr.rb +1 -1
- data/lib/adlint/cpp/constexpr.y +2 -2
- data/lib/adlint/cpp/eval.rb +2 -2
- data/lib/adlint/cpp/lexer.rb +13 -3
- data/lib/adlint/cpp/macro.rb +2 -2
- data/lib/adlint/cpp/phase.rb +2 -2
- data/lib/adlint/cpp/scanner.rb +2 -2
- data/lib/adlint/cpp/source.rb +2 -2
- data/lib/adlint/cpp/subst.rb +6 -2
- data/lib/adlint/cpp/syntax.rb +2 -2
- data/lib/adlint/cpp/util.rb +2 -2
- data/lib/adlint/driver.rb +2 -2
- data/lib/adlint/error.rb +2 -2
- data/lib/adlint/exam.rb +20 -8
- data/lib/adlint/exam/c_builtin.rb +4 -6
- data/lib/adlint/exam/c_builtin/cc1_check.rb +1380 -461
- data/lib/adlint/exam/c_builtin/cc1_code.rb +25 -25
- data/lib/adlint/exam/c_builtin/cc1_metric.rb +180 -209
- data/lib/adlint/exam/c_builtin/cpp_check.rb +211 -50
- data/lib/adlint/exam/c_builtin/cpp_code.rb +19 -19
- data/lib/adlint/exam/c_builtin/ld_check.rb +2 -2
- data/lib/adlint/exam/c_builtin/ld_metric.rb +2 -2
- data/lib/adlint/lang.rb +2 -2
- data/lib/adlint/ld.rb +2 -2
- data/lib/adlint/ld/object.rb +3 -3
- data/lib/adlint/ld/phase.rb +2 -2
- data/lib/adlint/ld/typedef.rb +2 -2
- data/lib/adlint/ld/util.rb +2 -2
- data/lib/adlint/lexer.rb +2 -2
- data/lib/adlint/location.rb +2 -2
- data/lib/adlint/memo.rb +2 -2
- data/lib/adlint/message.rb +2 -2
- data/lib/adlint/metric.rb +2 -2
- data/lib/adlint/monitor.rb +2 -2
- data/lib/adlint/phase.rb +2 -2
- data/lib/adlint/prelude.rb +2 -2
- data/lib/adlint/report.rb +4 -4
- data/lib/adlint/source.rb +2 -2
- data/lib/adlint/supp.rb +2 -2
- data/lib/adlint/symbol.rb +2 -2
- data/lib/adlint/token.rb +2 -2
- data/lib/adlint/traits.rb +2 -2
- data/lib/adlint/util.rb +2 -2
- data/lib/adlint/version.rb +6 -6
- data/share/HEADER +2 -2
- data/share/doc/developers_guide_ja.html +20 -9
- data/share/doc/developers_guide_ja.texi +18 -7
- data/share/doc/samples/GNUmakefile +1 -1
- data/share/doc/samples/adlint_traits.yml +1 -1
- data/share/doc/users_guide_en.html +6177 -6138
- data/share/doc/users_guide_en.texi +35 -5
- data/share/doc/users_guide_ja.html +6192 -6153
- data/share/doc/users_guide_ja.texi +35 -5
- data/share/sample/bison-2.5/adlint/GNUmakefile +1 -1
- data/share/sample/bison-2.5/adlint/adlint_traits.yml +1 -1
- data/share/sample/bison-2.5/adlint/lib/GNUmakefile +1 -1
- data/share/sample/bison-2.5/adlint/lib/adlint_cinit.h +1 -1
- data/share/sample/bison-2.5/adlint/lib/adlint_pinit.h +1 -1
- data/share/sample/bison-2.5/adlint/lib/adlint_traits.yml +1 -1
- data/share/sample/bison-2.5/adlint/src/GNUmakefile +1 -1
- data/share/sample/bison-2.5/adlint/src/adlint_cinit.h +1 -1
- data/share/sample/bison-2.5/adlint/src/adlint_pinit.h +1 -1
- data/share/sample/bison-2.5/adlint/src/adlint_traits.yml +1 -1
- data/share/sample/ctags-5.8/adlint/GNUmakefile +1 -1
- data/share/sample/ctags-5.8/adlint/adlint_cinit.h +1 -1
- data/share/sample/ctags-5.8/adlint/adlint_pinit.h +1 -1
- data/share/sample/ctags-5.8/adlint/adlint_traits.yml +1 -1
- data/share/sample/flex-2.5.35/adlint/GNUmakefile +1 -1
- data/share/sample/flex-2.5.35/adlint/adlint_cinit.h +1 -1
- data/share/sample/flex-2.5.35/adlint/adlint_pinit.h +1 -1
- data/share/sample/flex-2.5.35/adlint/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/core/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-date/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_traits.yml +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_traits.yml +1 -1
- data/share/sample/screen-4.0.3/adlint/GNUmakefile +1 -1
- data/share/sample/screen-4.0.3/adlint/adlint_cinit.h +1 -1
- data/share/sample/screen-4.0.3/adlint/adlint_pinit.h +1 -1
- data/share/sample/screen-4.0.3/adlint/adlint_traits.yml +1 -1
- data/share/sample/vim-7.3/adlint/vim/GNUmakefile +1 -1
- data/share/sample/vim-7.3/adlint/vim/adlint_cinit.h +1 -1
- data/share/sample/vim-7.3/adlint/vim/adlint_pinit.h +1 -1
- data/share/sample/vim-7.3/adlint/vim/adlint_traits.yml +1 -1
- data/share/sample/vim-7.3/adlint/xxd/GNUmakefile +1 -1
- data/share/sample/vim-7.3/adlint/xxd/adlint_cinit.h +1 -1
- data/share/sample/vim-7.3/adlint/xxd/adlint_pinit.h +1 -1
- data/share/sample/vim-7.3/adlint/xxd/adlint_traits.yml +1 -1
- data/share/sample/zsh-4.3.15/adlint/GNUmakefile +1 -1
- data/share/sample/zsh-4.3.15/adlint/adlint_traits.yml +1 -1
- data/share/sample/zsh-4.3.15/adlint/builtins/GNUmakefile +1 -1
- data/share/sample/zsh-4.3.15/adlint/builtins/adlint_cinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/builtins/adlint_pinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/builtins/adlint_traits.yml +1 -1
- data/share/sample/zsh-4.3.15/adlint/core/GNUmakefile +1 -1
- data/share/sample/zsh-4.3.15/adlint/core/adlint_cinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/core/adlint_pinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/core/adlint_traits.yml +1 -1
- data/share/sample/zsh-4.3.15/adlint/modules/GNUmakefile +1 -1
- data/share/sample/zsh-4.3.15/adlint/modules/adlint_cinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/modules/adlint_pinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/modules/adlint_traits.yml +1 -1
- data/share/sample/zsh-4.3.15/adlint/zle/GNUmakefile +1 -1
- data/share/sample/zsh-4.3.15/adlint/zle/adlint_cinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/zle/adlint_pinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/zle/adlint_traits.yml +1 -1
- data/spec/adlint/cc1/ctrlexpr_spec.rb +3 -3
- data/spec/adlint/cc1/domain_spec.rb +2 -2
- data/spec/adlint/cc1/operator_spec.rb +2 -2
- data/spec/adlint/cc1/syntax_spec.rb +4 -4
- data/spec/adlint/cc1/type_spec.rb +2 -2
- data/spec/adlint/location_spec.rb +2 -2
- data/spec/conf.d/default_traits.yml +1 -1
- data/spec/conf.d/empty_cinit.h +1 -1
- data/spec/conf.d/empty_pinit.h +1 -1
- data/spec/spec_helper.rb +2 -2
- metadata +29 -28
- data/lib/adlint/exam/c_builtin/cc1_check_shima.rb +0 -963
- data/lib/adlint/exam/c_builtin/cpp_check_shima.rb +0 -204
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# adlint-exam-c_builtin examination package loader.
|
|
2
2
|
#
|
|
3
3
|
# Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
|
4
|
-
# Copyright:: Copyright (C) 2010-
|
|
4
|
+
# Copyright:: Copyright (C) 2010-2014, OGIS-RI Co.,Ltd.
|
|
5
5
|
# License:: GPLv3+: GNU General Public License version 3 or later
|
|
6
6
|
#
|
|
7
7
|
# Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
# / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
|
|
12
12
|
# / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
|
|
13
13
|
# / __ |/ /_/ / /___/ / /| / / /
|
|
14
|
-
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-
|
|
14
|
+
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2014, OGIS-RI Co.,Ltd.
|
|
15
15
|
#
|
|
16
16
|
# This file is part of AdLint.
|
|
17
17
|
#
|
|
@@ -33,11 +33,9 @@ require "adlint"
|
|
|
33
33
|
|
|
34
34
|
require "adlint/exam/c_builtin/cc1_code"
|
|
35
35
|
require "adlint/exam/c_builtin/cc1_check"
|
|
36
|
-
require "adlint/exam/c_builtin/cc1_check_shima"
|
|
37
36
|
require "adlint/exam/c_builtin/cc1_metric"
|
|
38
37
|
require "adlint/exam/c_builtin/cpp_code"
|
|
39
38
|
require "adlint/exam/c_builtin/cpp_check"
|
|
40
|
-
require "adlint/exam/c_builtin/cpp_check_shima"
|
|
41
39
|
require "adlint/exam/c_builtin/ld_check"
|
|
42
40
|
require "adlint/exam/c_builtin/ld_metric"
|
|
43
41
|
|
|
@@ -790,8 +788,8 @@ module CBuiltin #:nodoc:
|
|
|
790
788
|
FN_CYCM,
|
|
791
789
|
FN_CALL,
|
|
792
790
|
|
|
793
|
-
|
|
794
|
-
|
|
791
|
+
TypeDclExtraction,
|
|
792
|
+
GVarDclExtraction,
|
|
795
793
|
FunDclExtraction,
|
|
796
794
|
VarDefExtraction,
|
|
797
795
|
FunDefExtraction,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Code checkings (cc1-phase) of adlint-exam-c_builtin package.
|
|
2
2
|
#
|
|
3
3
|
# Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
|
4
|
-
# Copyright:: Copyright (C) 2010-
|
|
4
|
+
# Copyright:: Copyright (C) 2010-2014, OGIS-RI Co.,Ltd.
|
|
5
5
|
# License:: GPLv3+: GNU General Public License version 3 or later
|
|
6
6
|
#
|
|
7
7
|
# Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
# / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
|
|
12
12
|
# / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
|
|
13
13
|
# / __ |/ /_/ / /___/ / /| / / /
|
|
14
|
-
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-
|
|
14
|
+
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2014, OGIS-RI Co.,Ltd.
|
|
15
15
|
#
|
|
16
16
|
# This file is part of AdLint.
|
|
17
17
|
#
|
|
@@ -56,9 +56,9 @@ module CBuiltin #:nodoc:
|
|
|
56
56
|
|
|
57
57
|
def initialize(phase_ctxt)
|
|
58
58
|
super
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
60
|
+
trav.enter_grouped_expression += T(:enter_grouped_expression)
|
|
61
|
+
trav.leave_grouped_expression += T(:leave_grouped_expression)
|
|
62
62
|
@group_depth = 0
|
|
63
63
|
end
|
|
64
64
|
|
|
@@ -82,8 +82,8 @@ module CBuiltin #:nodoc:
|
|
|
82
82
|
|
|
83
83
|
def initialize(phase_ctxt)
|
|
84
84
|
super
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
86
|
+
trav.enter_kandr_function_definition += T(:check)
|
|
87
87
|
end
|
|
88
88
|
|
|
89
89
|
private
|
|
@@ -101,8 +101,8 @@ module CBuiltin #:nodoc:
|
|
|
101
101
|
|
|
102
102
|
def initialize(phase_ctxt)
|
|
103
103
|
super
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
105
|
+
trav.enter_switch_statement += T(:check)
|
|
106
106
|
end
|
|
107
107
|
|
|
108
108
|
private
|
|
@@ -138,8 +138,8 @@ module CBuiltin #:nodoc:
|
|
|
138
138
|
|
|
139
139
|
def initialize(phase_ctxt)
|
|
140
140
|
super
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
142
|
+
trav.enter_switch_statement += T(:enter_switch_statement)
|
|
143
143
|
end
|
|
144
144
|
|
|
145
145
|
private
|
|
@@ -199,8 +199,8 @@ module CBuiltin #:nodoc:
|
|
|
199
199
|
|
|
200
200
|
def initialize(phase_ctxt)
|
|
201
201
|
super
|
|
202
|
-
|
|
203
|
-
|
|
202
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
203
|
+
trav.enter_conditional_expression += T(:check)
|
|
204
204
|
end
|
|
205
205
|
|
|
206
206
|
private
|
|
@@ -221,8 +221,8 @@ module CBuiltin #:nodoc:
|
|
|
221
221
|
|
|
222
222
|
def initialize(phase_ctxt)
|
|
223
223
|
super
|
|
224
|
-
|
|
225
|
-
|
|
224
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
225
|
+
trav.enter_continue_statement += T(:check)
|
|
226
226
|
end
|
|
227
227
|
|
|
228
228
|
private
|
|
@@ -793,17 +793,17 @@ module CBuiltin #:nodoc:
|
|
|
793
793
|
|
|
794
794
|
def initialize(phase_ctxt)
|
|
795
795
|
super
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
796
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
797
|
+
trav.enter_init_declarator += T(:check_init_dcr)
|
|
798
|
+
trav.enter_struct_declarator += T(:check_struct_dcr)
|
|
799
|
+
trav.enter_parameter_declaration += T(:check_parameter_dcl)
|
|
800
|
+
trav.enter_kandr_function_definition += T(:check_kandr_fundef)
|
|
801
|
+
trav.enter_ansi_function_definition += T(:check_ansi_fundef)
|
|
802
|
+
trav.enter_type_name += T(:check_type_name)
|
|
803
803
|
end
|
|
804
804
|
|
|
805
805
|
private
|
|
806
|
-
def
|
|
806
|
+
def check_init_dcr(init_dcr)
|
|
807
807
|
dcr_num = DeclaratorCounter.new.tap { |cnt|
|
|
808
808
|
init_dcr.declarator.accept(cnt)
|
|
809
809
|
}.result
|
|
@@ -811,14 +811,14 @@ module CBuiltin #:nodoc:
|
|
|
811
811
|
W(init_dcr.location) if dcr_num > 12
|
|
812
812
|
end
|
|
813
813
|
|
|
814
|
-
def
|
|
814
|
+
def check_struct_dcr(struct_dcr)
|
|
815
815
|
if dcr = struct_dcr.declarator
|
|
816
816
|
dcr_num = DeclaratorCounter.new.tap { |cnt| dcr.accept(cnt) }.result
|
|
817
817
|
W(struct_dcr.location) if dcr_num > 12
|
|
818
818
|
end
|
|
819
819
|
end
|
|
820
820
|
|
|
821
|
-
def
|
|
821
|
+
def check_parameter_dcl(param_dcl)
|
|
822
822
|
if dcr = param_dcl.declarator
|
|
823
823
|
dcr_num = DeclaratorCounter.new.tap { |cnt| dcr.accept(cnt) }.result
|
|
824
824
|
W(param_dcl.location) if dcr_num > 12
|
|
@@ -921,11 +921,11 @@ module CBuiltin #:nodoc:
|
|
|
921
921
|
|
|
922
922
|
def initialize(phase_ctxt)
|
|
923
923
|
super
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
924
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
925
|
+
trav.enter_struct_specifier += T(:enter_struct_specifier)
|
|
926
|
+
trav.leave_struct_specifier += T(:leave_struct_specifier)
|
|
927
|
+
trav.enter_union_specifier += T(:enter_union_specifier)
|
|
928
|
+
trav.leave_union_specifier += T(:leave_union_specifier)
|
|
929
929
|
@nest_level = 0
|
|
930
930
|
end
|
|
931
931
|
|
|
@@ -958,8 +958,8 @@ module CBuiltin #:nodoc:
|
|
|
958
958
|
|
|
959
959
|
def initialize(phase_ctxt)
|
|
960
960
|
super
|
|
961
|
-
|
|
962
|
-
|
|
961
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
962
|
+
trav.enter_variable_definition += T(:check)
|
|
963
963
|
end
|
|
964
964
|
|
|
965
965
|
private
|
|
@@ -979,12 +979,12 @@ module CBuiltin #:nodoc:
|
|
|
979
979
|
|
|
980
980
|
def initialize(phase_ctxt)
|
|
981
981
|
super
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
982
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
983
|
+
trav.enter_compound_statement += T(:enter_block)
|
|
984
|
+
trav.leave_compound_statement += T(:leave_block)
|
|
985
|
+
trav.enter_variable_definition += T(:add_identifier)
|
|
986
|
+
trav.enter_variable_declaration += T(:add_identifier)
|
|
987
|
+
trav.enter_typedef_declaration += T(:add_identifier)
|
|
988
988
|
@block_stack = [0]
|
|
989
989
|
end
|
|
990
990
|
|
|
@@ -1012,16 +1012,16 @@ module CBuiltin #:nodoc:
|
|
|
1012
1012
|
|
|
1013
1013
|
def initialize(phase_ctxt)
|
|
1014
1014
|
super
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1015
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
1016
|
+
trav.enter_struct_type_declaration += T(:check)
|
|
1017
|
+
trav.enter_union_type_declaration += T(:check)
|
|
1018
1018
|
end
|
|
1019
1019
|
|
|
1020
1020
|
private
|
|
1021
1021
|
def check(node)
|
|
1022
1022
|
node.struct_declarations.each do |struct_dcl|
|
|
1023
|
-
struct_dcl.items.each do |
|
|
1024
|
-
memb_type =
|
|
1023
|
+
struct_dcl.items.each do |memb_dcl|
|
|
1024
|
+
memb_type = memb_dcl.type
|
|
1025
1025
|
next unless memb_type.scalar? && memb_type.integer?
|
|
1026
1026
|
if memb_type.bitfield? && !memb_type.explicitly_signed?
|
|
1027
1027
|
W(node.location)
|
|
@@ -1041,9 +1041,9 @@ module CBuiltin #:nodoc:
|
|
|
1041
1041
|
|
|
1042
1042
|
def initialize(phase_ctxt)
|
|
1043
1043
|
super
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1044
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
1045
|
+
trav.enter_struct_type_declaration += T(:check_struct)
|
|
1046
|
+
trav.enter_union_type_declaration += T(:check_union)
|
|
1047
1047
|
end
|
|
1048
1048
|
|
|
1049
1049
|
private
|
|
@@ -1073,8 +1073,8 @@ module CBuiltin #:nodoc:
|
|
|
1073
1073
|
|
|
1074
1074
|
def initialize(phase_ctxt)
|
|
1075
1075
|
super
|
|
1076
|
-
|
|
1077
|
-
|
|
1076
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
1077
|
+
trav.enter_enum_type_declaration += T(:check)
|
|
1078
1078
|
end
|
|
1079
1079
|
|
|
1080
1080
|
private
|
|
@@ -1094,8 +1094,8 @@ module CBuiltin #:nodoc:
|
|
|
1094
1094
|
|
|
1095
1095
|
def initialize(phase_ctxt)
|
|
1096
1096
|
super
|
|
1097
|
-
|
|
1098
|
-
|
|
1097
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
1098
|
+
trav.enter_variable_definition += T(:enter_variable_definition)
|
|
1099
1099
|
end
|
|
1100
1100
|
|
|
1101
1101
|
private
|
|
@@ -1209,19 +1209,19 @@ module CBuiltin #:nodoc:
|
|
|
1209
1209
|
|
|
1210
1210
|
def initialize(phase_ctxt)
|
|
1211
1211
|
super
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1212
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
1213
|
+
trav.enter_if_statement += T(:enter_if_statement)
|
|
1214
|
+
trav.leave_if_statement += T(:leave_if_statement)
|
|
1215
|
+
trav.enter_switch_statement += T(:enter_switch_statement)
|
|
1216
|
+
trav.leave_switch_statement += T(:leave_switch_statement)
|
|
1217
|
+
trav.enter_while_statement += T(:enter_while_statement)
|
|
1218
|
+
trav.leave_while_statement += T(:leave_while_statement)
|
|
1219
|
+
trav.enter_do_statement += T(:enter_do_statement)
|
|
1220
|
+
trav.leave_do_statement += T(:leave_do_statement)
|
|
1221
|
+
trav.enter_for_statement += T(:enter_for_statement)
|
|
1222
|
+
trav.leave_for_statement += T(:leave_for_statement)
|
|
1223
|
+
trav.enter_c99_for_statement += T(:enter_c99_for_statement)
|
|
1224
|
+
trav.leave_c99_for_statement += T(:leave_c99_for_statement)
|
|
1225
1225
|
@ctrl_stmt_level = 0
|
|
1226
1226
|
end
|
|
1227
1227
|
|
|
@@ -1290,10 +1290,10 @@ module CBuiltin #:nodoc:
|
|
|
1290
1290
|
|
|
1291
1291
|
def initialize(phase_ctxt)
|
|
1292
1292
|
super
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1293
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
1294
|
+
trav.enter_switch_statement += T(:enter_switch_statement)
|
|
1295
|
+
trav.leave_switch_statement += T(:leave_switch_statement)
|
|
1296
|
+
trav.enter_case_labeled_statement += T(:check)
|
|
1297
1297
|
@label_num_stack = []
|
|
1298
1298
|
end
|
|
1299
1299
|
|
|
@@ -1428,8 +1428,8 @@ module CBuiltin #:nodoc:
|
|
|
1428
1428
|
|
|
1429
1429
|
def initialize(phase_ctxt)
|
|
1430
1430
|
super
|
|
1431
|
-
|
|
1432
|
-
|
|
1431
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
1432
|
+
trav.enter_string_literal_specifier += T(:check)
|
|
1433
1433
|
end
|
|
1434
1434
|
|
|
1435
1435
|
private
|
|
@@ -1449,8 +1449,8 @@ module CBuiltin #:nodoc:
|
|
|
1449
1449
|
|
|
1450
1450
|
def initialize(phase_ctxt)
|
|
1451
1451
|
super
|
|
1452
|
-
|
|
1453
|
-
|
|
1452
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
1453
|
+
trav.enter_typeof_type_specifier += T(:check)
|
|
1454
1454
|
end
|
|
1455
1455
|
|
|
1456
1456
|
private
|
|
@@ -1468,9 +1468,9 @@ module CBuiltin #:nodoc:
|
|
|
1468
1468
|
|
|
1469
1469
|
def initialize(phase_ctxt)
|
|
1470
1470
|
super
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1471
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
1472
|
+
trav.enter_alignof_expression += T(:check)
|
|
1473
|
+
trav.enter_alignof_type_expression += T(:check)
|
|
1474
1474
|
end
|
|
1475
1475
|
|
|
1476
1476
|
private
|
|
@@ -1507,8 +1507,8 @@ module CBuiltin #:nodoc:
|
|
|
1507
1507
|
|
|
1508
1508
|
def initialize(phase_ctxt)
|
|
1509
1509
|
super
|
|
1510
|
-
|
|
1511
|
-
|
|
1510
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
1511
|
+
trav.enter_simple_assignment_expression += T(:check)
|
|
1512
1512
|
end
|
|
1513
1513
|
|
|
1514
1514
|
private
|
|
@@ -1530,9 +1530,9 @@ module CBuiltin #:nodoc:
|
|
|
1530
1530
|
|
|
1531
1531
|
def initialize(phase_ctxt)
|
|
1532
1532
|
super
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1533
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
1534
|
+
trav.enter_ansi_function_definition += T(:check_ansi_function)
|
|
1535
|
+
trav.enter_kandr_function_definition += T(:check_kandr_function)
|
|
1536
1536
|
@interp = phase_ctxt[:cc1_interpreter]
|
|
1537
1537
|
end
|
|
1538
1538
|
|
|
@@ -1614,9 +1614,9 @@ module CBuiltin #:nodoc:
|
|
|
1614
1614
|
|
|
1615
1615
|
def initialize(phase_ctxt)
|
|
1616
1616
|
super
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1617
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
1618
|
+
trav.enter_bit_access_by_value_expression += T(:check)
|
|
1619
|
+
trav.enter_bit_access_by_pointer_expression += T(:check)
|
|
1620
1620
|
end
|
|
1621
1621
|
|
|
1622
1622
|
private
|
|
@@ -1725,8 +1725,8 @@ module CBuiltin #:nodoc:
|
|
|
1725
1725
|
|
|
1726
1726
|
def initialize(phase_ctxt)
|
|
1727
1727
|
super
|
|
1728
|
-
|
|
1729
|
-
|
|
1728
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
1729
|
+
trav.enter_function_declaration += T(:check)
|
|
1730
1730
|
end
|
|
1731
1731
|
|
|
1732
1732
|
private
|
|
@@ -1746,8 +1746,8 @@ module CBuiltin #:nodoc:
|
|
|
1746
1746
|
|
|
1747
1747
|
def initialize(phase_ctxt)
|
|
1748
1748
|
super
|
|
1749
|
-
|
|
1750
|
-
|
|
1749
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
1750
|
+
trav.enter_variable_definition += T(:check)
|
|
1751
1751
|
@interp = phase_ctxt[:cc1_interpreter]
|
|
1752
1752
|
end
|
|
1753
1753
|
|
|
@@ -1899,8 +1899,8 @@ module CBuiltin #:nodoc:
|
|
|
1899
1899
|
|
|
1900
1900
|
def initialize(phase_ctxt)
|
|
1901
1901
|
super
|
|
1902
|
-
|
|
1903
|
-
|
|
1902
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
1903
|
+
trav.enter_comma_separated_expression += T(:check)
|
|
1904
1904
|
end
|
|
1905
1905
|
|
|
1906
1906
|
private
|
|
@@ -1978,8 +1978,8 @@ module CBuiltin #:nodoc:
|
|
|
1978
1978
|
|
|
1979
1979
|
def initialize(phase_ctxt)
|
|
1980
1980
|
super
|
|
1981
|
-
|
|
1982
|
-
|
|
1981
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
1982
|
+
trav.enter_conditional_expression += T(:check)
|
|
1983
1983
|
end
|
|
1984
1984
|
|
|
1985
1985
|
private
|
|
@@ -2002,14 +2002,14 @@ module CBuiltin #:nodoc:
|
|
|
2002
2002
|
|
|
2003
2003
|
def initialize(phase_ctxt)
|
|
2004
2004
|
super
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2005
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
2006
|
+
trav.enter_simple_assignment_expression += T(:enter_assignment)
|
|
2007
|
+
trav.leave_simple_assignment_expression += T(:leave_assignment)
|
|
2008
|
+
trav.enter_compound_assignment_expression += T(:enter_assignment)
|
|
2009
|
+
trav.leave_compound_assignment_expression += T(:leave_assignment)
|
|
2010
|
+
trav.enter_function_call_expression += T(:enter_assignment)
|
|
2011
|
+
trav.leave_function_call_expression += T(:leave_assignment)
|
|
2012
|
+
trav.enter_comma_separated_expression += T(:check)
|
|
2013
2013
|
@assignment_depth = 0
|
|
2014
2014
|
end
|
|
2015
2015
|
|
|
@@ -8207,8 +8207,8 @@ module CBuiltin #:nodoc:
|
|
|
8207
8207
|
|
|
8208
8208
|
def initialize(phase_ctxt)
|
|
8209
8209
|
super
|
|
8210
|
-
|
|
8211
|
-
|
|
8210
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
8211
|
+
trav.enter_enum_type_declaration += T(:check)
|
|
8212
8212
|
end
|
|
8213
8213
|
|
|
8214
8214
|
private
|
|
@@ -8232,13 +8232,13 @@ module CBuiltin #:nodoc:
|
|
|
8232
8232
|
|
|
8233
8233
|
def initialize(phase_ctxt)
|
|
8234
8234
|
super
|
|
8235
|
-
|
|
8236
|
-
|
|
8237
|
-
|
|
8238
|
-
|
|
8239
|
-
|
|
8240
|
-
|
|
8241
|
-
|
|
8235
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
8236
|
+
trav.enter_if_statement += T(:check_if_statement)
|
|
8237
|
+
trav.enter_if_else_statement += T(:check_if_else_statement)
|
|
8238
|
+
trav.enter_while_statement += T(:check_while_statement)
|
|
8239
|
+
trav.enter_do_statement += T(:check_do_statement)
|
|
8240
|
+
trav.enter_for_statement += T(:check_for_statement)
|
|
8241
|
+
trav.enter_c99_for_statement += T(:check_for_statement)
|
|
8242
8242
|
end
|
|
8243
8243
|
|
|
8244
8244
|
private
|
|
@@ -8306,13 +8306,13 @@ module CBuiltin #:nodoc:
|
|
|
8306
8306
|
|
|
8307
8307
|
def initialize(phase_ctxt)
|
|
8308
8308
|
super
|
|
8309
|
-
|
|
8310
|
-
|
|
8311
|
-
|
|
8312
|
-
|
|
8313
|
-
|
|
8314
|
-
|
|
8315
|
-
|
|
8309
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
8310
|
+
trav.enter_if_statement += T(:check_if_statement)
|
|
8311
|
+
trav.enter_if_else_statement += T(:check_if_else_statement)
|
|
8312
|
+
trav.enter_while_statement += T(:check_while_statement)
|
|
8313
|
+
trav.enter_do_statement += T(:check_do_statement)
|
|
8314
|
+
trav.enter_for_statement += T(:check_for_statement)
|
|
8315
|
+
trav.enter_c99_for_statement += T(:check_for_statement)
|
|
8316
8316
|
end
|
|
8317
8317
|
|
|
8318
8318
|
private
|
|
@@ -8694,7 +8694,7 @@ module CBuiltin #:nodoc:
|
|
|
8694
8694
|
|
|
8695
8695
|
def visit_member_declaration(node)
|
|
8696
8696
|
if node.analysis_target?(traits)
|
|
8697
|
-
|
|
8697
|
+
check_member_dcl(node)
|
|
8698
8698
|
@lst_memb_dcl_loc = node.location
|
|
8699
8699
|
end
|
|
8700
8700
|
end
|
|
@@ -8822,7 +8822,7 @@ module CBuiltin #:nodoc:
|
|
|
8822
8822
|
end
|
|
8823
8823
|
end
|
|
8824
8824
|
|
|
8825
|
-
def
|
|
8825
|
+
def check_member_dcl(node)
|
|
8826
8826
|
if @lst_memb_dcl_loc.fpath == node.location.fpath &&
|
|
8827
8827
|
@lst_memb_dcl_loc.line_no == node.location.line_no
|
|
8828
8828
|
W(node.location)
|
|
@@ -9292,8 +9292,8 @@ module CBuiltin #:nodoc:
|
|
|
9292
9292
|
|
|
9293
9293
|
def initialize(phase_ctxt)
|
|
9294
9294
|
super
|
|
9295
|
-
|
|
9296
|
-
|
|
9295
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
9296
|
+
trav.enter_compound_statement += T(:check)
|
|
9297
9297
|
end
|
|
9298
9298
|
|
|
9299
9299
|
private
|
|
@@ -9452,12 +9452,12 @@ module CBuiltin #:nodoc:
|
|
|
9452
9452
|
|
|
9453
9453
|
def initialize(phase_ctxt)
|
|
9454
9454
|
super
|
|
9455
|
-
|
|
9456
|
-
|
|
9457
|
-
|
|
9458
|
-
|
|
9459
|
-
|
|
9460
|
-
|
|
9455
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
9456
|
+
trav.enter_comma_separated_expression += T(:check)
|
|
9457
|
+
trav.enter_for_statement += T(:enter_for_statement)
|
|
9458
|
+
trav.leave_for_statement += T(:leave_for_statement)
|
|
9459
|
+
trav.enter_c99_for_statement += T(:enter_for_statement)
|
|
9460
|
+
trav.leave_c99_for_statement += T(:leave_for_statement)
|
|
9461
9461
|
@in_for_stmt = false
|
|
9462
9462
|
end
|
|
9463
9463
|
|
|
@@ -9517,10 +9517,10 @@ module CBuiltin #:nodoc:
|
|
|
9517
9517
|
|
|
9518
9518
|
def initialize(phase_ctxt)
|
|
9519
9519
|
super
|
|
9520
|
-
|
|
9521
|
-
|
|
9522
|
-
|
|
9523
|
-
|
|
9520
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
9521
|
+
trav.enter_function_declaration += T(:check_function)
|
|
9522
|
+
trav.enter_ansi_function_definition += T(:check_function)
|
|
9523
|
+
trav.enter_kandr_function_definition += T(:check_function)
|
|
9524
9524
|
end
|
|
9525
9525
|
|
|
9526
9526
|
private
|
|
@@ -9538,10 +9538,10 @@ module CBuiltin #:nodoc:
|
|
|
9538
9538
|
|
|
9539
9539
|
def initialize(phase_ctxt)
|
|
9540
9540
|
super
|
|
9541
|
-
|
|
9542
|
-
|
|
9543
|
-
|
|
9544
|
-
|
|
9541
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
9542
|
+
trav.enter_variable_declaration += T(:check_variable)
|
|
9543
|
+
trav.enter_variable_definition += T(:check_variable)
|
|
9544
|
+
trav.enter_parameter_definition += T(:check_variable)
|
|
9545
9545
|
end
|
|
9546
9546
|
|
|
9547
9547
|
private
|
|
@@ -9702,17 +9702,17 @@ module CBuiltin #:nodoc:
|
|
|
9702
9702
|
|
|
9703
9703
|
def initialize(phase_ctxt)
|
|
9704
9704
|
super
|
|
9705
|
-
|
|
9706
|
-
|
|
9707
|
-
|
|
9708
|
-
|
|
9709
|
-
|
|
9710
|
-
|
|
9711
|
-
|
|
9712
|
-
|
|
9713
|
-
|
|
9714
|
-
|
|
9715
|
-
|
|
9705
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
9706
|
+
trav.enter_initializer += T(:check_initializer)
|
|
9707
|
+
trav.enter_expression_statement += T(:check_expr_statement)
|
|
9708
|
+
trav.enter_if_statement += T(:check_selection_statement)
|
|
9709
|
+
trav.enter_if_else_statement += T(:check_selection_statement)
|
|
9710
|
+
trav.enter_switch_statement += T(:check_selection_statement)
|
|
9711
|
+
trav.enter_while_statement += T(:check_iteration_statement)
|
|
9712
|
+
trav.enter_do_statement += T(:check_iteration_statement)
|
|
9713
|
+
trav.enter_for_statement += T(:check_iteration_statement)
|
|
9714
|
+
trav.enter_c99_for_statement += T(:check_iteration_statement)
|
|
9715
|
+
trav.enter_return_statement += T(:check_return_statement)
|
|
9716
9716
|
end
|
|
9717
9717
|
|
|
9718
9718
|
private
|
|
@@ -9877,17 +9877,17 @@ module CBuiltin #:nodoc:
|
|
|
9877
9877
|
|
|
9878
9878
|
def initialize(phase_ctxt)
|
|
9879
9879
|
super
|
|
9880
|
-
|
|
9881
|
-
|
|
9882
|
-
|
|
9883
|
-
|
|
9884
|
-
|
|
9885
|
-
|
|
9886
|
-
|
|
9887
|
-
|
|
9888
|
-
|
|
9889
|
-
|
|
9890
|
-
|
|
9880
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
9881
|
+
trav.enter_initializer += T(:check_initializer)
|
|
9882
|
+
trav.enter_expression_statement += T(:check_expr_statement)
|
|
9883
|
+
trav.enter_if_statement += T(:check_selection_statement)
|
|
9884
|
+
trav.enter_if_else_statement += T(:check_selection_statement)
|
|
9885
|
+
trav.enter_switch_statement += T(:check_selection_statement)
|
|
9886
|
+
trav.enter_while_statement += T(:check_iteration_statement)
|
|
9887
|
+
trav.enter_do_statement += T(:check_iteration_statement)
|
|
9888
|
+
trav.enter_for_statement += T(:check_iteration_statement)
|
|
9889
|
+
trav.enter_c99_for_statement += T(:check_iteration_statement)
|
|
9890
|
+
trav.enter_return_statement += T(:check_return_statement)
|
|
9891
9891
|
end
|
|
9892
9892
|
|
|
9893
9893
|
private
|
|
@@ -10063,17 +10063,17 @@ module CBuiltin #:nodoc:
|
|
|
10063
10063
|
|
|
10064
10064
|
def initialize(phase_ctxt)
|
|
10065
10065
|
super
|
|
10066
|
-
|
|
10067
|
-
|
|
10068
|
-
|
|
10069
|
-
|
|
10070
|
-
|
|
10071
|
-
|
|
10072
|
-
|
|
10073
|
-
|
|
10074
|
-
|
|
10075
|
-
|
|
10076
|
-
|
|
10066
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
10067
|
+
trav.enter_initializer += T(:check_initializer)
|
|
10068
|
+
trav.enter_expression_statement += T(:check_expr_statement)
|
|
10069
|
+
trav.enter_if_statement += T(:check_selection_statement)
|
|
10070
|
+
trav.enter_if_else_statement += T(:check_selection_statement)
|
|
10071
|
+
trav.enter_switch_statement += T(:check_selection_statement)
|
|
10072
|
+
trav.enter_while_statement += T(:check_iteration_statement)
|
|
10073
|
+
trav.enter_do_statement += T(:check_iteration_statement)
|
|
10074
|
+
trav.enter_for_statement += T(:check_iteration_statement)
|
|
10075
|
+
trav.enter_c99_for_statement += T(:check_iteration_statement)
|
|
10076
|
+
trav.enter_return_statement += T(:check_return_statement)
|
|
10077
10077
|
end
|
|
10078
10078
|
|
|
10079
10079
|
private
|
|
@@ -10640,17 +10640,17 @@ module CBuiltin #:nodoc:
|
|
|
10640
10640
|
|
|
10641
10641
|
def initialize(phase_ctxt)
|
|
10642
10642
|
super
|
|
10643
|
-
|
|
10644
|
-
|
|
10645
|
-
|
|
10646
|
-
|
|
10647
|
-
|
|
10648
|
-
|
|
10649
|
-
|
|
10650
|
-
|
|
10651
|
-
|
|
10652
|
-
|
|
10653
|
-
|
|
10643
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
10644
|
+
trav.enter_initializer += T(:check_initializer)
|
|
10645
|
+
trav.enter_expression_statement += T(:check_expr_statement)
|
|
10646
|
+
trav.enter_if_statement += T(:check_selection_statement)
|
|
10647
|
+
trav.enter_if_else_statement += T(:check_selection_statement)
|
|
10648
|
+
trav.enter_switch_statement += T(:check_selection_statement)
|
|
10649
|
+
trav.enter_while_statement += T(:check_iteration_statement)
|
|
10650
|
+
trav.enter_do_statement += T(:check_iteration_statement)
|
|
10651
|
+
trav.enter_for_statement += T(:check_iteration_statement)
|
|
10652
|
+
trav.enter_c99_for_statement += T(:check_iteration_statement)
|
|
10653
|
+
trav.enter_return_statement += T(:check_return_statement)
|
|
10654
10654
|
end
|
|
10655
10655
|
|
|
10656
10656
|
private
|
|
@@ -10815,17 +10815,17 @@ module CBuiltin #:nodoc:
|
|
|
10815
10815
|
|
|
10816
10816
|
def initialize(phase_ctxt)
|
|
10817
10817
|
super
|
|
10818
|
-
|
|
10819
|
-
|
|
10820
|
-
|
|
10821
|
-
|
|
10822
|
-
|
|
10823
|
-
|
|
10824
|
-
|
|
10825
|
-
|
|
10826
|
-
|
|
10827
|
-
|
|
10828
|
-
|
|
10818
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
10819
|
+
trav.enter_initializer += T(:check_initializer)
|
|
10820
|
+
trav.enter_expression_statement += T(:check_expr_statement)
|
|
10821
|
+
trav.enter_if_statement += T(:check_selection_statement)
|
|
10822
|
+
trav.enter_if_else_statement += T(:check_selection_statement)
|
|
10823
|
+
trav.enter_switch_statement += T(:check_selection_statement)
|
|
10824
|
+
trav.enter_while_statement += T(:check_iteration_statement)
|
|
10825
|
+
trav.enter_do_statement += T(:check_iteration_statement)
|
|
10826
|
+
trav.enter_for_statement += T(:check_iteration_statement)
|
|
10827
|
+
trav.enter_c99_for_statement += T(:check_iteration_statement)
|
|
10828
|
+
trav.enter_return_statement += T(:check_return_statement)
|
|
10829
10829
|
end
|
|
10830
10830
|
|
|
10831
10831
|
private
|
|
@@ -10933,17 +10933,17 @@ module CBuiltin #:nodoc:
|
|
|
10933
10933
|
|
|
10934
10934
|
def initialize(phase_ctxt)
|
|
10935
10935
|
super
|
|
10936
|
-
|
|
10937
|
-
|
|
10938
|
-
|
|
10939
|
-
|
|
10940
|
-
|
|
10941
|
-
|
|
10942
|
-
|
|
10943
|
-
|
|
10944
|
-
|
|
10945
|
-
|
|
10946
|
-
|
|
10936
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
10937
|
+
trav.enter_initializer += T(:check_initializer)
|
|
10938
|
+
trav.enter_expression_statement += T(:check_expr_statement)
|
|
10939
|
+
trav.enter_if_statement += T(:check_selection_statement)
|
|
10940
|
+
trav.enter_if_else_statement += T(:check_selection_statement)
|
|
10941
|
+
trav.enter_switch_statement += T(:check_selection_statement)
|
|
10942
|
+
trav.enter_while_statement += T(:check_iteration_statement)
|
|
10943
|
+
trav.enter_do_statement += T(:check_iteration_statement)
|
|
10944
|
+
trav.enter_for_statement += T(:check_iteration_statement)
|
|
10945
|
+
trav.enter_c99_for_statement += T(:check_iteration_statement)
|
|
10946
|
+
trav.enter_return_statement += T(:check_return_statement)
|
|
10947
10947
|
end
|
|
10948
10948
|
|
|
10949
10949
|
private
|
|
@@ -11122,17 +11122,17 @@ module CBuiltin #:nodoc:
|
|
|
11122
11122
|
|
|
11123
11123
|
def initialize(phase_ctxt)
|
|
11124
11124
|
super
|
|
11125
|
-
|
|
11126
|
-
|
|
11127
|
-
|
|
11128
|
-
|
|
11129
|
-
|
|
11130
|
-
|
|
11131
|
-
|
|
11132
|
-
|
|
11133
|
-
|
|
11134
|
-
|
|
11135
|
-
|
|
11125
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
11126
|
+
trav.enter_initializer += T(:check_initializer)
|
|
11127
|
+
trav.enter_expression_statement += T(:check_expr_statement)
|
|
11128
|
+
trav.enter_if_statement += T(:check_selection_statement)
|
|
11129
|
+
trav.enter_if_else_statement += T(:check_selection_statement)
|
|
11130
|
+
trav.enter_switch_statement += T(:check_selection_statement)
|
|
11131
|
+
trav.enter_while_statement += T(:check_iteration_statement)
|
|
11132
|
+
trav.enter_do_statement += T(:check_iteration_statement)
|
|
11133
|
+
trav.enter_for_statement += T(:check_iteration_statement)
|
|
11134
|
+
trav.enter_c99_for_statement += T(:check_iteration_statement)
|
|
11135
|
+
trav.enter_return_statement += T(:check_return_statement)
|
|
11136
11136
|
end
|
|
11137
11137
|
|
|
11138
11138
|
private
|
|
@@ -11286,17 +11286,17 @@ module CBuiltin #:nodoc:
|
|
|
11286
11286
|
|
|
11287
11287
|
def initialize(phase_ctxt)
|
|
11288
11288
|
super
|
|
11289
|
-
|
|
11290
|
-
|
|
11291
|
-
|
|
11292
|
-
|
|
11293
|
-
|
|
11294
|
-
|
|
11295
|
-
|
|
11296
|
-
|
|
11297
|
-
|
|
11298
|
-
|
|
11299
|
-
|
|
11289
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
11290
|
+
trav.enter_initializer += T(:check_initializer)
|
|
11291
|
+
trav.enter_expression_statement += T(:check_expr_statement)
|
|
11292
|
+
trav.enter_if_statement += T(:check_selection_statement)
|
|
11293
|
+
trav.enter_if_else_statement += T(:check_selection_statement)
|
|
11294
|
+
trav.enter_switch_statement += T(:check_selection_statement)
|
|
11295
|
+
trav.enter_while_statement += T(:check_iteration_statement)
|
|
11296
|
+
trav.enter_do_statement += T(:check_iteration_statement)
|
|
11297
|
+
trav.enter_for_statement += T(:check_iteration_statement)
|
|
11298
|
+
trav.enter_c99_for_statement += T(:check_iteration_statement)
|
|
11299
|
+
trav.enter_return_statement += T(:check_return_statement)
|
|
11300
11300
|
end
|
|
11301
11301
|
|
|
11302
11302
|
private
|
|
@@ -11487,17 +11487,17 @@ module CBuiltin #:nodoc:
|
|
|
11487
11487
|
|
|
11488
11488
|
def initialize(phase_ctxt)
|
|
11489
11489
|
super
|
|
11490
|
-
|
|
11491
|
-
|
|
11492
|
-
|
|
11493
|
-
|
|
11494
|
-
|
|
11495
|
-
|
|
11496
|
-
|
|
11497
|
-
|
|
11498
|
-
|
|
11499
|
-
|
|
11500
|
-
|
|
11490
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
11491
|
+
trav.enter_initializer += T(:check_initializer)
|
|
11492
|
+
trav.enter_expression_statement += T(:check_expr_statement)
|
|
11493
|
+
trav.enter_if_statement += T(:check_selection_statement)
|
|
11494
|
+
trav.enter_if_else_statement += T(:check_selection_statement)
|
|
11495
|
+
trav.enter_switch_statement += T(:check_selection_statement)
|
|
11496
|
+
trav.enter_while_statement += T(:check_iteration_statement)
|
|
11497
|
+
trav.enter_do_statement += T(:check_iteration_statement)
|
|
11498
|
+
trav.enter_for_statement += T(:check_iteration_statement)
|
|
11499
|
+
trav.enter_c99_for_statement += T(:check_iteration_statement)
|
|
11500
|
+
trav.enter_return_statement += T(:check_return_statement)
|
|
11501
11501
|
end
|
|
11502
11502
|
|
|
11503
11503
|
private
|
|
@@ -11651,17 +11651,17 @@ module CBuiltin #:nodoc:
|
|
|
11651
11651
|
|
|
11652
11652
|
def initialize(phase_ctxt)
|
|
11653
11653
|
super
|
|
11654
|
-
|
|
11655
|
-
|
|
11656
|
-
|
|
11657
|
-
|
|
11658
|
-
|
|
11659
|
-
|
|
11660
|
-
|
|
11661
|
-
|
|
11662
|
-
|
|
11663
|
-
|
|
11664
|
-
|
|
11654
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
11655
|
+
trav.enter_initializer += T(:check_initializer)
|
|
11656
|
+
trav.enter_expression_statement += T(:check_expr_statement)
|
|
11657
|
+
trav.enter_if_statement += T(:check_selection_statement)
|
|
11658
|
+
trav.enter_if_else_statement += T(:check_selection_statement)
|
|
11659
|
+
trav.enter_switch_statement += T(:check_selection_statement)
|
|
11660
|
+
trav.enter_while_statement += T(:check_iteration_statement)
|
|
11661
|
+
trav.enter_do_statement += T(:check_iteration_statement)
|
|
11662
|
+
trav.enter_for_statement += T(:check_iteration_statement)
|
|
11663
|
+
trav.enter_c99_for_statement += T(:check_iteration_statement)
|
|
11664
|
+
trav.enter_return_statement += T(:check_return_statement)
|
|
11665
11665
|
end
|
|
11666
11666
|
|
|
11667
11667
|
private
|
|
@@ -11825,17 +11825,17 @@ module CBuiltin #:nodoc:
|
|
|
11825
11825
|
|
|
11826
11826
|
def initialize(phase_ctxt)
|
|
11827
11827
|
super
|
|
11828
|
-
|
|
11829
|
-
|
|
11830
|
-
|
|
11831
|
-
|
|
11832
|
-
|
|
11833
|
-
|
|
11834
|
-
|
|
11835
|
-
|
|
11836
|
-
|
|
11837
|
-
|
|
11838
|
-
|
|
11828
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
11829
|
+
trav.enter_initializer += T(:check_initializer)
|
|
11830
|
+
trav.enter_expression_statement += T(:check_expr_statement)
|
|
11831
|
+
trav.enter_if_statement += T(:check_selection_statement)
|
|
11832
|
+
trav.enter_if_else_statement += T(:check_selection_statement)
|
|
11833
|
+
trav.enter_switch_statement += T(:check_selection_statement)
|
|
11834
|
+
trav.enter_while_statement += T(:check_iteration_statement)
|
|
11835
|
+
trav.enter_do_statement += T(:check_iteration_statement)
|
|
11836
|
+
trav.enter_for_statement += T(:check_iteration_statement)
|
|
11837
|
+
trav.enter_c99_for_statement += T(:check_iteration_statement)
|
|
11838
|
+
trav.enter_return_statement += T(:check_return_statement)
|
|
11839
11839
|
end
|
|
11840
11840
|
|
|
11841
11841
|
private
|
|
@@ -12075,9 +12075,9 @@ module CBuiltin #:nodoc:
|
|
|
12075
12075
|
|
|
12076
12076
|
def initialize(phase_ctxt)
|
|
12077
12077
|
super
|
|
12078
|
-
|
|
12079
|
-
|
|
12080
|
-
|
|
12078
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
12079
|
+
trav.enter_logical_and_expression += T(:check)
|
|
12080
|
+
trav.enter_logical_or_expression += T(:check)
|
|
12081
12081
|
end
|
|
12082
12082
|
|
|
12083
12083
|
private
|
|
@@ -12095,13 +12095,13 @@ module CBuiltin #:nodoc:
|
|
|
12095
12095
|
|
|
12096
12096
|
def initialize(phase_ctxt)
|
|
12097
12097
|
super
|
|
12098
|
-
|
|
12099
|
-
|
|
12100
|
-
|
|
12101
|
-
|
|
12102
|
-
|
|
12103
|
-
|
|
12104
|
-
|
|
12098
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
12099
|
+
trav.enter_expression_statement += T(:enter_expr_stmt)
|
|
12100
|
+
trav.leave_expression_statement += T(:leave_expr_stmt)
|
|
12101
|
+
trav.enter_postfix_increment_expression += T(:check)
|
|
12102
|
+
trav.enter_postfix_decrement_expression += T(:check)
|
|
12103
|
+
trav.enter_prefix_increment_expression += T(:check)
|
|
12104
|
+
trav.enter_prefix_decrement_expression += T(:check)
|
|
12105
12105
|
@cur_stmt = nil
|
|
12106
12106
|
end
|
|
12107
12107
|
|
|
@@ -12132,8 +12132,8 @@ module CBuiltin #:nodoc:
|
|
|
12132
12132
|
|
|
12133
12133
|
def initialize(phase_ctxt)
|
|
12134
12134
|
super
|
|
12135
|
-
|
|
12136
|
-
|
|
12135
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
12136
|
+
trav.enter_member_declaration += T(:check)
|
|
12137
12137
|
end
|
|
12138
12138
|
|
|
12139
12139
|
private
|
|
@@ -12154,8 +12154,8 @@ module CBuiltin #:nodoc:
|
|
|
12154
12154
|
|
|
12155
12155
|
def initialize(phase_ctxt)
|
|
12156
12156
|
super
|
|
12157
|
-
|
|
12158
|
-
|
|
12157
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
12158
|
+
trav.enter_constant_specifier += T(:check)
|
|
12159
12159
|
end
|
|
12160
12160
|
|
|
12161
12161
|
private
|
|
@@ -12175,9 +12175,9 @@ module CBuiltin #:nodoc:
|
|
|
12175
12175
|
|
|
12176
12176
|
def initialize(phase_ctxt)
|
|
12177
12177
|
super
|
|
12178
|
-
|
|
12179
|
-
|
|
12180
|
-
|
|
12178
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
12179
|
+
trav.enter_constant_specifier += T(:check_constant)
|
|
12180
|
+
trav.enter_string_literal_specifier += T(:check_string_literal)
|
|
12181
12181
|
end
|
|
12182
12182
|
|
|
12183
12183
|
private
|
|
@@ -12203,8 +12203,8 @@ module CBuiltin #:nodoc:
|
|
|
12203
12203
|
|
|
12204
12204
|
def initialize(phase_ctxt)
|
|
12205
12205
|
super
|
|
12206
|
-
|
|
12207
|
-
|
|
12206
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
12207
|
+
trav.enter_switch_statement += T(:check_switch_statement)
|
|
12208
12208
|
end
|
|
12209
12209
|
|
|
12210
12210
|
private
|
|
@@ -12329,12 +12329,12 @@ module CBuiltin #:nodoc:
|
|
|
12329
12329
|
|
|
12330
12330
|
def initialize(phase_ctxt)
|
|
12331
12331
|
super
|
|
12332
|
-
|
|
12333
|
-
|
|
12334
|
-
|
|
12335
|
-
|
|
12336
|
-
|
|
12337
|
-
|
|
12332
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
12333
|
+
trav.enter_comma_separated_expression += T(:check)
|
|
12334
|
+
trav.enter_for_statement += T(:enter_for_statement)
|
|
12335
|
+
trav.leave_for_statement += T(:leave_for_statement)
|
|
12336
|
+
trav.enter_c99_for_statement += T(:enter_for_statement)
|
|
12337
|
+
trav.leave_c99_for_statement += T(:leave_for_statement)
|
|
12338
12338
|
@in_for_stmt = false
|
|
12339
12339
|
end
|
|
12340
12340
|
|
|
@@ -12361,8 +12361,8 @@ module CBuiltin #:nodoc:
|
|
|
12361
12361
|
|
|
12362
12362
|
def initialize(phase_ctxt)
|
|
12363
12363
|
super
|
|
12364
|
-
|
|
12365
|
-
|
|
12364
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
12365
|
+
trav.enter_switch_statement += T(:check)
|
|
12366
12366
|
end
|
|
12367
12367
|
|
|
12368
12368
|
private
|
|
@@ -12417,8 +12417,8 @@ module CBuiltin #:nodoc:
|
|
|
12417
12417
|
|
|
12418
12418
|
def initialize(phase_ctxt)
|
|
12419
12419
|
super
|
|
12420
|
-
|
|
12421
|
-
|
|
12420
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
12421
|
+
trav.enter_ansi_function_definition += T(:check)
|
|
12422
12422
|
end
|
|
12423
12423
|
|
|
12424
12424
|
private
|
|
@@ -12438,8 +12438,8 @@ module CBuiltin #:nodoc:
|
|
|
12438
12438
|
|
|
12439
12439
|
def initialize(phase_ctxt)
|
|
12440
12440
|
super
|
|
12441
|
-
|
|
12442
|
-
|
|
12441
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
12442
|
+
trav.enter_function_declaration += T(:check)
|
|
12443
12443
|
end
|
|
12444
12444
|
|
|
12445
12445
|
private
|
|
@@ -12500,8 +12500,8 @@ module CBuiltin #:nodoc:
|
|
|
12500
12500
|
|
|
12501
12501
|
def initialize(phase_ctxt)
|
|
12502
12502
|
super
|
|
12503
|
-
|
|
12504
|
-
|
|
12503
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
12504
|
+
trav.enter_ansi_function_definition += T(:check)
|
|
12505
12505
|
@interp = phase_ctxt[:cc1_interpreter]
|
|
12506
12506
|
end
|
|
12507
12507
|
|
|
@@ -12530,7 +12530,7 @@ module CBuiltin #:nodoc:
|
|
|
12530
12530
|
end
|
|
12531
12531
|
|
|
12532
12532
|
def extract_param_names(node)
|
|
12533
|
-
collect_identifier_declarators(node).map { |
|
|
12533
|
+
collect_identifier_declarators(node).map { |dcr| dcr.identifier.value }
|
|
12534
12534
|
end
|
|
12535
12535
|
|
|
12536
12536
|
def interpreter
|
|
@@ -12591,8 +12591,8 @@ module CBuiltin #:nodoc:
|
|
|
12591
12591
|
|
|
12592
12592
|
def initialize(phase_ctxt)
|
|
12593
12593
|
super
|
|
12594
|
-
|
|
12595
|
-
|
|
12594
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
12595
|
+
trav.enter_switch_statement += T(:check)
|
|
12596
12596
|
end
|
|
12597
12597
|
|
|
12598
12598
|
private
|
|
@@ -12694,8 +12694,8 @@ module CBuiltin #:nodoc:
|
|
|
12694
12694
|
|
|
12695
12695
|
def initialize(phase_ctxt)
|
|
12696
12696
|
super
|
|
12697
|
-
|
|
12698
|
-
|
|
12697
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
12698
|
+
trav.enter_union_type_declaration += T(:check)
|
|
12699
12699
|
end
|
|
12700
12700
|
|
|
12701
12701
|
private
|
|
@@ -12791,8 +12791,8 @@ module CBuiltin #:nodoc:
|
|
|
12791
12791
|
|
|
12792
12792
|
def initialize(phase_ctxt)
|
|
12793
12793
|
super
|
|
12794
|
-
|
|
12795
|
-
|
|
12794
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
12795
|
+
trav.enter_unary_arithmetic_expression += T(:check)
|
|
12796
12796
|
end
|
|
12797
12797
|
|
|
12798
12798
|
private
|
|
@@ -12837,8 +12837,8 @@ module CBuiltin #:nodoc:
|
|
|
12837
12837
|
|
|
12838
12838
|
def initialize(phase_ctxt)
|
|
12839
12839
|
super
|
|
12840
|
-
|
|
12841
|
-
|
|
12840
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
12841
|
+
trav.enter_unary_arithmetic_expression += T(:check)
|
|
12842
12842
|
end
|
|
12843
12843
|
|
|
12844
12844
|
private
|
|
@@ -12893,8 +12893,8 @@ module CBuiltin #:nodoc:
|
|
|
12893
12893
|
|
|
12894
12894
|
def initialize(phase_ctxt)
|
|
12895
12895
|
super
|
|
12896
|
-
|
|
12897
|
-
|
|
12896
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
12897
|
+
trav.enter_expression_statement += T(:check)
|
|
12898
12898
|
end
|
|
12899
12899
|
|
|
12900
12900
|
private
|
|
@@ -12918,8 +12918,8 @@ module CBuiltin #:nodoc:
|
|
|
12918
12918
|
|
|
12919
12919
|
def initialize(phase_ctxt)
|
|
12920
12920
|
super
|
|
12921
|
-
|
|
12922
|
-
|
|
12921
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
12922
|
+
trav.enter_variable_definition += T(:check)
|
|
12923
12923
|
end
|
|
12924
12924
|
|
|
12925
12925
|
private
|
|
@@ -12961,10 +12961,10 @@ module CBuiltin #:nodoc:
|
|
|
12961
12961
|
|
|
12962
12962
|
def initialize(phase_ctxt)
|
|
12963
12963
|
super
|
|
12964
|
-
|
|
12965
|
-
|
|
12966
|
-
|
|
12967
|
-
|
|
12964
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
12965
|
+
trav.enter_compound_statement += T(:enter_block)
|
|
12966
|
+
trav.leave_compound_statement += T(:leave_block)
|
|
12967
|
+
trav.enter_generic_labeled_statement += T(:check)
|
|
12968
12968
|
@blocks = []
|
|
12969
12969
|
end
|
|
12970
12970
|
|
|
@@ -13006,10 +13006,10 @@ module CBuiltin #:nodoc:
|
|
|
13006
13006
|
|
|
13007
13007
|
def initialize(phase_ctxt)
|
|
13008
13008
|
super
|
|
13009
|
-
|
|
13010
|
-
|
|
13011
|
-
|
|
13012
|
-
|
|
13009
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
13010
|
+
trav.enter_compound_statement += T(:enter_block)
|
|
13011
|
+
trav.leave_compound_statement += T(:leave_block)
|
|
13012
|
+
trav.enter_generic_labeled_statement += T(:check)
|
|
13013
13013
|
@blocks = []
|
|
13014
13014
|
end
|
|
13015
13015
|
|
|
@@ -13338,6 +13338,54 @@ module CBuiltin #:nodoc:
|
|
|
13338
13338
|
end
|
|
13339
13339
|
end
|
|
13340
13340
|
|
|
13341
|
+
class W0573 < PassiveCodeCheck
|
|
13342
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
13343
|
+
|
|
13344
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
13345
|
+
# step-in analysis is supported.
|
|
13346
|
+
mark_as_unique
|
|
13347
|
+
|
|
13348
|
+
def initialize(phase_ctxt)
|
|
13349
|
+
super
|
|
13350
|
+
interp = phase_ctxt[:cc1_interpreter]
|
|
13351
|
+
interp.on_function_call_expr_evaled += T(:check)
|
|
13352
|
+
@environ = interp.environment
|
|
13353
|
+
end
|
|
13354
|
+
|
|
13355
|
+
private
|
|
13356
|
+
def check(funcall_expr, fun, arg_vars, *)
|
|
13357
|
+
if fun.named? && fun.name =~ /\A.*scanf\z/
|
|
13358
|
+
fmt = create_format(funcall_expr, format_str_index_of(funcall_expr),
|
|
13359
|
+
arg_vars, @environ)
|
|
13360
|
+
return unless fmt
|
|
13361
|
+
|
|
13362
|
+
fmt.conversion_specifiers.each do |conv_spec|
|
|
13363
|
+
if conv_spec.scanset && conv_spec.scanset.include?("-")
|
|
13364
|
+
W(fmt.location)
|
|
13365
|
+
break
|
|
13366
|
+
end
|
|
13367
|
+
end
|
|
13368
|
+
end
|
|
13369
|
+
end
|
|
13370
|
+
|
|
13371
|
+
def format_str_index_of(funcall_expr)
|
|
13372
|
+
funcall_expr.argument_expressions.index do |arg_expr|
|
|
13373
|
+
arg_expr.kind_of?(Cc1::StringLiteralSpecifier)
|
|
13374
|
+
end
|
|
13375
|
+
end
|
|
13376
|
+
|
|
13377
|
+
def create_format(funcall_expr, fmt_str_idx, arg_vars, env)
|
|
13378
|
+
if fmt_str_idx
|
|
13379
|
+
fmt_str = funcall_expr.argument_expressions[fmt_str_idx]
|
|
13380
|
+
if fmt_str && fmt_str.literal.value =~ /\AL?"(.*)"\z/i
|
|
13381
|
+
trailing_args = arg_vars[(fmt_str_idx + 1)..-1] || []
|
|
13382
|
+
return Cc1::ScanfFormat.new($1, fmt_str.location, trailing_args, env)
|
|
13383
|
+
end
|
|
13384
|
+
end
|
|
13385
|
+
nil
|
|
13386
|
+
end
|
|
13387
|
+
end
|
|
13388
|
+
|
|
13341
13389
|
class W0578 < PassiveCodeCheck
|
|
13342
13390
|
def_registrant_phase Cc1::Prepare2Phase
|
|
13343
13391
|
|
|
@@ -14035,18 +14083,18 @@ module CBuiltin #:nodoc:
|
|
|
14035
14083
|
|
|
14036
14084
|
def initialize(phase_ctxt)
|
|
14037
14085
|
super
|
|
14038
|
-
|
|
14039
|
-
|
|
14040
|
-
|
|
14041
|
-
|
|
14042
|
-
|
|
14043
|
-
|
|
14044
|
-
|
|
14045
|
-
|
|
14046
|
-
|
|
14047
|
-
|
|
14048
|
-
|
|
14049
|
-
|
|
14086
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
14087
|
+
trav.enter_break_statement += T(:check)
|
|
14088
|
+
trav.enter_switch_statement += T(:enter_breakable_statement)
|
|
14089
|
+
trav.leave_switch_statement += T(:leave_breakable_statement)
|
|
14090
|
+
trav.enter_while_statement += T(:enter_breakable_statement)
|
|
14091
|
+
trav.leave_while_statement += T(:leave_breakable_statement)
|
|
14092
|
+
trav.enter_do_statement += T(:enter_breakable_statement)
|
|
14093
|
+
trav.leave_do_statement += T(:leave_breakable_statement)
|
|
14094
|
+
trav.enter_for_statement += T(:enter_breakable_statement)
|
|
14095
|
+
trav.leave_for_statement += T(:leave_breakable_statement)
|
|
14096
|
+
trav.enter_c99_for_statement += T(:enter_breakable_statement)
|
|
14097
|
+
trav.leave_c99_for_statement += T(:leave_breakable_statement)
|
|
14050
14098
|
@breakable_stmts = []
|
|
14051
14099
|
end
|
|
14052
14100
|
|
|
@@ -14069,6 +14117,32 @@ module CBuiltin #:nodoc:
|
|
|
14069
14117
|
end
|
|
14070
14118
|
end
|
|
14071
14119
|
|
|
14120
|
+
class W0606 < PassiveCodeCheck
|
|
14121
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
14122
|
+
|
|
14123
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
14124
|
+
# step-in analysis is supported.
|
|
14125
|
+
mark_as_unique
|
|
14126
|
+
|
|
14127
|
+
def initialize(phase_ctxt)
|
|
14128
|
+
super
|
|
14129
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
14130
|
+
trav.enter_union_type_declaration += T(:check)
|
|
14131
|
+
end
|
|
14132
|
+
|
|
14133
|
+
private
|
|
14134
|
+
def check(node)
|
|
14135
|
+
node.struct_declarations.each do |struct_dcl|
|
|
14136
|
+
struct_dcl.items.each do |memb_dcl|
|
|
14137
|
+
if memb_dcl.type.scalar? && memb_dcl.type.floating?
|
|
14138
|
+
W(node.location)
|
|
14139
|
+
return
|
|
14140
|
+
end
|
|
14141
|
+
end
|
|
14142
|
+
end
|
|
14143
|
+
end
|
|
14144
|
+
end
|
|
14145
|
+
|
|
14072
14146
|
class W0607 < PassiveCodeCheck
|
|
14073
14147
|
def_registrant_phase Cc1::Prepare2Phase
|
|
14074
14148
|
|
|
@@ -14550,9 +14624,9 @@ module CBuiltin #:nodoc:
|
|
|
14550
14624
|
|
|
14551
14625
|
def initialize(phase_ctxt)
|
|
14552
14626
|
super
|
|
14553
|
-
|
|
14554
|
-
|
|
14555
|
-
|
|
14627
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
14628
|
+
trav.enter_ansi_function_definition += T(:check)
|
|
14629
|
+
trav.enter_kandr_function_definition += T(:check)
|
|
14556
14630
|
@dires = collect_define_lines(phase_ctxt[:cpp_ast]) +
|
|
14557
14631
|
collect_undef_lines(phase_ctxt[:cpp_ast])
|
|
14558
14632
|
end
|
|
@@ -14630,9 +14704,9 @@ module CBuiltin #:nodoc:
|
|
|
14630
14704
|
|
|
14631
14705
|
def initialize(phase_ctxt)
|
|
14632
14706
|
super
|
|
14633
|
-
|
|
14634
|
-
|
|
14635
|
-
|
|
14707
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
14708
|
+
trav.enter_constant_specifier += T(:check_constant)
|
|
14709
|
+
trav.enter_string_literal_specifier += T(:check_string_literal)
|
|
14636
14710
|
end
|
|
14637
14711
|
|
|
14638
14712
|
private
|
|
@@ -14654,21 +14728,21 @@ module CBuiltin #:nodoc:
|
|
|
14654
14728
|
|
|
14655
14729
|
def initialize(phase_ctxt)
|
|
14656
14730
|
super
|
|
14657
|
-
|
|
14658
|
-
|
|
14659
|
-
|
|
14660
|
-
|
|
14661
|
-
|
|
14662
|
-
|
|
14663
|
-
|
|
14664
|
-
|
|
14665
|
-
|
|
14666
|
-
|
|
14667
|
-
|
|
14668
|
-
|
|
14669
|
-
|
|
14670
|
-
|
|
14671
|
-
|
|
14731
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
14732
|
+
trav.enter_compound_statement += T(:enter_block)
|
|
14733
|
+
trav.leave_compound_statement += T(:leave_block)
|
|
14734
|
+
trav.enter_expression_statement += T(:enter_expression_statement)
|
|
14735
|
+
trav.enter_if_statement += T(:update_last_statement)
|
|
14736
|
+
trav.enter_if_else_statement += T(:update_last_statement)
|
|
14737
|
+
trav.enter_switch_statement += T(:update_last_statement)
|
|
14738
|
+
trav.enter_while_statement += T(:update_last_statement)
|
|
14739
|
+
trav.enter_do_statement += T(:update_last_statement)
|
|
14740
|
+
trav.enter_for_statement += T(:enter_for_statement)
|
|
14741
|
+
trav.enter_c99_for_statement += T(:enter_for_statement)
|
|
14742
|
+
trav.enter_goto_statement += T(:update_last_statement)
|
|
14743
|
+
trav.enter_continue_statement += T(:update_last_statement)
|
|
14744
|
+
trav.enter_break_statement += T(:update_last_statement)
|
|
14745
|
+
trav.enter_return_statement += T(:update_last_statement)
|
|
14672
14746
|
@lst_stmts = []
|
|
14673
14747
|
@expected_stmts = Set.new
|
|
14674
14748
|
end
|
|
@@ -15094,6 +15168,26 @@ module CBuiltin #:nodoc:
|
|
|
15094
15168
|
end
|
|
15095
15169
|
end
|
|
15096
15170
|
|
|
15171
|
+
class W0645 < PassiveCodeCheck
|
|
15172
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
15173
|
+
|
|
15174
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
15175
|
+
# step-in analysis is supported.
|
|
15176
|
+
mark_as_unique
|
|
15177
|
+
|
|
15178
|
+
def initialize(phase_ctxt)
|
|
15179
|
+
super
|
|
15180
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
15181
|
+
trav.enter_kandr_function_definition += T(:check)
|
|
15182
|
+
end
|
|
15183
|
+
|
|
15184
|
+
def check(node)
|
|
15185
|
+
if node.type.parameter_types.any? { |type| type.void? }
|
|
15186
|
+
W(node.location)
|
|
15187
|
+
end
|
|
15188
|
+
end
|
|
15189
|
+
end
|
|
15190
|
+
|
|
15097
15191
|
class W0646 < PassiveCodeCheck
|
|
15098
15192
|
def_registrant_phase Cc1::Prepare1Phase
|
|
15099
15193
|
|
|
@@ -15868,6 +15962,52 @@ module CBuiltin #:nodoc:
|
|
|
15868
15962
|
end
|
|
15869
15963
|
end
|
|
15870
15964
|
|
|
15965
|
+
class W0685 < W0573
|
|
15966
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
15967
|
+
|
|
15968
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
15969
|
+
# step-in analysis is supported.
|
|
15970
|
+
mark_as_unique
|
|
15971
|
+
|
|
15972
|
+
def check(funcall_expr, fun, arg_vars, *)
|
|
15973
|
+
if fun.named? && fun.name =~ /\A.*scanf\z/
|
|
15974
|
+
fmt = create_format(funcall_expr, format_str_index_of(funcall_expr),
|
|
15975
|
+
arg_vars, @environ)
|
|
15976
|
+
return unless fmt
|
|
15977
|
+
|
|
15978
|
+
fmt.conversion_specifiers.each do |conv_spec|
|
|
15979
|
+
if conv_spec.scanset
|
|
15980
|
+
conv_spec.scanset.scan(/(.)-(.)/).each do |lhs, rhs|
|
|
15981
|
+
W(fmt.location) if lhs.ord > rhs.ord
|
|
15982
|
+
end
|
|
15983
|
+
end
|
|
15984
|
+
end
|
|
15985
|
+
end
|
|
15986
|
+
end
|
|
15987
|
+
end
|
|
15988
|
+
|
|
15989
|
+
class W0686 < W0573
|
|
15990
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
15991
|
+
|
|
15992
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
15993
|
+
# step-in analysis is supported.
|
|
15994
|
+
mark_as_unique
|
|
15995
|
+
|
|
15996
|
+
def check(funcall_expr, fun, arg_vars, *)
|
|
15997
|
+
if fun.named? && fun.name =~ /\A.*scanf\z/
|
|
15998
|
+
fmt = create_format(funcall_expr, format_str_index_of(funcall_expr),
|
|
15999
|
+
arg_vars, @environ)
|
|
16000
|
+
return unless fmt
|
|
16001
|
+
|
|
16002
|
+
fmt.conversion_specifiers.each do |conv_spec|
|
|
16003
|
+
if conv_spec.scanset
|
|
16004
|
+
W(fmt.location) unless conv_spec.valid_scanset?
|
|
16005
|
+
end
|
|
16006
|
+
end
|
|
16007
|
+
end
|
|
16008
|
+
end
|
|
16009
|
+
end
|
|
16010
|
+
|
|
15871
16011
|
class W0694 < PassiveCodeCheck
|
|
15872
16012
|
def_registrant_phase Cc1::Prepare2Phase
|
|
15873
16013
|
|
|
@@ -15887,6 +16027,138 @@ module CBuiltin #:nodoc:
|
|
|
15887
16027
|
end
|
|
15888
16028
|
end
|
|
15889
16029
|
|
|
16030
|
+
class W0697 < PassiveCodeCheck
|
|
16031
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
16032
|
+
|
|
16033
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
16034
|
+
# step-in analysis is supported.
|
|
16035
|
+
mark_as_unique
|
|
16036
|
+
|
|
16037
|
+
def initialize(phase_ctxt)
|
|
16038
|
+
super
|
|
16039
|
+
interp = phase_ctxt[:cc1_interpreter]
|
|
16040
|
+
interp.on_function_started += T(:start_function)
|
|
16041
|
+
interp.on_function_ended += T(:end_function)
|
|
16042
|
+
interp.on_implicit_return_evaled += M(:check_implicit_return)
|
|
16043
|
+
@cur_fun = nil
|
|
16044
|
+
end
|
|
16045
|
+
|
|
16046
|
+
private
|
|
16047
|
+
def start_function(fun_def, *)
|
|
16048
|
+
@cur_fun = fun_def
|
|
16049
|
+
end
|
|
16050
|
+
|
|
16051
|
+
def end_function(*)
|
|
16052
|
+
@cur_fun = nil
|
|
16053
|
+
end
|
|
16054
|
+
|
|
16055
|
+
def check_implicit_return(loc)
|
|
16056
|
+
if @cur_fun && loc.in_analysis_target?(traits)
|
|
16057
|
+
unless @cur_fun.type.return_type.void?
|
|
16058
|
+
W(@cur_fun.location, @cur_fun.identifier.value)
|
|
16059
|
+
end
|
|
16060
|
+
end
|
|
16061
|
+
end
|
|
16062
|
+
end
|
|
16063
|
+
|
|
16064
|
+
class W0698 < PassiveCodeCheck
|
|
16065
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
16066
|
+
|
|
16067
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
16068
|
+
# step-in analysis is supported.
|
|
16069
|
+
mark_as_unique
|
|
16070
|
+
|
|
16071
|
+
def initialize(phase_ctxt)
|
|
16072
|
+
super
|
|
16073
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
16074
|
+
trav.enter_ansi_function_definition += T(:start_function)
|
|
16075
|
+
trav.enter_kandr_function_definition += T(:start_function)
|
|
16076
|
+
trav.leave_ansi_function_definition += T(:end_function)
|
|
16077
|
+
trav.leave_kandr_function_definition += T(:end_function)
|
|
16078
|
+
trav.enter_return_statement += T(:check)
|
|
16079
|
+
@cur_fun = nil
|
|
16080
|
+
end
|
|
16081
|
+
|
|
16082
|
+
private
|
|
16083
|
+
def start_function(fun_def)
|
|
16084
|
+
@cur_fun = fun_def
|
|
16085
|
+
end
|
|
16086
|
+
|
|
16087
|
+
def end_function(*)
|
|
16088
|
+
@cur_fun = nil
|
|
16089
|
+
end
|
|
16090
|
+
|
|
16091
|
+
def check(ret_stmt)
|
|
16092
|
+
return unless @cur_fun.explicitly_typed?
|
|
16093
|
+
|
|
16094
|
+
if ret_type = @cur_fun.type.return_type
|
|
16095
|
+
if !ret_type.void? && ret_stmt.expression.nil?
|
|
16096
|
+
W(ret_stmt.location, @cur_fun.identifier.value)
|
|
16097
|
+
end
|
|
16098
|
+
end
|
|
16099
|
+
end
|
|
16100
|
+
end
|
|
16101
|
+
|
|
16102
|
+
class W0699 < W0698
|
|
16103
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
16104
|
+
|
|
16105
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
16106
|
+
# step-in analysis is supported.
|
|
16107
|
+
mark_as_unique
|
|
16108
|
+
|
|
16109
|
+
private
|
|
16110
|
+
def check(ret_stmt)
|
|
16111
|
+
return unless @cur_fun.implicitly_typed?
|
|
16112
|
+
|
|
16113
|
+
if ret_stmt.expression.nil?
|
|
16114
|
+
W(ret_stmt.location, @cur_fun.identifier.value)
|
|
16115
|
+
end
|
|
16116
|
+
end
|
|
16117
|
+
end
|
|
16118
|
+
|
|
16119
|
+
class W0700 < PassiveCodeCheck
|
|
16120
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
16121
|
+
|
|
16122
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
16123
|
+
# step-in analysis is supported.
|
|
16124
|
+
mark_as_unique
|
|
16125
|
+
|
|
16126
|
+
def initialize(phase_ctxt)
|
|
16127
|
+
super
|
|
16128
|
+
interp = phase_ctxt[:cc1_interpreter]
|
|
16129
|
+
interp.on_function_started += T(:start_function)
|
|
16130
|
+
interp.on_function_ended += T(:end_function)
|
|
16131
|
+
interp.on_return_stmt_evaled += T(:check_explicit_return)
|
|
16132
|
+
interp.on_implicit_return_evaled += M(:check_implicit_return)
|
|
16133
|
+
@cur_fun = nil
|
|
16134
|
+
end
|
|
16135
|
+
|
|
16136
|
+
private
|
|
16137
|
+
def start_function(fun_def, *)
|
|
16138
|
+
@cur_fun = fun_def
|
|
16139
|
+
end
|
|
16140
|
+
|
|
16141
|
+
def end_function(*)
|
|
16142
|
+
@cur_fun = nil
|
|
16143
|
+
end
|
|
16144
|
+
|
|
16145
|
+
def check_explicit_return(ret_stmt, *)
|
|
16146
|
+
if @cur_fun
|
|
16147
|
+
if @cur_fun.implicitly_typed? && ret_stmt.expression.nil?
|
|
16148
|
+
W(@cur_fun.location, @cur_fun.identifier.value)
|
|
16149
|
+
end
|
|
16150
|
+
end
|
|
16151
|
+
end
|
|
16152
|
+
|
|
16153
|
+
def check_implicit_return(loc)
|
|
16154
|
+
if @cur_fun && loc.in_analysis_target?(traits)
|
|
16155
|
+
if @cur_fun.implicitly_typed?
|
|
16156
|
+
W(@cur_fun.location, @cur_fun.identifier.value)
|
|
16157
|
+
end
|
|
16158
|
+
end
|
|
16159
|
+
end
|
|
16160
|
+
end
|
|
16161
|
+
|
|
15890
16162
|
class W0703 < PassiveCodeCheck
|
|
15891
16163
|
def_registrant_phase Cc1::Prepare2Phase
|
|
15892
16164
|
|
|
@@ -16181,7 +16453,7 @@ module CBuiltin #:nodoc:
|
|
|
16181
16453
|
return unless ary
|
|
16182
16454
|
|
|
16183
16455
|
unless constant_expression?(subs_expr)
|
|
16184
|
-
subs = interpret(subs_expr,
|
|
16456
|
+
subs = interpret(subs_expr, QUIET, WITHOUT_SIDE_EFFECTS)
|
|
16185
16457
|
warn_array_oob_access(expr.operand, ary, subs)
|
|
16186
16458
|
end
|
|
16187
16459
|
end
|
|
@@ -16943,65 +17215,215 @@ module CBuiltin #:nodoc:
|
|
|
16943
17215
|
private_constant :Visitor
|
|
16944
17216
|
end
|
|
16945
17217
|
|
|
16946
|
-
class
|
|
17218
|
+
class W0711 < PassiveCodeCheck
|
|
16947
17219
|
def_registrant_phase Cc1::Prepare2Phase
|
|
16948
17220
|
|
|
16949
|
-
include Cc1::InterpreterMediator
|
|
16950
|
-
|
|
16951
17221
|
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
16952
17222
|
# step-in analysis is supported.
|
|
16953
17223
|
mark_as_unique
|
|
16954
17224
|
|
|
16955
17225
|
def initialize(phase_ctxt)
|
|
16956
17226
|
super
|
|
16957
|
-
|
|
16958
|
-
|
|
17227
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
17228
|
+
trav.enter_relational_expression += T(:check)
|
|
16959
17229
|
end
|
|
16960
17230
|
|
|
16961
17231
|
private
|
|
16962
|
-
def check(expr
|
|
16963
|
-
if
|
|
16964
|
-
|
|
16965
|
-
underlying_bit_size = scalar_value_of(underlying_type.bit_size)
|
|
16966
|
-
promoted_type = lhs_var.type.integer_promoted_type
|
|
16967
|
-
promoted_bit_size = scalar_value_of(promoted_type.bit_size)
|
|
16968
|
-
|
|
16969
|
-
rhs_val = rhs_var.value
|
|
16970
|
-
if rhs_val.test_must_be_equal_to(underlying_bit_size).true? ||
|
|
16971
|
-
rhs_val.test_must_be_greater_than(underlying_bit_size).true? and
|
|
16972
|
-
rhs_val.test_must_be_less_than(promoted_bit_size).true?
|
|
16973
|
-
W(expr.location, underlying_type.brief_image)
|
|
16974
|
-
end
|
|
17232
|
+
def check(expr)
|
|
17233
|
+
if !expr.lhs_operand.logical? && expr.rhs_operand.logical?
|
|
17234
|
+
W(expr.rhs_operand.location)
|
|
16975
17235
|
end
|
|
16976
17236
|
end
|
|
16977
|
-
|
|
16978
|
-
def interpreter
|
|
16979
|
-
@interp
|
|
16980
|
-
end
|
|
16981
17237
|
end
|
|
16982
17238
|
|
|
16983
|
-
class
|
|
17239
|
+
class W0712 < W0711
|
|
16984
17240
|
def_registrant_phase Cc1::Prepare2Phase
|
|
16985
17241
|
|
|
16986
|
-
include Cc1::InterpreterMediator
|
|
16987
|
-
|
|
16988
17242
|
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
16989
17243
|
# step-in analysis is supported.
|
|
16990
17244
|
mark_as_unique
|
|
16991
17245
|
|
|
16992
|
-
|
|
16993
|
-
|
|
16994
|
-
|
|
16995
|
-
|
|
17246
|
+
private
|
|
17247
|
+
def check(expr)
|
|
17248
|
+
if expr.lhs_operand.logical? && !expr.rhs_operand.logical?
|
|
17249
|
+
W(expr.lhs_operand.location)
|
|
17250
|
+
end
|
|
16996
17251
|
end
|
|
17252
|
+
end
|
|
16997
17253
|
|
|
16998
|
-
|
|
16999
|
-
|
|
17000
|
-
orig_type = orig_var.type
|
|
17001
|
-
rslt_type = rslt_var.type
|
|
17254
|
+
class W0713 < W0711
|
|
17255
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
17002
17256
|
|
|
17003
|
-
|
|
17004
|
-
|
|
17257
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
17258
|
+
# step-in analysis is supported.
|
|
17259
|
+
mark_as_unique
|
|
17260
|
+
|
|
17261
|
+
private
|
|
17262
|
+
def check(expr)
|
|
17263
|
+
if expr.lhs_operand.logical? && expr.rhs_operand.logical?
|
|
17264
|
+
W(expr.location)
|
|
17265
|
+
end
|
|
17266
|
+
end
|
|
17267
|
+
end
|
|
17268
|
+
|
|
17269
|
+
class W0714 < PassiveCodeCheck
|
|
17270
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
17271
|
+
|
|
17272
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
17273
|
+
# step-in analysis is supported.
|
|
17274
|
+
mark_as_unique
|
|
17275
|
+
|
|
17276
|
+
def initialize(phase_ctxt)
|
|
17277
|
+
super
|
|
17278
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
17279
|
+
trav.enter_and_expression += T(:check)
|
|
17280
|
+
end
|
|
17281
|
+
|
|
17282
|
+
private
|
|
17283
|
+
def check(expr)
|
|
17284
|
+
if expr.lhs_operand.logical? && expr.rhs_operand.logical?
|
|
17285
|
+
W(expr.location)
|
|
17286
|
+
end
|
|
17287
|
+
end
|
|
17288
|
+
end
|
|
17289
|
+
|
|
17290
|
+
class W0715 < PassiveCodeCheck
|
|
17291
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
17292
|
+
|
|
17293
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
17294
|
+
# step-in analysis is supported.
|
|
17295
|
+
mark_as_unique
|
|
17296
|
+
|
|
17297
|
+
def initialize(phase_ctxt)
|
|
17298
|
+
super
|
|
17299
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
17300
|
+
trav.enter_inclusive_or_expression += T(:check)
|
|
17301
|
+
end
|
|
17302
|
+
|
|
17303
|
+
private
|
|
17304
|
+
def check(expr)
|
|
17305
|
+
if expr.lhs_operand.logical? && expr.rhs_operand.logical?
|
|
17306
|
+
W(expr.location)
|
|
17307
|
+
end
|
|
17308
|
+
end
|
|
17309
|
+
end
|
|
17310
|
+
|
|
17311
|
+
class W0716 < PassiveCodeCheck
|
|
17312
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
17313
|
+
|
|
17314
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
17315
|
+
# step-in analysis is supported.
|
|
17316
|
+
mark_as_unique
|
|
17317
|
+
|
|
17318
|
+
def initialize(phase_ctxt)
|
|
17319
|
+
super
|
|
17320
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
17321
|
+
trav.enter_additive_expression += T(:check)
|
|
17322
|
+
trav.enter_multiplicative_expression += T(:check)
|
|
17323
|
+
trav.enter_shift_expression += T(:check)
|
|
17324
|
+
trav.enter_and_expression += T(:check)
|
|
17325
|
+
trav.enter_exclusive_or_expression += T(:check)
|
|
17326
|
+
trav.enter_inclusive_or_expression += T(:check)
|
|
17327
|
+
trav.enter_compound_assignment_expression += T(:check)
|
|
17328
|
+
end
|
|
17329
|
+
|
|
17330
|
+
private
|
|
17331
|
+
def check(expr)
|
|
17332
|
+
if expr.lhs_operand.logical? && expr.rhs_operand.logical?
|
|
17333
|
+
W(expr.location)
|
|
17334
|
+
end
|
|
17335
|
+
end
|
|
17336
|
+
end
|
|
17337
|
+
|
|
17338
|
+
class W0717 < W0716
|
|
17339
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
17340
|
+
|
|
17341
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
17342
|
+
# step-in analysis is supported.
|
|
17343
|
+
mark_as_unique
|
|
17344
|
+
|
|
17345
|
+
private
|
|
17346
|
+
def check(expr)
|
|
17347
|
+
if expr.lhs_operand.logical? && !expr.rhs_operand.logical?
|
|
17348
|
+
W(expr.lhs_operand.location)
|
|
17349
|
+
end
|
|
17350
|
+
end
|
|
17351
|
+
end
|
|
17352
|
+
|
|
17353
|
+
class W0718 < W0716
|
|
17354
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
17355
|
+
|
|
17356
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
17357
|
+
# step-in analysis is supported.
|
|
17358
|
+
mark_as_unique
|
|
17359
|
+
|
|
17360
|
+
private
|
|
17361
|
+
def check(expr)
|
|
17362
|
+
if !expr.lhs_operand.logical? && expr.rhs_operand.logical?
|
|
17363
|
+
W(expr.rhs_operand.location)
|
|
17364
|
+
end
|
|
17365
|
+
end
|
|
17366
|
+
end
|
|
17367
|
+
|
|
17368
|
+
class W0719 < PassiveCodeCheck
|
|
17369
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
17370
|
+
|
|
17371
|
+
include Cc1::InterpreterMediator
|
|
17372
|
+
|
|
17373
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
17374
|
+
# step-in analysis is supported.
|
|
17375
|
+
mark_as_unique
|
|
17376
|
+
|
|
17377
|
+
def initialize(phase_ctxt)
|
|
17378
|
+
super
|
|
17379
|
+
@interp = phase_ctxt[:cc1_interpreter]
|
|
17380
|
+
@interp.on_shift_expr_evaled += T(:check)
|
|
17381
|
+
end
|
|
17382
|
+
|
|
17383
|
+
private
|
|
17384
|
+
def check(expr, lhs_var, rhs_var, *)
|
|
17385
|
+
if constant_expression?(expr.rhs_operand)
|
|
17386
|
+
underlying_type = lhs_var.type
|
|
17387
|
+
underlying_bit_size = scalar_value_of(underlying_type.bit_size)
|
|
17388
|
+
promoted_type = lhs_var.type.integer_promoted_type
|
|
17389
|
+
promoted_bit_size = scalar_value_of(promoted_type.bit_size)
|
|
17390
|
+
|
|
17391
|
+
rhs_val = rhs_var.value
|
|
17392
|
+
if rhs_val.test_must_be_equal_to(underlying_bit_size).true? ||
|
|
17393
|
+
rhs_val.test_must_be_greater_than(underlying_bit_size).true? and
|
|
17394
|
+
rhs_val.test_must_be_less_than(promoted_bit_size).true?
|
|
17395
|
+
W(expr.location, underlying_type.brief_image)
|
|
17396
|
+
end
|
|
17397
|
+
end
|
|
17398
|
+
end
|
|
17399
|
+
|
|
17400
|
+
def interpreter
|
|
17401
|
+
@interp
|
|
17402
|
+
end
|
|
17403
|
+
end
|
|
17404
|
+
|
|
17405
|
+
class W0720 < PassiveCodeCheck
|
|
17406
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
17407
|
+
|
|
17408
|
+
include Cc1::InterpreterMediator
|
|
17409
|
+
|
|
17410
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
17411
|
+
# step-in analysis is supported.
|
|
17412
|
+
mark_as_unique
|
|
17413
|
+
|
|
17414
|
+
def initialize(phase_ctxt)
|
|
17415
|
+
super
|
|
17416
|
+
@interp = phase_ctxt[:cc1_interpreter]
|
|
17417
|
+
@interp.on_explicit_conv_performed += T(:check)
|
|
17418
|
+
end
|
|
17419
|
+
|
|
17420
|
+
private
|
|
17421
|
+
def check(expr, orig_var, rslt_var)
|
|
17422
|
+
orig_type = orig_var.type
|
|
17423
|
+
rslt_type = rslt_var.type
|
|
17424
|
+
|
|
17425
|
+
unless orig_type.scalar? && orig_type.floating? &&
|
|
17426
|
+
rslt_type.scalar? && rslt_type.integer?
|
|
17005
17427
|
return
|
|
17006
17428
|
end
|
|
17007
17429
|
|
|
@@ -17155,6 +17577,25 @@ module CBuiltin #:nodoc:
|
|
|
17155
17577
|
end
|
|
17156
17578
|
end
|
|
17157
17579
|
|
|
17580
|
+
class W0726 < W0698
|
|
17581
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
17582
|
+
|
|
17583
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
17584
|
+
# step-in analysis is supported.
|
|
17585
|
+
mark_as_unique
|
|
17586
|
+
|
|
17587
|
+
private
|
|
17588
|
+
def check(ret_stmt)
|
|
17589
|
+
if ret_stmt.expression
|
|
17590
|
+
if ret_type = @cur_fun.type.return_type
|
|
17591
|
+
if ret_type.void? && (ret_type.const? || ret_type.volatile?)
|
|
17592
|
+
W(ret_stmt.location, @cur_fun.identifier.value)
|
|
17593
|
+
end
|
|
17594
|
+
end
|
|
17595
|
+
end
|
|
17596
|
+
end
|
|
17597
|
+
end
|
|
17598
|
+
|
|
17158
17599
|
class W0727 < PassiveCodeCheck
|
|
17159
17600
|
def_registrant_phase Cc1::Prepare2Phase
|
|
17160
17601
|
|
|
@@ -17329,6 +17770,93 @@ module CBuiltin #:nodoc:
|
|
|
17329
17770
|
end
|
|
17330
17771
|
end
|
|
17331
17772
|
|
|
17773
|
+
class W0732 < PassiveCodeCheck
|
|
17774
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
17775
|
+
|
|
17776
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
17777
|
+
# step-in analysis is supported.
|
|
17778
|
+
mark_as_unique
|
|
17779
|
+
|
|
17780
|
+
def initialize(phase_ctxt)
|
|
17781
|
+
super
|
|
17782
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
17783
|
+
trav.enter_logical_and_expression += T(:check)
|
|
17784
|
+
end
|
|
17785
|
+
|
|
17786
|
+
private
|
|
17787
|
+
def check(expr)
|
|
17788
|
+
if expr.lhs_operand.arithmetic? || expr.lhs_operand.bitwise?
|
|
17789
|
+
if expr.rhs_operand.arithmetic? || expr.rhs_operand.bitwise?
|
|
17790
|
+
W(expr.location)
|
|
17791
|
+
end
|
|
17792
|
+
end
|
|
17793
|
+
end
|
|
17794
|
+
end
|
|
17795
|
+
|
|
17796
|
+
class W0733 < PassiveCodeCheck
|
|
17797
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
17798
|
+
|
|
17799
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
17800
|
+
# step-in analysis is supported.
|
|
17801
|
+
mark_as_unique
|
|
17802
|
+
|
|
17803
|
+
def initialize(phase_ctxt)
|
|
17804
|
+
super
|
|
17805
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
17806
|
+
trav.enter_logical_or_expression += T(:check)
|
|
17807
|
+
end
|
|
17808
|
+
|
|
17809
|
+
private
|
|
17810
|
+
def check(expr)
|
|
17811
|
+
if expr.lhs_operand.arithmetic? || expr.lhs_operand.bitwise?
|
|
17812
|
+
if expr.rhs_operand.arithmetic? || expr.rhs_operand.bitwise?
|
|
17813
|
+
W(expr.location)
|
|
17814
|
+
end
|
|
17815
|
+
end
|
|
17816
|
+
end
|
|
17817
|
+
end
|
|
17818
|
+
|
|
17819
|
+
class W0734 < PassiveCodeCheck
|
|
17820
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
17821
|
+
|
|
17822
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
17823
|
+
# step-in analysis is supported.
|
|
17824
|
+
mark_as_unique
|
|
17825
|
+
|
|
17826
|
+
def initialize(phase_ctxt)
|
|
17827
|
+
super
|
|
17828
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
17829
|
+
trav.enter_logical_and_expression += T(:check)
|
|
17830
|
+
trav.enter_logical_or_expression += T(:check)
|
|
17831
|
+
end
|
|
17832
|
+
|
|
17833
|
+
private
|
|
17834
|
+
def check(expr)
|
|
17835
|
+
if expr.lhs_operand.arithmetic? || expr.lhs_operand.bitwise?
|
|
17836
|
+
unless expr.rhs_operand.arithmetic? || expr.rhs_operand.bitwise?
|
|
17837
|
+
W(expr.lhs_operand.location)
|
|
17838
|
+
end
|
|
17839
|
+
end
|
|
17840
|
+
end
|
|
17841
|
+
end
|
|
17842
|
+
|
|
17843
|
+
class W0735 < W0734
|
|
17844
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
17845
|
+
|
|
17846
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
17847
|
+
# step-in analysis is supported.
|
|
17848
|
+
mark_as_unique
|
|
17849
|
+
|
|
17850
|
+
private
|
|
17851
|
+
def check(expr)
|
|
17852
|
+
if expr.rhs_operand.arithmetic? || expr.rhs_operand.bitwise?
|
|
17853
|
+
unless expr.lhs_operand.arithmetic? || expr.lhs_operand.bitwise?
|
|
17854
|
+
W(expr.rhs_operand.location)
|
|
17855
|
+
end
|
|
17856
|
+
end
|
|
17857
|
+
end
|
|
17858
|
+
end
|
|
17859
|
+
|
|
17332
17860
|
class W0736 < PassiveCodeCheck
|
|
17333
17861
|
def_registrant_phase Cc1::Prepare2Phase
|
|
17334
17862
|
|
|
@@ -17750,7 +18278,7 @@ module CBuiltin #:nodoc:
|
|
|
17750
18278
|
return unless ary
|
|
17751
18279
|
|
|
17752
18280
|
unless constant_expression?(subs_expr)
|
|
17753
|
-
subs = interpret(subs_expr,
|
|
18281
|
+
subs = interpret(subs_expr, QUIET, WITHOUT_SIDE_EFFECTS)
|
|
17754
18282
|
warn_array_oob_access(expr.operand, ary, subs)
|
|
17755
18283
|
end
|
|
17756
18284
|
end
|
|
@@ -18665,6 +19193,40 @@ module CBuiltin #:nodoc:
|
|
|
18665
19193
|
end
|
|
18666
19194
|
end
|
|
18667
19195
|
|
|
19196
|
+
class W0781 < PassiveCodeCheck
|
|
19197
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
19198
|
+
|
|
19199
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
19200
|
+
# step-in analysis is supported.
|
|
19201
|
+
mark_as_unique
|
|
19202
|
+
|
|
19203
|
+
def initialize(phase_ctxt)
|
|
19204
|
+
super
|
|
19205
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
19206
|
+
trav.enter_switch_statement += T(:enter_switch_statement)
|
|
19207
|
+
trav.leave_switch_statement += T(:check)
|
|
19208
|
+
trav.enter_case_labeled_statement += T(:add_exec_path)
|
|
19209
|
+
trav.enter_default_labeled_statement += T(:add_exec_path)
|
|
19210
|
+
@exec_path_nums = []
|
|
19211
|
+
end
|
|
19212
|
+
|
|
19213
|
+
private
|
|
19214
|
+
def enter_switch_statement(*)
|
|
19215
|
+
@exec_path_nums.push(0)
|
|
19216
|
+
end
|
|
19217
|
+
|
|
19218
|
+
def check(node)
|
|
19219
|
+
if exec_path_num = @exec_path_nums.last and exec_path_num < 2
|
|
19220
|
+
W(node.location)
|
|
19221
|
+
end
|
|
19222
|
+
@exec_path_nums.pop
|
|
19223
|
+
end
|
|
19224
|
+
|
|
19225
|
+
def add_exec_path(node)
|
|
19226
|
+
@exec_path_nums[-1] += 1 if node.executed?
|
|
19227
|
+
end
|
|
19228
|
+
end
|
|
19229
|
+
|
|
18668
19230
|
class W0783 < PassiveCodeCheck
|
|
18669
19231
|
def_registrant_phase Cc1::Prepare2Phase
|
|
18670
19232
|
|
|
@@ -18731,9 +19293,9 @@ module CBuiltin #:nodoc:
|
|
|
18731
19293
|
|
|
18732
19294
|
def initialize(phase_ctxt)
|
|
18733
19295
|
super
|
|
18734
|
-
|
|
18735
|
-
|
|
18736
|
-
|
|
19296
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
19297
|
+
trav.enter_struct_type_declaration += T(:check)
|
|
19298
|
+
trav.enter_union_type_declaration += T(:check)
|
|
18737
19299
|
@interp = phase_ctxt[:cc1_interpreter]
|
|
18738
19300
|
end
|
|
18739
19301
|
|
|
@@ -18769,12 +19331,12 @@ module CBuiltin #:nodoc:
|
|
|
18769
19331
|
def initialize(phase_ctxt)
|
|
18770
19332
|
super
|
|
18771
19333
|
interp = phase_ctxt[:cc1_interpreter]
|
|
18772
|
-
interp.on_variable_declared += T(:
|
|
18773
|
-
interp.on_variable_defined += T(:
|
|
18774
|
-
interp.on_explicit_function_declared += T(:
|
|
18775
|
-
interp.on_explicit_function_defined += T(:
|
|
18776
|
-
interp.on_typedef_declared += T(:
|
|
18777
|
-
interp.on_enum_declared += T(:
|
|
19334
|
+
interp.on_variable_declared += T(:check_object_dcl)
|
|
19335
|
+
interp.on_variable_defined += T(:check_object_dcl)
|
|
19336
|
+
interp.on_explicit_function_declared += T(:check_object_dcl)
|
|
19337
|
+
interp.on_explicit_function_defined += T(:check_object_dcl)
|
|
19338
|
+
interp.on_typedef_declared += T(:check_typedef_dcl)
|
|
19339
|
+
interp.on_enum_declared += T(:check_enum_dcl)
|
|
18778
19340
|
interp.on_block_started += T(:enter_scope)
|
|
18779
19341
|
interp.on_block_ended += T(:leave_scope)
|
|
18780
19342
|
|
|
@@ -18788,7 +19350,7 @@ module CBuiltin #:nodoc:
|
|
|
18788
19350
|
end
|
|
18789
19351
|
|
|
18790
19352
|
private
|
|
18791
|
-
def
|
|
19353
|
+
def check_object_dcl(obj_dcl, obj)
|
|
18792
19354
|
return unless obj.declared_as_extern?
|
|
18793
19355
|
|
|
18794
19356
|
name = obj_dcl.identifier.value
|
|
@@ -18807,7 +19369,7 @@ module CBuiltin #:nodoc:
|
|
|
18807
19369
|
@obj_dcls.last[name].push(obj_dcl)
|
|
18808
19370
|
end
|
|
18809
19371
|
|
|
18810
|
-
def
|
|
19372
|
+
def check_typedef_dcl(typedef_dcl)
|
|
18811
19373
|
name = typedef_dcl.identifier.value
|
|
18812
19374
|
type = typedef_dcl.type
|
|
18813
19375
|
|
|
@@ -18825,7 +19387,7 @@ module CBuiltin #:nodoc:
|
|
|
18825
19387
|
@typedef_dcls.last[name].push(typedef_dcl)
|
|
18826
19388
|
end
|
|
18827
19389
|
|
|
18828
|
-
def
|
|
19390
|
+
def check_enum_dcl(enum_dcl)
|
|
18829
19391
|
enum_dcl.enumerators.each { |enum| check_enumerator(enum) }
|
|
18830
19392
|
end
|
|
18831
19393
|
|
|
@@ -18879,12 +19441,12 @@ module CBuiltin #:nodoc:
|
|
|
18879
19441
|
def initialize(phase_ctxt)
|
|
18880
19442
|
super
|
|
18881
19443
|
interp = phase_ctxt[:cc1_interpreter]
|
|
18882
|
-
interp.on_variable_declared += T(:
|
|
18883
|
-
interp.on_variable_defined += T(:
|
|
18884
|
-
interp.on_explicit_function_declared += T(:
|
|
18885
|
-
interp.on_explicit_function_defined += T(:
|
|
18886
|
-
interp.on_typedef_declared += T(:
|
|
18887
|
-
interp.on_enum_declared += T(:
|
|
19444
|
+
interp.on_variable_declared += T(:check_object_dcl)
|
|
19445
|
+
interp.on_variable_defined += T(:check_object_dcl)
|
|
19446
|
+
interp.on_explicit_function_declared += T(:check_object_dcl)
|
|
19447
|
+
interp.on_explicit_function_defined += T(:check_object_dcl)
|
|
19448
|
+
interp.on_typedef_declared += T(:check_typedef_dcl)
|
|
19449
|
+
interp.on_enum_declared += T(:check_enum_dcl)
|
|
18888
19450
|
interp.on_block_started += T(:enter_scope)
|
|
18889
19451
|
interp.on_block_ended += T(:leave_scope)
|
|
18890
19452
|
|
|
@@ -18894,7 +19456,7 @@ module CBuiltin #:nodoc:
|
|
|
18894
19456
|
end
|
|
18895
19457
|
|
|
18896
19458
|
private
|
|
18897
|
-
def
|
|
19459
|
+
def check_object_dcl(obj_dcl, *)
|
|
18898
19460
|
name = obj_dcl.identifier.value
|
|
18899
19461
|
type = obj_dcl.type
|
|
18900
19462
|
|
|
@@ -18910,7 +19472,7 @@ module CBuiltin #:nodoc:
|
|
|
18910
19472
|
@obj_dcls.last[name].push(obj_dcl)
|
|
18911
19473
|
end
|
|
18912
19474
|
|
|
18913
|
-
def
|
|
19475
|
+
def check_typedef_dcl(typedef_dcl)
|
|
18914
19476
|
name = typedef_dcl.identifier.value
|
|
18915
19477
|
type = typedef_dcl.type
|
|
18916
19478
|
|
|
@@ -18927,7 +19489,7 @@ module CBuiltin #:nodoc:
|
|
|
18927
19489
|
@typedef_dcls.last[name].push(typedef_dcl)
|
|
18928
19490
|
end
|
|
18929
19491
|
|
|
18930
|
-
def
|
|
19492
|
+
def check_enum_dcl(enum_dcl)
|
|
18931
19493
|
enum_dcl.enumerators.each { |enum| check_enumerator(enum) }
|
|
18932
19494
|
end
|
|
18933
19495
|
|
|
@@ -18969,12 +19531,12 @@ module CBuiltin #:nodoc:
|
|
|
18969
19531
|
def initialize(phase_ctxt)
|
|
18970
19532
|
super
|
|
18971
19533
|
interp = phase_ctxt[:cc1_interpreter]
|
|
18972
|
-
interp.on_variable_declared += T(:
|
|
18973
|
-
interp.on_variable_defined += T(:
|
|
18974
|
-
interp.on_explicit_function_declared += T(:
|
|
18975
|
-
interp.on_explicit_function_defined += T(:
|
|
18976
|
-
interp.on_typedef_declared += T(:
|
|
18977
|
-
interp.on_enum_declared += T(:
|
|
19534
|
+
interp.on_variable_declared += T(:check_object_dcl)
|
|
19535
|
+
interp.on_variable_defined += T(:check_object_dcl)
|
|
19536
|
+
interp.on_explicit_function_declared += T(:check_object_dcl)
|
|
19537
|
+
interp.on_explicit_function_defined += T(:check_object_dcl)
|
|
19538
|
+
interp.on_typedef_declared += T(:check_typedef_dcl)
|
|
19539
|
+
interp.on_enum_declared += T(:check_enum_dcl)
|
|
18978
19540
|
interp.on_block_started += T(:enter_scope)
|
|
18979
19541
|
interp.on_block_ended += T(:leave_scope)
|
|
18980
19542
|
|
|
@@ -18984,7 +19546,7 @@ module CBuiltin #:nodoc:
|
|
|
18984
19546
|
end
|
|
18985
19547
|
|
|
18986
19548
|
private
|
|
18987
|
-
def
|
|
19549
|
+
def check_object_dcl(obj_dcl, *)
|
|
18988
19550
|
name = obj_dcl.identifier.value
|
|
18989
19551
|
type = obj_dcl.type
|
|
18990
19552
|
|
|
@@ -19002,7 +19564,7 @@ module CBuiltin #:nodoc:
|
|
|
19002
19564
|
@obj_dcls.last[name].push(obj_dcl)
|
|
19003
19565
|
end
|
|
19004
19566
|
|
|
19005
|
-
def
|
|
19567
|
+
def check_typedef_dcl(typedef_dcl)
|
|
19006
19568
|
name = typedef_dcl.identifier.value
|
|
19007
19569
|
type = typedef_dcl.type
|
|
19008
19570
|
|
|
@@ -19020,7 +19582,7 @@ module CBuiltin #:nodoc:
|
|
|
19020
19582
|
@typedef_dcls.last[name].push(typedef_dcl)
|
|
19021
19583
|
end
|
|
19022
19584
|
|
|
19023
|
-
def
|
|
19585
|
+
def check_enum_dcl(enum_dcl)
|
|
19024
19586
|
enum_dcl.enumerators.each { |enum| check_enumerator(enum) }
|
|
19025
19587
|
end
|
|
19026
19588
|
|
|
@@ -19391,6 +19953,121 @@ module CBuiltin #:nodoc:
|
|
|
19391
19953
|
end
|
|
19392
19954
|
end
|
|
19393
19955
|
|
|
19956
|
+
class W0801 < PassiveCodeCheck
|
|
19957
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
19958
|
+
|
|
19959
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
19960
|
+
# step-in analysis is supported.
|
|
19961
|
+
mark_as_unique
|
|
19962
|
+
|
|
19963
|
+
def initialize(phase_ctxt)
|
|
19964
|
+
super
|
|
19965
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
19966
|
+
trav.enter_struct_type_declaration += T(:check)
|
|
19967
|
+
trav.enter_union_type_declaration += T(:check)
|
|
19968
|
+
end
|
|
19969
|
+
|
|
19970
|
+
private
|
|
19971
|
+
def check(node)
|
|
19972
|
+
W(node.location) if node.type.members.empty?
|
|
19973
|
+
end
|
|
19974
|
+
end
|
|
19975
|
+
|
|
19976
|
+
class W0809 < PassiveCodeCheck
|
|
19977
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
19978
|
+
|
|
19979
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
19980
|
+
# step-in analysis is supported.
|
|
19981
|
+
mark_as_unique
|
|
19982
|
+
|
|
19983
|
+
def initialize(phase_ctxt)
|
|
19984
|
+
super
|
|
19985
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
19986
|
+
trav.enter_function_declaration += T(:check_function_name)
|
|
19987
|
+
trav.enter_variable_declaration += T(:check_variable_name)
|
|
19988
|
+
trav.enter_variable_definition += T(:check_variable_name)
|
|
19989
|
+
trav.enter_parameter_definition += T(:check_variable_name)
|
|
19990
|
+
trav.enter_typedef_declaration += T(:check_typedef_name)
|
|
19991
|
+
trav.enter_struct_type_declaration += T(:check_tag_name)
|
|
19992
|
+
trav.enter_union_type_declaration += T(:check_tag_name)
|
|
19993
|
+
trav.enter_enum_type_declaration += T(:check_tag_name)
|
|
19994
|
+
trav.enter_enumerator += T(:check_enumerator_name)
|
|
19995
|
+
trav.enter_kandr_function_definition += T(:enter_function)
|
|
19996
|
+
trav.enter_ansi_function_definition += T(:enter_function)
|
|
19997
|
+
trav.leave_kandr_function_definition += T(:leave_function)
|
|
19998
|
+
trav.leave_ansi_function_definition += T(:leave_function)
|
|
19999
|
+
@fun_def_level = 0
|
|
20000
|
+
end
|
|
20001
|
+
|
|
20002
|
+
private
|
|
20003
|
+
def check_function_name(fun_dcl)
|
|
20004
|
+
check_object_name(fun_dcl)
|
|
20005
|
+
end
|
|
20006
|
+
|
|
20007
|
+
def check_variable_name(var_dcl_or_def)
|
|
20008
|
+
check_object_name(var_dcl_or_def)
|
|
20009
|
+
end
|
|
20010
|
+
|
|
20011
|
+
def check_typedef_name(typedef_dcl)
|
|
20012
|
+
if typedef_dcl.identifier
|
|
20013
|
+
case name = typedef_dcl.identifier.value
|
|
20014
|
+
when /\A__/, /\A_[A-Z]/, /\A_/
|
|
20015
|
+
W(typedef_dcl.location, name)
|
|
20016
|
+
end
|
|
20017
|
+
end
|
|
20018
|
+
end
|
|
20019
|
+
|
|
20020
|
+
def check_tag_name(type_dcl)
|
|
20021
|
+
if type_dcl.identifier
|
|
20022
|
+
case name = type_dcl.identifier.value
|
|
20023
|
+
when /\A__adlint/
|
|
20024
|
+
# NOTE: To ignore AdLint internal tag names.
|
|
20025
|
+
when /\A__/, /\A_[A-Z]/, /\A_/
|
|
20026
|
+
W(type_dcl.location, name)
|
|
20027
|
+
end
|
|
20028
|
+
end
|
|
20029
|
+
end
|
|
20030
|
+
|
|
20031
|
+
def check_enumerator_name(enum)
|
|
20032
|
+
if enum.identifier
|
|
20033
|
+
case name = enum.identifier.value
|
|
20034
|
+
when /\A__/, /\A_[A-Z]/, /\A_/
|
|
20035
|
+
W(enum.location, name)
|
|
20036
|
+
end
|
|
20037
|
+
end
|
|
20038
|
+
end
|
|
20039
|
+
|
|
20040
|
+
def enter_function(node)
|
|
20041
|
+
check_object_name(node)
|
|
20042
|
+
@fun_def_level += 1
|
|
20043
|
+
end
|
|
20044
|
+
|
|
20045
|
+
def leave_function(node)
|
|
20046
|
+
@fun_def_level -= 1
|
|
20047
|
+
end
|
|
20048
|
+
|
|
20049
|
+
def check_object_name(dcl_or_def)
|
|
20050
|
+
if dcl_or_def.identifier
|
|
20051
|
+
case name = dcl_or_def.identifier.value
|
|
20052
|
+
when /\A__/, /\A_[A-Z]/
|
|
20053
|
+
W(dcl_or_def.location, name)
|
|
20054
|
+
when /\A_/
|
|
20055
|
+
check_filelocal_object_name(name, dcl_or_def)
|
|
20056
|
+
end
|
|
20057
|
+
end
|
|
20058
|
+
end
|
|
20059
|
+
|
|
20060
|
+
def check_filelocal_object_name(name, dcl_or_def)
|
|
20061
|
+
if @fun_def_level == 0
|
|
20062
|
+
if sc_spec = dcl_or_def.storage_class_specifier
|
|
20063
|
+
if sc_spec.type == :STATIC
|
|
20064
|
+
W(dcl_or_def.location, name)
|
|
20065
|
+
end
|
|
20066
|
+
end
|
|
20067
|
+
end
|
|
20068
|
+
end
|
|
20069
|
+
end
|
|
20070
|
+
|
|
19394
20071
|
class W0810 < PassiveCodeCheck
|
|
19395
20072
|
def_registrant_phase Cc1::Prepare2Phase
|
|
19396
20073
|
|
|
@@ -19400,10 +20077,10 @@ module CBuiltin #:nodoc:
|
|
|
19400
20077
|
|
|
19401
20078
|
def initialize(phase_ctxt)
|
|
19402
20079
|
super
|
|
19403
|
-
|
|
19404
|
-
|
|
19405
|
-
|
|
19406
|
-
|
|
20080
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
20081
|
+
trav.enter_if_statement += T(:enter_outer_if_stmt)
|
|
20082
|
+
trav.leave_if_statement += T(:leave_outer_if_stmt)
|
|
20083
|
+
trav.enter_if_else_statement += T(:check_inner_if_else_stmt)
|
|
19407
20084
|
@if_stmt_stack = []
|
|
19408
20085
|
end
|
|
19409
20086
|
|
|
@@ -19433,8 +20110,8 @@ module CBuiltin #:nodoc:
|
|
|
19433
20110
|
|
|
19434
20111
|
def initialize(phase_ctxt)
|
|
19435
20112
|
super
|
|
19436
|
-
|
|
19437
|
-
|
|
20113
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
20114
|
+
trav.enter_variable_definition += T(:enter_variable_definition)
|
|
19438
20115
|
end
|
|
19439
20116
|
|
|
19440
20117
|
private
|
|
@@ -19478,8 +20155,8 @@ module CBuiltin #:nodoc:
|
|
|
19478
20155
|
|
|
19479
20156
|
def initialize(phase_ctxt)
|
|
19480
20157
|
super
|
|
19481
|
-
|
|
19482
|
-
|
|
20158
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
20159
|
+
trav.enter_variable_definition += T(:enter_variable_definition)
|
|
19483
20160
|
end
|
|
19484
20161
|
|
|
19485
20162
|
private
|
|
@@ -19525,8 +20202,8 @@ module CBuiltin #:nodoc:
|
|
|
19525
20202
|
|
|
19526
20203
|
def initialize(phase_ctxt)
|
|
19527
20204
|
super
|
|
19528
|
-
|
|
19529
|
-
|
|
20205
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
20206
|
+
trav.enter_enum_specifier += T(:check)
|
|
19530
20207
|
end
|
|
19531
20208
|
|
|
19532
20209
|
private
|
|
@@ -19568,21 +20245,21 @@ module CBuiltin #:nodoc:
|
|
|
19568
20245
|
|
|
19569
20246
|
def initialize(phase_ctxt)
|
|
19570
20247
|
super
|
|
19571
|
-
|
|
19572
|
-
|
|
19573
|
-
|
|
19574
|
-
|
|
19575
|
-
|
|
19576
|
-
|
|
19577
|
-
|
|
19578
|
-
|
|
19579
|
-
|
|
19580
|
-
|
|
19581
|
-
|
|
20248
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
20249
|
+
trav.enter_member_declaration += T(:check_member_dcl)
|
|
20250
|
+
trav.enter_typedef_declaration += T(:check_dcl_spec_holder)
|
|
20251
|
+
trav.enter_function_declaration += T(:check_dcl_spec_holder)
|
|
20252
|
+
trav.enter_parameter_declaration += T(:check_dcl_spec_holder)
|
|
20253
|
+
trav.enter_variable_declaration += T(:check_dcl_spec_holder)
|
|
20254
|
+
trav.enter_variable_definition += T(:check_dcl_spec_holder)
|
|
20255
|
+
trav.enter_ansi_function_definition += T(:check_dcl_spec_holder)
|
|
20256
|
+
trav.enter_kandr_function_definition += T(:check_dcl_spec_holder)
|
|
20257
|
+
trav.enter_parameter_definition += T(:check_dcl_spec_holder)
|
|
20258
|
+
trav.enter_type_name += T(:check_type_name)
|
|
19582
20259
|
end
|
|
19583
20260
|
|
|
19584
20261
|
private
|
|
19585
|
-
def
|
|
20262
|
+
def check_member_dcl(node)
|
|
19586
20263
|
type_specs = node.specifier_qualifier_list.type_specifiers
|
|
19587
20264
|
if fst_ts = type_specs.first
|
|
19588
20265
|
node.type.accept(Visitor.new(@phase_ctxt, fst_ts.location))
|
|
@@ -19596,7 +20273,7 @@ module CBuiltin #:nodoc:
|
|
|
19596
20273
|
end
|
|
19597
20274
|
end
|
|
19598
20275
|
|
|
19599
|
-
def
|
|
20276
|
+
def check_dcl_spec_holder(dcl_spec_holder)
|
|
19600
20277
|
type_specs = dcl_spec_holder.type_specifiers
|
|
19601
20278
|
if fst_ts = type_specs.first
|
|
19602
20279
|
dcl_spec_holder.type.accept(Visitor.new(@phase_ctxt, fst_ts.location))
|
|
@@ -19670,8 +20347,8 @@ module CBuiltin #:nodoc:
|
|
|
19670
20347
|
|
|
19671
20348
|
def initialize(phase_ctxt)
|
|
19672
20349
|
super
|
|
19673
|
-
|
|
19674
|
-
|
|
20350
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
20351
|
+
trav.enter_string_literal_specifier += T(:check)
|
|
19675
20352
|
end
|
|
19676
20353
|
|
|
19677
20354
|
private
|
|
@@ -19689,8 +20366,8 @@ module CBuiltin #:nodoc:
|
|
|
19689
20366
|
|
|
19690
20367
|
def initialize(phase_ctxt)
|
|
19691
20368
|
super
|
|
19692
|
-
|
|
19693
|
-
|
|
20369
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
20370
|
+
trav.enter_constant_specifier += T(:check)
|
|
19694
20371
|
end
|
|
19695
20372
|
|
|
19696
20373
|
private
|
|
@@ -19713,8 +20390,8 @@ module CBuiltin #:nodoc:
|
|
|
19713
20390
|
|
|
19714
20391
|
def initialize(phase_ctxt)
|
|
19715
20392
|
super
|
|
19716
|
-
|
|
19717
|
-
|
|
20393
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
20394
|
+
trav.enter_struct_declarator += T(:check)
|
|
19718
20395
|
@interp = Cc1::Interpreter.new(phase_ctxt[:cc1_type_table])
|
|
19719
20396
|
end
|
|
19720
20397
|
|
|
@@ -19754,8 +20431,8 @@ module CBuiltin #:nodoc:
|
|
|
19754
20431
|
|
|
19755
20432
|
def initialize(phase_ctxt)
|
|
19756
20433
|
super
|
|
19757
|
-
|
|
19758
|
-
|
|
20434
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
20435
|
+
trav.enter_variable_definition += T(:check)
|
|
19759
20436
|
end
|
|
19760
20437
|
|
|
19761
20438
|
private
|
|
@@ -19872,6 +20549,44 @@ module CBuiltin #:nodoc:
|
|
|
19872
20549
|
end
|
|
19873
20550
|
end
|
|
19874
20551
|
|
|
20552
|
+
class W1030 < PassiveCodeCheck
|
|
20553
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
20554
|
+
|
|
20555
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
20556
|
+
# step-in analysis is supported.
|
|
20557
|
+
mark_as_unique
|
|
20558
|
+
|
|
20559
|
+
def initialize(phase_ctxt)
|
|
20560
|
+
super
|
|
20561
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
20562
|
+
trav.enter_generic_labeled_statement += T(:check)
|
|
20563
|
+
trav.enter_ansi_function_definition += T(:enter_function)
|
|
20564
|
+
trav.leave_ansi_function_definition += T(:leave_function)
|
|
20565
|
+
trav.enter_kandr_function_definition += T(:enter_function)
|
|
20566
|
+
trav.leave_kandr_function_definition += T(:leave_function)
|
|
20567
|
+
@labels = nil
|
|
20568
|
+
end
|
|
20569
|
+
|
|
20570
|
+
private
|
|
20571
|
+
def check(labeled_stmt)
|
|
20572
|
+
if @labels
|
|
20573
|
+
if @labels.include?(labeled_stmt.label.value)
|
|
20574
|
+
W(labeled_stmt.label.location, labeled_stmt.label.value)
|
|
20575
|
+
else
|
|
20576
|
+
@labels.add(labeled_stmt.label.value)
|
|
20577
|
+
end
|
|
20578
|
+
end
|
|
20579
|
+
end
|
|
20580
|
+
|
|
20581
|
+
def enter_function(*)
|
|
20582
|
+
@labels = Set.new
|
|
20583
|
+
end
|
|
20584
|
+
|
|
20585
|
+
def leave_function(*)
|
|
20586
|
+
@labels = nil
|
|
20587
|
+
end
|
|
20588
|
+
end
|
|
20589
|
+
|
|
19875
20590
|
class W1031 < PassiveCodeCheck
|
|
19876
20591
|
def_registrant_phase Cc1::Prepare2Phase
|
|
19877
20592
|
|
|
@@ -19979,6 +20694,31 @@ module CBuiltin #:nodoc:
|
|
|
19979
20694
|
end
|
|
19980
20695
|
end
|
|
19981
20696
|
|
|
20697
|
+
class W1033 < PassiveCodeCheck
|
|
20698
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
20699
|
+
|
|
20700
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
20701
|
+
# step-in analysis is supported.
|
|
20702
|
+
mark_as_unique
|
|
20703
|
+
|
|
20704
|
+
def initialize(phase_ctxt)
|
|
20705
|
+
super
|
|
20706
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
20707
|
+
trav.enter_ansi_function_definition += T(:check)
|
|
20708
|
+
trav.enter_kandr_function_definition += T(:check)
|
|
20709
|
+
trav.enter_function_declaration += T(:check)
|
|
20710
|
+
end
|
|
20711
|
+
|
|
20712
|
+
private
|
|
20713
|
+
def check(dcl_or_def)
|
|
20714
|
+
if ret_type = dcl_or_def.type.return_type
|
|
20715
|
+
if ret_type.const? || ret_type.volatile?
|
|
20716
|
+
W(dcl_or_def.location)
|
|
20717
|
+
end
|
|
20718
|
+
end
|
|
20719
|
+
end
|
|
20720
|
+
end
|
|
20721
|
+
|
|
19982
20722
|
class W1034 < PassiveCodeCheck
|
|
19983
20723
|
def_registrant_phase Cc1::Prepare2Phase
|
|
19984
20724
|
|
|
@@ -19988,10 +20728,10 @@ module CBuiltin #:nodoc:
|
|
|
19988
20728
|
|
|
19989
20729
|
def initialize(phase_ctxt)
|
|
19990
20730
|
super
|
|
19991
|
-
|
|
19992
|
-
|
|
19993
|
-
|
|
19994
|
-
|
|
20731
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
20732
|
+
trav.enter_function_declaration += T(:check)
|
|
20733
|
+
trav.enter_compound_statement += T(:enter_block)
|
|
20734
|
+
trav.leave_compound_statement += T(:leave_block)
|
|
19995
20735
|
@block_level = 0
|
|
19996
20736
|
end
|
|
19997
20737
|
|
|
@@ -20726,6 +21466,166 @@ module CBuiltin #:nodoc:
|
|
|
20726
21466
|
end
|
|
20727
21467
|
end
|
|
20728
21468
|
|
|
21469
|
+
class W1066 < PassiveCodeCheck
|
|
21470
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
21471
|
+
|
|
21472
|
+
include Cc1::InterpreterMediator
|
|
21473
|
+
|
|
21474
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
21475
|
+
# step-in analysis is supported.
|
|
21476
|
+
mark_as_unique
|
|
21477
|
+
|
|
21478
|
+
def initialize(phase_ctxt)
|
|
21479
|
+
super
|
|
21480
|
+
@interp = phase_ctxt[:cc1_interpreter]
|
|
21481
|
+
@interp.on_explicit_conv_performed += T(:check)
|
|
21482
|
+
@interp.on_function_started += T(:clear_rvalues)
|
|
21483
|
+
@interp.on_additive_expr_evaled += T(:handle_additive)
|
|
21484
|
+
@interp.on_multiplicative_expr_evaled += T(:handle_multiplicative)
|
|
21485
|
+
@rvalues = nil
|
|
21486
|
+
end
|
|
21487
|
+
|
|
21488
|
+
private
|
|
21489
|
+
def check(*, orig_var, rslt_var)
|
|
21490
|
+
return unless @rvalues && orig_var.type.floating?
|
|
21491
|
+
|
|
21492
|
+
case expr = @rvalues[orig_var]
|
|
21493
|
+
when Cc1::AdditiveExpression, Cc1::MultiplicativeExpression
|
|
21494
|
+
if orig_var.type.same_as?(from_type) && rslt_var.type.same_as?(to_type)
|
|
21495
|
+
W(expr.location)
|
|
21496
|
+
end
|
|
21497
|
+
end
|
|
21498
|
+
end
|
|
21499
|
+
|
|
21500
|
+
def clear_rvalues(*)
|
|
21501
|
+
@rvalues = {}
|
|
21502
|
+
end
|
|
21503
|
+
|
|
21504
|
+
def handle_additive(expr, *, rslt_var)
|
|
21505
|
+
memorize_rvalue_derivation(rslt_var, expr)
|
|
21506
|
+
end
|
|
21507
|
+
|
|
21508
|
+
def handle_multiplicative(expr, *, rslt_var)
|
|
21509
|
+
unless expr.operator.type == "%"
|
|
21510
|
+
memorize_rvalue_derivation(rslt_var, expr)
|
|
21511
|
+
end
|
|
21512
|
+
end
|
|
21513
|
+
|
|
21514
|
+
def memorize_rvalue_derivation(rvalue_holder, expr)
|
|
21515
|
+
@rvalues[rvalue_holder] = expr if @rvalues
|
|
21516
|
+
end
|
|
21517
|
+
|
|
21518
|
+
def from_type
|
|
21519
|
+
float_t
|
|
21520
|
+
end
|
|
21521
|
+
|
|
21522
|
+
def to_type
|
|
21523
|
+
double_t
|
|
21524
|
+
end
|
|
21525
|
+
|
|
21526
|
+
def interpreter
|
|
21527
|
+
@interp
|
|
21528
|
+
end
|
|
21529
|
+
end
|
|
21530
|
+
|
|
21531
|
+
class W1067 < W1066
|
|
21532
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
21533
|
+
|
|
21534
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
21535
|
+
# step-in analysis is supported.
|
|
21536
|
+
mark_as_unique
|
|
21537
|
+
|
|
21538
|
+
private
|
|
21539
|
+
def from_type
|
|
21540
|
+
float_t
|
|
21541
|
+
end
|
|
21542
|
+
|
|
21543
|
+
def to_type
|
|
21544
|
+
long_double_t
|
|
21545
|
+
end
|
|
21546
|
+
end
|
|
21547
|
+
|
|
21548
|
+
class W1068 < W1066
|
|
21549
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
21550
|
+
|
|
21551
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
21552
|
+
# step-in analysis is supported.
|
|
21553
|
+
mark_as_unique
|
|
21554
|
+
|
|
21555
|
+
private
|
|
21556
|
+
def from_type
|
|
21557
|
+
double_t
|
|
21558
|
+
end
|
|
21559
|
+
|
|
21560
|
+
def to_type
|
|
21561
|
+
long_double_t
|
|
21562
|
+
end
|
|
21563
|
+
end
|
|
21564
|
+
|
|
21565
|
+
class W1069 < PassiveCodeCheck
|
|
21566
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
21567
|
+
|
|
21568
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
21569
|
+
# step-in analysis is supported.
|
|
21570
|
+
mark_as_unique
|
|
21571
|
+
|
|
21572
|
+
def initialize(phase_ctxt)
|
|
21573
|
+
super
|
|
21574
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
21575
|
+
trav.enter_ansi_function_definition += T(:enter_function)
|
|
21576
|
+
trav.enter_kandr_function_definition += T(:enter_function)
|
|
21577
|
+
trav.enter_compound_statement += T(:enter_compound_stmt)
|
|
21578
|
+
trav.leave_compound_statement += T(:leave_compound_stmt)
|
|
21579
|
+
trav.enter_if_else_statement += T(:enter_if_else_stmt)
|
|
21580
|
+
trav.leave_if_else_statement += T(:leave_if_else_stmt)
|
|
21581
|
+
@if_else_stmt_chain_stack = []
|
|
21582
|
+
end
|
|
21583
|
+
|
|
21584
|
+
private
|
|
21585
|
+
def enter_function(*)
|
|
21586
|
+
@if_else_stmt_chain_stack = []
|
|
21587
|
+
end
|
|
21588
|
+
|
|
21589
|
+
def enter_compound_stmt(*)
|
|
21590
|
+
@if_else_stmt_chain_stack.push([])
|
|
21591
|
+
end
|
|
21592
|
+
|
|
21593
|
+
def leave_compound_stmt(*)
|
|
21594
|
+
@if_else_stmt_chain_stack.pop
|
|
21595
|
+
end
|
|
21596
|
+
|
|
21597
|
+
def enter_if_else_stmt(node)
|
|
21598
|
+
@if_else_stmt_chain_stack.last.push(node)
|
|
21599
|
+
if node.else_statement.kind_of?(Cc1::IfStatement)
|
|
21600
|
+
W(@if_else_stmt_chain_stack.last.first.location)
|
|
21601
|
+
end
|
|
21602
|
+
end
|
|
21603
|
+
|
|
21604
|
+
def leave_if_else_stmt(*)
|
|
21605
|
+
@if_else_stmt_chain_stack.last.pop
|
|
21606
|
+
end
|
|
21607
|
+
end
|
|
21608
|
+
|
|
21609
|
+
class W1070 < W0781
|
|
21610
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
21611
|
+
|
|
21612
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
21613
|
+
# step-in analysis is supported.
|
|
21614
|
+
mark_as_unique
|
|
21615
|
+
|
|
21616
|
+
private
|
|
21617
|
+
def check(node)
|
|
21618
|
+
if exec_path_num = @exec_path_nums.last and exec_path_num == 2
|
|
21619
|
+
W(node.location)
|
|
21620
|
+
end
|
|
21621
|
+
@exec_path_nums.pop
|
|
21622
|
+
end
|
|
21623
|
+
|
|
21624
|
+
def add_exec_path(*)
|
|
21625
|
+
@exec_path_nums[-1] += 1
|
|
21626
|
+
end
|
|
21627
|
+
end
|
|
21628
|
+
|
|
20729
21629
|
class W1071 < PassiveCodeCheck
|
|
20730
21630
|
def_registrant_phase Cc1::Prepare2Phase
|
|
20731
21631
|
|
|
@@ -20768,6 +21668,25 @@ module CBuiltin #:nodoc:
|
|
|
20768
21668
|
end
|
|
20769
21669
|
end
|
|
20770
21670
|
|
|
21671
|
+
class W1072 < PassiveCodeCheck
|
|
21672
|
+
def_registrant_phase Cc1::Prepare2Phase
|
|
21673
|
+
|
|
21674
|
+
# NOTE: All messages of cc1-phase code check should be unique till function
|
|
21675
|
+
# step-in analysis is supported.
|
|
21676
|
+
mark_as_unique
|
|
21677
|
+
|
|
21678
|
+
def initialize(phase_ctxt)
|
|
21679
|
+
super
|
|
21680
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
21681
|
+
trav.enter_goto_statement += T(:warn_goto)
|
|
21682
|
+
end
|
|
21683
|
+
|
|
21684
|
+
private
|
|
21685
|
+
def warn_goto(node)
|
|
21686
|
+
W(node.location)
|
|
21687
|
+
end
|
|
21688
|
+
end
|
|
21689
|
+
|
|
20771
21690
|
class W1073 < PassiveCodeCheck
|
|
20772
21691
|
def_registrant_phase Cc1::Prepare2Phase
|
|
20773
21692
|
|
|
@@ -20831,8 +21750,8 @@ module CBuiltin #:nodoc:
|
|
|
20831
21750
|
|
|
20832
21751
|
def initialize(phase_ctxt)
|
|
20833
21752
|
super
|
|
20834
|
-
|
|
20835
|
-
|
|
21753
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
21754
|
+
trav.enter_sizeof_expression += T(:check)
|
|
20836
21755
|
end
|
|
20837
21756
|
|
|
20838
21757
|
private
|
|
@@ -20968,23 +21887,23 @@ module CBuiltin #:nodoc:
|
|
|
20968
21887
|
def initialize(phase_ctxt)
|
|
20969
21888
|
super
|
|
20970
21889
|
@fpath = phase_ctxt[:sources].first.fpath
|
|
20971
|
-
|
|
20972
|
-
|
|
20973
|
-
|
|
20974
|
-
|
|
20975
|
-
|
|
20976
|
-
|
|
20977
|
-
|
|
20978
|
-
|
|
20979
|
-
|
|
20980
|
-
|
|
20981
|
-
|
|
20982
|
-
|
|
20983
|
-
|
|
20984
|
-
|
|
20985
|
-
|
|
20986
|
-
|
|
20987
|
-
|
|
21890
|
+
trav = phase_ctxt[:cc1_ast_traversal]
|
|
21891
|
+
trav.enter_error_statement += T(:check)
|
|
21892
|
+
trav.enter_generic_labeled_statement += T(:check)
|
|
21893
|
+
trav.enter_case_labeled_statement += T(:check)
|
|
21894
|
+
trav.enter_default_labeled_statement += T(:check)
|
|
21895
|
+
trav.enter_expression_statement += T(:check)
|
|
21896
|
+
trav.enter_if_statement += T(:check)
|
|
21897
|
+
trav.enter_if_else_statement += T(:check)
|
|
21898
|
+
trav.enter_switch_statement += T(:check)
|
|
21899
|
+
trav.enter_while_statement += T(:check)
|
|
21900
|
+
trav.enter_do_statement += T(:check)
|
|
21901
|
+
trav.enter_for_statement += T(:check)
|
|
21902
|
+
trav.enter_c99_for_statement += T(:check)
|
|
21903
|
+
trav.enter_goto_statement += T(:check)
|
|
21904
|
+
trav.enter_continue_statement += T(:check)
|
|
21905
|
+
trav.enter_break_statement += T(:check)
|
|
21906
|
+
trav.enter_return_statement += T(:check)
|
|
20988
21907
|
end
|
|
20989
21908
|
|
|
20990
21909
|
private
|