adlint 2.6.14 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +1 -3
- data/ChangeLog +511 -0
- data/INSTALL +1 -1
- data/MANIFEST +57 -37
- data/NEWS +36 -7
- data/README +2 -2
- data/Rakefile +6 -6
- data/TODO +1 -1
- data/bin/adlint +25 -16
- data/bin/adlint_chk +22 -12
- data/bin/adlint_cma +17 -12
- data/bin/adlint_sma +22 -12
- data/bin/adlintize +98 -17
- data/etc/conf.d/fallback/cinit.erb +1 -1
- data/etc/conf.d/fallback/traits.erb +37 -37
- data/etc/conf.d/i686-cygwin/cinit-gcc_4.3.4.erb +1 -1
- data/etc/conf.d/i686-cygwin/traits-gcc_4.3.4.erb +41 -41
- data/etc/conf.d/i686-devkit/cinit-gcc_4.5.2.erb +1 -1
- data/etc/conf.d/i686-devkit/traits-gcc_4.5.2.erb +40 -40
- data/etc/conf.d/i686-linux/cinit-gcc_4.5.1.erb +1 -1
- data/etc/conf.d/i686-linux/traits-gcc_4.5.1.erb +40 -40
- data/etc/conf.d/i686-mingw/cinit-gcc_4.6.1.erb +1 -1
- data/etc/conf.d/i686-mingw/traits-gcc_4.6.1.erb +40 -40
- data/etc/conf.d/noarch/GNUmakefile.erb +1 -1
- data/etc/conf.d/noarch/adlint_all_bat.erb +1 -1
- data/etc/conf.d/noarch/adlint_all_sh.erb +1 -1
- data/etc/conf.d/noarch/pinit.erb +1 -1
- data/etc/conf.d/x86_64-ubuntu_12.04/cinit-gcc_4.6.3.erb +1 -1
- data/etc/conf.d/x86_64-ubuntu_12.04/traits-gcc_4.6.3.erb +42 -42
- data/etc/mesg.d/c_builtin/en_US/messages.yml +33 -33
- data/etc/mesg.d/c_builtin/ja_JP/messages.yml +5 -5
- data/etc/mesg.d/core/en_US/messages.yml +2 -2
- data/etc/mesg.d/core/ja_JP/messages.yml +2 -2
- data/features/code_check/W0018.feature +197 -0
- data/features/code_check/W0019.feature +79 -0
- data/features/code_check/W0021.feature +81 -0
- data/features/code_check/W0023.feature +203 -0
- data/features/code_check/W0024.feature +226 -0
- data/features/code_check/W0025.feature +5 -0
- data/features/code_check/W0088.feature +2 -2
- data/features/code_check/W0109.feature +2 -2
- data/features/code_check/W0477.feature +0 -3
- data/features/code_check/W0478.feature +0 -1
- data/features/code_check/W0582.feature +3 -3
- data/features/code_check/W0583.feature +4 -7
- data/features/code_check/W0646.feature +0 -1
- data/features/code_check/W0695.feature +0 -1
- data/features/code_check/W0705.feature +8 -0
- data/features/code_check/W0723.feature +0 -1
- data/features/code_check/W0745.feature +1 -0
- data/features/code_check/W0781.feature +1 -0
- data/features/code_check/W1057.feature +141 -0
- data/features/code_check/W1058.feature +93 -0
- data/features/code_check/W1059.feature +86 -0
- data/features/code_check/W1060.feature +77 -0
- data/features/code_check/W1061.feature +143 -0
- data/features/code_check/W1062.feature +162 -0
- data/features/code_check/W1063.feature +123 -0
- data/features/code_check/W1064.feature +83 -0
- data/features/code_check/W1065.feature +82 -0
- data/features/code_check/W9003.feature +2 -0
- data/features/step_definitions/code_check_steps.rb +1 -0
- data/features/support/env.rb +16 -13
- data/lib/adlint.rb +7 -4
- data/lib/adlint/analyzer.rb +131 -157
- data/lib/adlint/annot.rb +149 -0
- data/lib/adlint/cc1.rb +57 -0
- data/lib/adlint/{c → cc1}/branch.rb +74 -62
- data/lib/adlint/{c → cc1}/builtin.rb +21 -21
- data/lib/adlint/{c → cc1}/const.rb +119 -117
- data/lib/adlint/{c → cc1}/conv.rb +76 -78
- data/lib/adlint/{c → cc1}/ctrlexpr.rb +69 -86
- data/lib/adlint/cc1/domain.rb +8103 -0
- data/lib/adlint/{c → cc1}/enum.rb +3 -3
- data/lib/adlint/{c → cc1}/environ.rb +21 -21
- data/lib/adlint/{c → cc1}/expr.rb +232 -218
- data/lib/adlint/{c → cc1}/format.rb +305 -342
- data/lib/adlint/{c → cc1}/interp.rb +269 -220
- data/lib/adlint/cc1/lexer.rb +246 -0
- data/lib/adlint/{c → cc1}/mediator.rb +78 -84
- data/lib/adlint/{c → cc1}/object.rb +261 -264
- data/lib/adlint/{c → cc1}/operator.rb +7 -7
- data/lib/adlint/{c → cc1}/option.rb +4 -3
- data/lib/adlint/{c → cc1}/parser.rb +274 -506
- data/lib/adlint/{c → cc1}/parser.y +69 -301
- data/lib/adlint/cc1/phase.rb +138 -0
- data/lib/adlint/{c → cc1}/resolver.rb +66 -78
- data/lib/adlint/{c → cc1}/scanner.rb +57 -49
- data/lib/adlint/{c → cc1}/scope.rb +3 -3
- data/lib/adlint/{c → cc1}/seqp.rb +13 -5
- data/lib/adlint/{c → cc1}/syntax.rb +819 -1122
- data/lib/adlint/{c → cc1}/type.rb +1498 -1479
- data/lib/adlint/{c → cc1}/util.rb +20 -12
- data/lib/adlint/{c → cc1}/value.rb +699 -642
- data/lib/adlint/code.rb +163 -164
- data/lib/adlint/cpp.rb +2 -2
- data/lib/adlint/cpp/asm.rb +13 -14
- data/lib/adlint/cpp/constexpr.rb +42 -38
- data/lib/adlint/cpp/constexpr.y +44 -40
- data/lib/adlint/cpp/eval.rb +435 -435
- data/lib/adlint/cpp/lexer.rb +343 -340
- data/lib/adlint/cpp/macro.rb +188 -190
- data/lib/adlint/cpp/phase.rb +66 -45
- data/lib/adlint/cpp/scanner.rb +14 -17
- data/lib/adlint/cpp/source.rb +49 -55
- data/lib/adlint/cpp/subst.rb +65 -65
- data/lib/adlint/cpp/syntax.rb +155 -275
- data/lib/adlint/cpp/util.rb +22 -19
- data/lib/adlint/driver.rb +86 -93
- data/lib/adlint/error.rb +33 -52
- data/lib/adlint/exam.rb +158 -24
- data/lib/adlint/exam/c_builtin.rb +7 -7
- data/lib/adlint/exam/c_builtin/cc1_check.rb +20522 -0
- data/lib/adlint/exam/c_builtin/cc1_check_shima.rb +957 -0
- data/lib/adlint/exam/c_builtin/cc1_code.rb +459 -0
- data/lib/adlint/exam/c_builtin/cc1_metric.rb +794 -0
- data/lib/adlint/exam/c_builtin/cpp_check.rb +486 -441
- data/lib/adlint/exam/c_builtin/cpp_check_shima.rb +36 -39
- data/lib/adlint/exam/c_builtin/cpp_code.rb +63 -65
- data/lib/adlint/exam/c_builtin/ld_check.rb +136 -129
- data/lib/adlint/exam/c_builtin/ld_metric.rb +11 -11
- data/lib/adlint/lang.rb +25 -25
- data/lib/adlint/ld.rb +2 -2
- data/lib/adlint/ld/object.rb +220 -188
- data/lib/adlint/ld/phase.rb +94 -63
- data/lib/adlint/ld/typedef.rb +22 -11
- data/lib/adlint/ld/util.rb +43 -35
- data/lib/adlint/lexer.rb +59 -56
- data/lib/adlint/location.rb +140 -0
- data/lib/adlint/memo.rb +157 -0
- data/lib/adlint/message.rb +207 -156
- data/lib/adlint/metric.rb +139 -217
- data/lib/adlint/monitor.rb +45 -43
- data/lib/adlint/phase.rb +56 -29
- data/lib/adlint/prelude.rb +66 -54
- data/lib/adlint/report.rb +253 -332
- data/lib/adlint/source.rb +26 -27
- data/lib/adlint/supp.rb +131 -0
- data/lib/adlint/symbol.rb +14 -16
- data/lib/adlint/token.rb +19 -91
- data/lib/adlint/traits.rb +242 -226
- data/lib/adlint/util.rb +116 -205
- data/lib/adlint/version.rb +8 -8
- data/share/HEADER +2 -2
- data/share/doc/developers_guide_ja.html +148 -19
- data/share/doc/developers_guide_ja.texi +141 -11
- data/share/doc/samples/GNUmakefile +1 -1
- data/share/doc/samples/adlint_traits.yml +45 -36
- data/share/doc/users_guide_en.html +1321 -1252
- data/share/doc/users_guide_en.texi +475 -408
- data/share/doc/users_guide_ja.html +1932 -1878
- data/share/doc/users_guide_ja.texi +324 -273
- data/share/sample/bison-2.5/adlint/GNUmakefile +5 -1
- data/share/sample/bison-2.5/adlint/adlint_traits.yml +38 -38
- data/share/sample/bison-2.5/adlint/lib/GNUmakefile +1 -1
- data/share/sample/bison-2.5/adlint/lib/adlint_cinit.h +1 -1
- data/share/sample/bison-2.5/adlint/lib/adlint_pinit.h +1 -1
- data/share/sample/bison-2.5/adlint/lib/adlint_traits.yml +50 -42
- data/share/sample/bison-2.5/adlint/src/GNUmakefile +1 -1
- data/share/sample/bison-2.5/adlint/src/adlint_cinit.h +1 -1
- data/share/sample/bison-2.5/adlint/src/adlint_pinit.h +1 -1
- data/share/sample/bison-2.5/adlint/src/adlint_traits.yml +50 -42
- data/share/sample/ctags-5.8/adlint/GNUmakefile +1 -1
- data/share/sample/ctags-5.8/adlint/adlint_cinit.h +1 -1
- data/share/sample/ctags-5.8/adlint/adlint_pinit.h +1 -1
- data/share/sample/ctags-5.8/adlint/adlint_traits.yml +50 -42
- data/share/sample/flex-2.5.35/adlint/GNUmakefile +1 -1
- data/share/sample/flex-2.5.35/adlint/adlint_cinit.h +1 -1
- data/share/sample/flex-2.5.35/adlint/adlint_pinit.h +1 -1
- data/share/sample/flex-2.5.35/adlint/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/adlint_traits.yml +46 -38
- data/share/sample/ruby-1.9.3-p0/adlint/core/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/enc/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-date/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_traits.yml +50 -42
- data/share/sample/screen-4.0.3/adlint/GNUmakefile +1 -1
- data/share/sample/screen-4.0.3/adlint/adlint_cinit.h +1 -1
- data/share/sample/screen-4.0.3/adlint/adlint_pinit.h +1 -1
- data/share/sample/screen-4.0.3/adlint/adlint_traits.yml +50 -42
- data/share/sample/vim-7.3/adlint/vim/GNUmakefile +1 -1
- data/share/sample/vim-7.3/adlint/vim/adlint_cinit.h +1 -1
- data/share/sample/vim-7.3/adlint/vim/adlint_pinit.h +1 -1
- data/share/sample/vim-7.3/adlint/vim/adlint_traits.yml +50 -42
- data/share/sample/vim-7.3/adlint/xxd/GNUmakefile +1 -1
- data/share/sample/vim-7.3/adlint/xxd/adlint_cinit.h +1 -1
- data/share/sample/vim-7.3/adlint/xxd/adlint_pinit.h +1 -1
- data/share/sample/vim-7.3/adlint/xxd/adlint_traits.yml +49 -41
- data/share/sample/zsh-4.3.15/adlint/GNUmakefile +1 -1
- data/share/sample/zsh-4.3.15/adlint/adlint_traits.yml +46 -38
- data/share/sample/zsh-4.3.15/adlint/builtins/GNUmakefile +1 -1
- data/share/sample/zsh-4.3.15/adlint/builtins/adlint_cinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/builtins/adlint_pinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/builtins/adlint_traits.yml +50 -42
- data/share/sample/zsh-4.3.15/adlint/core/GNUmakefile +1 -1
- data/share/sample/zsh-4.3.15/adlint/core/adlint_cinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/core/adlint_pinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/core/adlint_traits.yml +50 -42
- data/share/sample/zsh-4.3.15/adlint/modules/GNUmakefile +1 -1
- data/share/sample/zsh-4.3.15/adlint/modules/adlint_cinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/modules/adlint_pinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/modules/adlint_traits.yml +50 -42
- data/share/sample/zsh-4.3.15/adlint/zle/GNUmakefile +1 -1
- data/share/sample/zsh-4.3.15/adlint/zle/adlint_cinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/zle/adlint_pinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/zle/adlint_traits.yml +50 -42
- data/spec/adlint/{c → cc1}/ctrlexpr_spec.rb +51 -49
- data/spec/adlint/{c → cc1}/domain_spec.rb +210 -179
- data/spec/adlint/{c → cc1}/operator_spec.rb +3 -3
- data/spec/adlint/{c → cc1}/syntax_spec.rb +10 -12
- data/spec/adlint/{c → cc1}/type_spec.rb +61 -68
- data/{lib/adlint/c.rb → spec/adlint/location_spec.rb} +24 -29
- data/spec/conf.d/default_traits.yml +38 -37
- data/spec/conf.d/empty_cinit.h +1 -1
- data/spec/conf.d/empty_pinit.h +1 -1
- data/spec/conf.d/project/foo.c +0 -0
- data/spec/spec_helper.rb +2 -2
- metadata +60 -40
- data/lib/adlint/c/domain.rb +0 -7931
- data/lib/adlint/c/lexer.rb +0 -252
- data/lib/adlint/c/phase.rb +0 -135
- data/lib/adlint/exam/c_builtin/c_check.rb +0 -20745
- data/lib/adlint/exam/c_builtin/c_check_shima.rb +0 -983
- data/lib/adlint/exam/c_builtin/c_code.rb +0 -477
- data/lib/adlint/exam/c_builtin/c_metric.rb +0 -818
@@ -0,0 +1,141 @@
|
|
1
|
+
Feature: W1057
|
2
|
+
|
3
|
+
W1057 detects that a value of enum typed non-constant expression is assigned
|
4
|
+
to the inconsistently enum typed variable.
|
5
|
+
|
6
|
+
Scenario: assigning a value of the consistently enum typed constant
|
7
|
+
expression
|
8
|
+
Given a target source named "fixture.c" with:
|
9
|
+
"""
|
10
|
+
enum Color { RED, BLUE, GREEN };
|
11
|
+
enum Fruit { APPLE, BANANA, ORANGE, GRAPE };
|
12
|
+
|
13
|
+
static void foo(void)
|
14
|
+
{
|
15
|
+
enum Color c = RED;
|
16
|
+
|
17
|
+
c = BLUE; /* OK */
|
18
|
+
}
|
19
|
+
"""
|
20
|
+
When I successfully run `adlint fixture.c` on noarch
|
21
|
+
Then the output should exactly match with:
|
22
|
+
| mesg | line | column |
|
23
|
+
| W1076 | 4 | 13 |
|
24
|
+
| W0629 | 4 | 13 |
|
25
|
+
| W0628 | 4 | 13 |
|
26
|
+
|
27
|
+
Scenario: assigning a value of the consistently enum typed non-constant
|
28
|
+
expression
|
29
|
+
Given a target source named "fixture.c" with:
|
30
|
+
"""
|
31
|
+
enum Color { RED, BLUE, GREEN };
|
32
|
+
enum Fruit { APPLE, BANANA, ORANGE, GRAPE };
|
33
|
+
|
34
|
+
static void foo(const enum Color p)
|
35
|
+
{
|
36
|
+
enum Color c = RED;
|
37
|
+
|
38
|
+
c = p; /* OK */
|
39
|
+
}
|
40
|
+
"""
|
41
|
+
When I successfully run `adlint fixture.c` on noarch
|
42
|
+
Then the output should exactly match with:
|
43
|
+
| mesg | line | column |
|
44
|
+
| W1076 | 4 | 13 |
|
45
|
+
| W0629 | 4 | 13 |
|
46
|
+
| W0628 | 4 | 13 |
|
47
|
+
|
48
|
+
Scenario: assigning a value of the inconsistently enum typed constant
|
49
|
+
expression
|
50
|
+
Given a target source named "fixture.c" with:
|
51
|
+
"""
|
52
|
+
enum Color { RED, BLUE, GREEN };
|
53
|
+
enum Fruit { APPLE, BANANA, ORANGE, GRAPE };
|
54
|
+
|
55
|
+
static void foo(void)
|
56
|
+
{
|
57
|
+
enum Color c = RED;
|
58
|
+
|
59
|
+
c = ORANGE; /* OK but W0729 */
|
60
|
+
}
|
61
|
+
"""
|
62
|
+
When I successfully run `adlint fixture.c` on noarch
|
63
|
+
Then the output should exactly match with:
|
64
|
+
| mesg | line | column |
|
65
|
+
| W1076 | 4 | 13 |
|
66
|
+
| W9003 | 8 | 9 |
|
67
|
+
| W0729 | 8 | 7 |
|
68
|
+
| W0629 | 4 | 13 |
|
69
|
+
| W0628 | 4 | 13 |
|
70
|
+
|
71
|
+
Scenario: assigning a value of the inconsistently enum typed non-constant
|
72
|
+
expression
|
73
|
+
Given a target source named "fixture.c" with:
|
74
|
+
"""
|
75
|
+
enum Color { RED, BLUE, GREEN };
|
76
|
+
enum Fruit { APPLE, BANANA, ORANGE, GRAPE };
|
77
|
+
|
78
|
+
static void foo(const enum Fruit f)
|
79
|
+
{
|
80
|
+
enum Color c = RED;
|
81
|
+
|
82
|
+
c = f; /* W1057 */
|
83
|
+
}
|
84
|
+
"""
|
85
|
+
When I successfully run `adlint fixture.c` on noarch
|
86
|
+
Then the output should exactly match with:
|
87
|
+
| mesg | line | column |
|
88
|
+
| W1076 | 4 | 13 |
|
89
|
+
| W0727 | 8 | 9 |
|
90
|
+
| W9003 | 8 | 9 |
|
91
|
+
| W1057 | 8 | 7 |
|
92
|
+
| W1062 | 8 | 7 |
|
93
|
+
| W0629 | 4 | 13 |
|
94
|
+
| W0628 | 4 | 13 |
|
95
|
+
|
96
|
+
Scenario: assigning a value of `int' typed constant expression
|
97
|
+
Given a target source named "fixture.c" with:
|
98
|
+
"""
|
99
|
+
enum Color { RED, BLUE, GREEN };
|
100
|
+
enum Fruit { APPLE, BANANA, ORANGE, GRAPE };
|
101
|
+
|
102
|
+
static void foo(void)
|
103
|
+
{
|
104
|
+
enum Color c = RED;
|
105
|
+
|
106
|
+
c = 2; /* OK but W1054 */
|
107
|
+
}
|
108
|
+
"""
|
109
|
+
When I successfully run `adlint fixture.c` on noarch
|
110
|
+
Then the output should exactly match with:
|
111
|
+
| mesg | line | column |
|
112
|
+
| W1076 | 4 | 13 |
|
113
|
+
| W9003 | 8 | 9 |
|
114
|
+
| W1054 | 8 | 7 |
|
115
|
+
| W0629 | 4 | 13 |
|
116
|
+
| W0628 | 4 | 13 |
|
117
|
+
|
118
|
+
Scenario: assigning a value of `int' typed non-constant expression
|
119
|
+
Given a target source named "fixture.c" with:
|
120
|
+
"""
|
121
|
+
enum Color { RED, BLUE, GREEN };
|
122
|
+
enum Fruit { APPLE, BANANA, ORANGE, GRAPE };
|
123
|
+
|
124
|
+
static void foo(const int i)
|
125
|
+
{
|
126
|
+
enum Color c = RED;
|
127
|
+
|
128
|
+
c = i + 1; /* OK but W1062 */
|
129
|
+
}
|
130
|
+
"""
|
131
|
+
When I successfully run `adlint fixture.c` on noarch
|
132
|
+
Then the output should exactly match with:
|
133
|
+
| mesg | line | column |
|
134
|
+
| W1076 | 4 | 13 |
|
135
|
+
| W0723 | 8 | 11 |
|
136
|
+
| W0727 | 8 | 11 |
|
137
|
+
| W9003 | 8 | 11 |
|
138
|
+
| W1054 | 8 | 7 |
|
139
|
+
| W1062 | 8 | 7 |
|
140
|
+
| W0629 | 4 | 13 |
|
141
|
+
| W0628 | 4 | 13 |
|
@@ -0,0 +1,93 @@
|
|
1
|
+
Feature: W1058
|
2
|
+
|
3
|
+
W1058 detects that a function of enum return type is returning a value of
|
4
|
+
inconsistently enum typed non-constant expression.
|
5
|
+
|
6
|
+
Scenario: returning a value of the consistently enum typed constant
|
7
|
+
expression
|
8
|
+
Given a target source named "fixture.c" with:
|
9
|
+
"""
|
10
|
+
enum Color { RED, BLUE, GREEN };
|
11
|
+
enum Fruit { APPLE, BANANA, ORANGE, GRAPE };
|
12
|
+
|
13
|
+
static enum Color foo(void)
|
14
|
+
{
|
15
|
+
return RED + 1; /* OK */
|
16
|
+
}
|
17
|
+
"""
|
18
|
+
When I successfully run `adlint fixture.c` on noarch
|
19
|
+
Then the output should exactly match with:
|
20
|
+
| mesg | line | column |
|
21
|
+
| W1076 | 4 | 19 |
|
22
|
+
| W9003 | 6 | 18 |
|
23
|
+
| W0629 | 4 | 19 |
|
24
|
+
| W0628 | 4 | 19 |
|
25
|
+
|
26
|
+
Scenario: returning a value of the consistently enum typed non-constant
|
27
|
+
expression
|
28
|
+
Given a target source named "fixture.c" with:
|
29
|
+
"""
|
30
|
+
enum Color { RED, BLUE, GREEN };
|
31
|
+
enum Fruit { APPLE, BANANA, ORANGE, GRAPE };
|
32
|
+
|
33
|
+
static enum Color foo(const enum Color c)
|
34
|
+
{
|
35
|
+
return c + 1; /* OK */
|
36
|
+
}
|
37
|
+
"""
|
38
|
+
When I successfully run `adlint fixture.c` on noarch
|
39
|
+
Then the output should exactly match with:
|
40
|
+
| mesg | line | column |
|
41
|
+
| W1076 | 4 | 19 |
|
42
|
+
| W9003 | 6 | 16 |
|
43
|
+
| W0723 | 6 | 14 |
|
44
|
+
| W0629 | 4 | 19 |
|
45
|
+
| W0628 | 4 | 19 |
|
46
|
+
|
47
|
+
Scenario: returning a value of the inconsistently enum typed constant
|
48
|
+
expression
|
49
|
+
Given a target source named "fixture.c" with:
|
50
|
+
"""
|
51
|
+
enum Color { RED, BLUE, GREEN };
|
52
|
+
enum Fruit { APPLE, BANANA, ORANGE, GRAPE };
|
53
|
+
|
54
|
+
static enum Color foo(void)
|
55
|
+
{
|
56
|
+
return ORANGE + 1; /* OK but W0730 */
|
57
|
+
}
|
58
|
+
"""
|
59
|
+
When I successfully run `adlint fixture.c` on noarch
|
60
|
+
Then the output should exactly match with:
|
61
|
+
| mesg | line | column |
|
62
|
+
| W1076 | 4 | 19 |
|
63
|
+
| W9003 | 6 | 21 |
|
64
|
+
| W0727 | 6 | 19 |
|
65
|
+
| W9003 | 6 | 19 |
|
66
|
+
| W0730 | 6 | 19 |
|
67
|
+
| W0629 | 4 | 19 |
|
68
|
+
| W0628 | 4 | 19 |
|
69
|
+
|
70
|
+
Scenario: returning a value of the inconsistently enum typed non-constant
|
71
|
+
expression
|
72
|
+
Given a target source named "fixture.c" with:
|
73
|
+
"""
|
74
|
+
enum Color { RED, BLUE, GREEN };
|
75
|
+
enum Fruit { APPLE, BANANA, ORANGE, GRAPE };
|
76
|
+
|
77
|
+
static enum Color foo(const enum Fruit f)
|
78
|
+
{
|
79
|
+
return f + 1; /* W1058 */
|
80
|
+
}
|
81
|
+
"""
|
82
|
+
When I successfully run `adlint fixture.c` on noarch
|
83
|
+
Then the output should exactly match with:
|
84
|
+
| mesg | line | column |
|
85
|
+
| W1076 | 4 | 19 |
|
86
|
+
| W9003 | 6 | 16 |
|
87
|
+
| W0723 | 6 | 14 |
|
88
|
+
| W0727 | 6 | 14 |
|
89
|
+
| W9003 | 6 | 14 |
|
90
|
+
| W1058 | 6 | 14 |
|
91
|
+
| W1063 | 6 | 14 |
|
92
|
+
| W0629 | 4 | 19 |
|
93
|
+
| W0628 | 4 | 19 |
|
@@ -0,0 +1,86 @@
|
|
1
|
+
Feature: W1059
|
2
|
+
|
3
|
+
W1059 detects that a value of enum typed expression is passed to a non-enum
|
4
|
+
typed parameter.
|
5
|
+
|
6
|
+
Scenario: passing a value of the enum typed constant expression
|
7
|
+
Given a target source named "fixture.c" with:
|
8
|
+
"""
|
9
|
+
enum Color { RED, BLUE, GREEN };
|
10
|
+
|
11
|
+
extern void foo(int);
|
12
|
+
|
13
|
+
static void bar(void)
|
14
|
+
{
|
15
|
+
foo(RED + 1); /* W1059 */
|
16
|
+
}
|
17
|
+
"""
|
18
|
+
When I successfully run `adlint fixture.c` on noarch
|
19
|
+
Then the output should exactly match with:
|
20
|
+
| mesg | line | column |
|
21
|
+
| W0118 | 3 | 13 |
|
22
|
+
| W1076 | 5 | 13 |
|
23
|
+
| W9003 | 7 | 15 |
|
24
|
+
| W9003 | 7 | 13 |
|
25
|
+
| W1059 | 7 | 13 |
|
26
|
+
| W0629 | 5 | 13 |
|
27
|
+
| W0628 | 5 | 13 |
|
28
|
+
|
29
|
+
Scenario: passing a value of the enum typed non-constant expression
|
30
|
+
Given a target source named "fixture.c" with:
|
31
|
+
"""
|
32
|
+
enum Color { RED, BLUE, GREEN };
|
33
|
+
|
34
|
+
extern void foo(int);
|
35
|
+
|
36
|
+
static void bar(const enum Color c)
|
37
|
+
{
|
38
|
+
foo(c); /* W1059 */
|
39
|
+
}
|
40
|
+
"""
|
41
|
+
When I successfully run `adlint fixture.c` on noarch
|
42
|
+
Then the output should exactly match with:
|
43
|
+
| mesg | line | column |
|
44
|
+
| W0118 | 3 | 13 |
|
45
|
+
| W1076 | 5 | 13 |
|
46
|
+
| W9003 | 7 | 9 |
|
47
|
+
| W1059 | 7 | 9 |
|
48
|
+
| W0629 | 5 | 13 |
|
49
|
+
| W0628 | 5 | 13 |
|
50
|
+
|
51
|
+
Scenario: passing a value of consistently typed constant expression
|
52
|
+
Given a target source named "fixture.c" with:
|
53
|
+
"""
|
54
|
+
extern void foo(int);
|
55
|
+
|
56
|
+
static void bar(void)
|
57
|
+
{
|
58
|
+
foo(1 + 1); /* OK */
|
59
|
+
}
|
60
|
+
"""
|
61
|
+
When I successfully run `adlint fixture.c` on noarch
|
62
|
+
Then the output should exactly match with:
|
63
|
+
| mesg | line | column |
|
64
|
+
| W0118 | 1 | 13 |
|
65
|
+
| W1076 | 3 | 13 |
|
66
|
+
| W0629 | 3 | 13 |
|
67
|
+
| W0628 | 3 | 13 |
|
68
|
+
|
69
|
+
Scenario: passing a value of inconsistently typed constant expression
|
70
|
+
Given a target source named "fixture.c" with:
|
71
|
+
"""
|
72
|
+
extern void foo(int);
|
73
|
+
|
74
|
+
static void bar(void)
|
75
|
+
{
|
76
|
+
foo(1.0 * .1); /* OK */
|
77
|
+
}
|
78
|
+
"""
|
79
|
+
When I successfully run `adlint fixture.c` on noarch
|
80
|
+
Then the output should exactly match with:
|
81
|
+
| mesg | line | column |
|
82
|
+
| W0118 | 1 | 13 |
|
83
|
+
| W1076 | 3 | 13 |
|
84
|
+
| W0226 | 5 | 13 |
|
85
|
+
| W0629 | 3 | 13 |
|
86
|
+
| W0628 | 3 | 13 |
|
@@ -0,0 +1,77 @@
|
|
1
|
+
Feature: W1060
|
2
|
+
|
3
|
+
W1060 detects that a function of non-enum return type is returning a value of
|
4
|
+
enum typed expression.
|
5
|
+
|
6
|
+
Scenario: returning a value of the enum typed constant expression
|
7
|
+
Given a target source named "fixture.c" with:
|
8
|
+
"""
|
9
|
+
enum Color { RED, BLUE, GREEN };
|
10
|
+
|
11
|
+
static int bar(void)
|
12
|
+
{
|
13
|
+
return RED + 1; /* W1060 */
|
14
|
+
}
|
15
|
+
"""
|
16
|
+
When I successfully run `adlint fixture.c` on noarch
|
17
|
+
Then the output should exactly match with:
|
18
|
+
| mesg | line | column |
|
19
|
+
| W1076 | 3 | 12 |
|
20
|
+
| W9003 | 5 | 18 |
|
21
|
+
| W9003 | 5 | 16 |
|
22
|
+
| W1060 | 5 | 16 |
|
23
|
+
| W0629 | 3 | 12 |
|
24
|
+
| W0628 | 3 | 12 |
|
25
|
+
|
26
|
+
Scenario: returning a value of the enum typed non-constant expression
|
27
|
+
Given a target source named "fixture.c" with:
|
28
|
+
"""
|
29
|
+
enum Color { RED, BLUE, GREEN };
|
30
|
+
|
31
|
+
static int bar(const enum Color c)
|
32
|
+
{
|
33
|
+
return c + 1; /* W1060 */
|
34
|
+
}
|
35
|
+
"""
|
36
|
+
When I successfully run `adlint fixture.c` on noarch
|
37
|
+
Then the output should exactly match with:
|
38
|
+
| mesg | line | column |
|
39
|
+
| W1076 | 3 | 12 |
|
40
|
+
| W9003 | 5 | 16 |
|
41
|
+
| W0723 | 5 | 14 |
|
42
|
+
| W9003 | 5 | 14 |
|
43
|
+
| W1060 | 5 | 14 |
|
44
|
+
| W0629 | 3 | 12 |
|
45
|
+
| W0628 | 3 | 12 |
|
46
|
+
|
47
|
+
Scenario: returning a value of consistently typed constant expression
|
48
|
+
Given a target source named "fixture.c" with:
|
49
|
+
"""
|
50
|
+
static int foo(void)
|
51
|
+
{
|
52
|
+
return 1 + 1; /* OK */
|
53
|
+
}
|
54
|
+
"""
|
55
|
+
When I successfully run `adlint fixture.c` on noarch
|
56
|
+
Then the output should exactly match with:
|
57
|
+
| mesg | line | column |
|
58
|
+
| W1076 | 1 | 12 |
|
59
|
+
| W0629 | 1 | 12 |
|
60
|
+
| W0628 | 1 | 12 |
|
61
|
+
|
62
|
+
Scenario: returning a value of inconsistently typed constant expression
|
63
|
+
Given a target source named "fixture.c" with:
|
64
|
+
"""
|
65
|
+
static int foo(void)
|
66
|
+
{
|
67
|
+
return 1.0 * .1; /* OK */
|
68
|
+
}
|
69
|
+
"""
|
70
|
+
When I successfully run `adlint fixture.c` on noarch
|
71
|
+
Then the output should exactly match with:
|
72
|
+
| mesg | line | column |
|
73
|
+
| W1076 | 1 | 12 |
|
74
|
+
| W0226 | 3 | 16 |
|
75
|
+
| W0362 | 3 | 5 |
|
76
|
+
| W0629 | 1 | 12 |
|
77
|
+
| W0628 | 1 | 12 |
|
@@ -0,0 +1,143 @@
|
|
1
|
+
Feature: W1061
|
2
|
+
|
3
|
+
W1061 detects that a value of the inconsistently typed non-constant
|
4
|
+
expression is passed to a enum typed parameter.
|
5
|
+
|
6
|
+
Scenario: non-constant `int' typed expression
|
7
|
+
Given a target source named "fixture.c" with:
|
8
|
+
"""
|
9
|
+
enum Color { RED, BLUE, GREEN };
|
10
|
+
enum Fruit { APPLE, BANANA, ORANGE, GRAPE };
|
11
|
+
|
12
|
+
extern void foo(enum Color);
|
13
|
+
|
14
|
+
static void bar(const int i)
|
15
|
+
{
|
16
|
+
foo(i + 1); /* W1061 */
|
17
|
+
}
|
18
|
+
"""
|
19
|
+
When I successfully run `adlint fixture.c` on noarch
|
20
|
+
Then the output should exactly match with:
|
21
|
+
| mesg | line | column |
|
22
|
+
| W0118 | 4 | 13 |
|
23
|
+
| W1076 | 6 | 13 |
|
24
|
+
| W0723 | 8 | 11 |
|
25
|
+
| W0727 | 8 | 11 |
|
26
|
+
| W9003 | 8 | 11 |
|
27
|
+
| W1061 | 8 | 11 |
|
28
|
+
| W0629 | 6 | 13 |
|
29
|
+
| W0628 | 6 | 13 |
|
30
|
+
|
31
|
+
Scenario: non-constant consistent enum typed expression
|
32
|
+
Given a target source named "fixture.c" with:
|
33
|
+
"""
|
34
|
+
enum Color { RED, BLUE, GREEN };
|
35
|
+
enum Fruit { APPLE, BANANA, ORANGE, GRAPE };
|
36
|
+
|
37
|
+
extern void foo(enum Color);
|
38
|
+
|
39
|
+
static void bar(const enum Color c)
|
40
|
+
{
|
41
|
+
foo(c); /* OK */
|
42
|
+
}
|
43
|
+
"""
|
44
|
+
When I successfully run `adlint fixture.c` on noarch
|
45
|
+
Then the output should exactly match with:
|
46
|
+
| mesg | line | column |
|
47
|
+
| W0118 | 4 | 13 |
|
48
|
+
| W1076 | 6 | 13 |
|
49
|
+
| W0629 | 6 | 13 |
|
50
|
+
| W0628 | 6 | 13 |
|
51
|
+
|
52
|
+
Scenario: non-constant inconsistent enum typed expression
|
53
|
+
Given a target source named "fixture.c" with:
|
54
|
+
"""
|
55
|
+
enum Color { RED, BLUE, GREEN };
|
56
|
+
enum Fruit { APPLE, BANANA, ORANGE, GRAPE };
|
57
|
+
|
58
|
+
extern void foo(enum Color);
|
59
|
+
|
60
|
+
static void bar(const enum Fruit f)
|
61
|
+
{
|
62
|
+
foo(f); /* W1061 */
|
63
|
+
}
|
64
|
+
"""
|
65
|
+
When I successfully run `adlint fixture.c` on noarch
|
66
|
+
Then the output should exactly match with:
|
67
|
+
| mesg | line | column |
|
68
|
+
| W0118 | 4 | 13 |
|
69
|
+
| W1076 | 6 | 13 |
|
70
|
+
| W0727 | 8 | 9 |
|
71
|
+
| W9003 | 8 | 9 |
|
72
|
+
| W1056 | 8 | 9 |
|
73
|
+
| W1061 | 8 | 9 |
|
74
|
+
| W0629 | 6 | 13 |
|
75
|
+
| W0628 | 6 | 13 |
|
76
|
+
|
77
|
+
Scenario: constant consistent `int' typed expression
|
78
|
+
Given a target source named "fixture.c" with:
|
79
|
+
"""
|
80
|
+
enum Color { RED, BLUE, GREEN };
|
81
|
+
|
82
|
+
extern void foo(enum Color);
|
83
|
+
|
84
|
+
static void bar(void)
|
85
|
+
{
|
86
|
+
foo(2); /* OK but W1053 */
|
87
|
+
}
|
88
|
+
"""
|
89
|
+
When I successfully run `adlint fixture.c` on noarch
|
90
|
+
Then the output should exactly match with:
|
91
|
+
| mesg | line | column |
|
92
|
+
| W0118 | 3 | 13 |
|
93
|
+
| W1076 | 5 | 13 |
|
94
|
+
| W9003 | 7 | 9 |
|
95
|
+
| W1053 | 7 | 9 |
|
96
|
+
| W0629 | 5 | 13 |
|
97
|
+
| W0628 | 5 | 13 |
|
98
|
+
|
99
|
+
Scenario: constant consistent enum typed expression
|
100
|
+
Given a target source named "fixture.c" with:
|
101
|
+
"""
|
102
|
+
enum Color { RED, BLUE, GREEN };
|
103
|
+
|
104
|
+
extern void foo(enum Color);
|
105
|
+
|
106
|
+
static void bar(void)
|
107
|
+
{
|
108
|
+
foo(RED + 1); /* OK */
|
109
|
+
}
|
110
|
+
"""
|
111
|
+
When I successfully run `adlint fixture.c` on noarch
|
112
|
+
Then the output should exactly match with:
|
113
|
+
| mesg | line | column |
|
114
|
+
| W0118 | 3 | 13 |
|
115
|
+
| W1076 | 5 | 13 |
|
116
|
+
| W9003 | 7 | 15 |
|
117
|
+
| W0629 | 5 | 13 |
|
118
|
+
| W0628 | 5 | 13 |
|
119
|
+
|
120
|
+
Scenario: constant inconsistent enum typed expression
|
121
|
+
Given a target source named "fixture.c" with:
|
122
|
+
"""
|
123
|
+
enum Color { RED, BLUE, GREEN };
|
124
|
+
enum Fruit { APPLE, BANANA, ORANGE, GRAPE };
|
125
|
+
|
126
|
+
extern void foo(enum Color);
|
127
|
+
|
128
|
+
static void bar(void)
|
129
|
+
{
|
130
|
+
foo(ORANGE + 1); /* OK but W0728 */
|
131
|
+
}
|
132
|
+
"""
|
133
|
+
When I successfully run `adlint fixture.c` on noarch
|
134
|
+
Then the output should exactly match with:
|
135
|
+
| mesg | line | column |
|
136
|
+
| W0118 | 4 | 13 |
|
137
|
+
| W1076 | 6 | 13 |
|
138
|
+
| W9003 | 8 | 18 |
|
139
|
+
| W0727 | 8 | 16 |
|
140
|
+
| W9003 | 8 | 16 |
|
141
|
+
| W0728 | 8 | 16 |
|
142
|
+
| W0629 | 6 | 13 |
|
143
|
+
| W0628 | 6 | 13 |
|