adlint 2.6.14 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/AUTHORS +1 -3
- data/ChangeLog +511 -0
- data/INSTALL +1 -1
- data/MANIFEST +57 -37
- data/NEWS +36 -7
- data/README +2 -2
- data/Rakefile +6 -6
- data/TODO +1 -1
- data/bin/adlint +25 -16
- data/bin/adlint_chk +22 -12
- data/bin/adlint_cma +17 -12
- data/bin/adlint_sma +22 -12
- data/bin/adlintize +98 -17
- data/etc/conf.d/fallback/cinit.erb +1 -1
- data/etc/conf.d/fallback/traits.erb +37 -37
- data/etc/conf.d/i686-cygwin/cinit-gcc_4.3.4.erb +1 -1
- data/etc/conf.d/i686-cygwin/traits-gcc_4.3.4.erb +41 -41
- data/etc/conf.d/i686-devkit/cinit-gcc_4.5.2.erb +1 -1
- data/etc/conf.d/i686-devkit/traits-gcc_4.5.2.erb +40 -40
- data/etc/conf.d/i686-linux/cinit-gcc_4.5.1.erb +1 -1
- data/etc/conf.d/i686-linux/traits-gcc_4.5.1.erb +40 -40
- data/etc/conf.d/i686-mingw/cinit-gcc_4.6.1.erb +1 -1
- data/etc/conf.d/i686-mingw/traits-gcc_4.6.1.erb +40 -40
- data/etc/conf.d/noarch/GNUmakefile.erb +1 -1
- data/etc/conf.d/noarch/adlint_all_bat.erb +1 -1
- data/etc/conf.d/noarch/adlint_all_sh.erb +1 -1
- data/etc/conf.d/noarch/pinit.erb +1 -1
- data/etc/conf.d/x86_64-ubuntu_12.04/cinit-gcc_4.6.3.erb +1 -1
- data/etc/conf.d/x86_64-ubuntu_12.04/traits-gcc_4.6.3.erb +42 -42
- data/etc/mesg.d/c_builtin/en_US/messages.yml +33 -33
- data/etc/mesg.d/c_builtin/ja_JP/messages.yml +5 -5
- data/etc/mesg.d/core/en_US/messages.yml +2 -2
- data/etc/mesg.d/core/ja_JP/messages.yml +2 -2
- data/features/code_check/W0018.feature +197 -0
- data/features/code_check/W0019.feature +79 -0
- data/features/code_check/W0021.feature +81 -0
- data/features/code_check/W0023.feature +203 -0
- data/features/code_check/W0024.feature +226 -0
- data/features/code_check/W0025.feature +5 -0
- data/features/code_check/W0088.feature +2 -2
- data/features/code_check/W0109.feature +2 -2
- data/features/code_check/W0477.feature +0 -3
- data/features/code_check/W0478.feature +0 -1
- data/features/code_check/W0582.feature +3 -3
- data/features/code_check/W0583.feature +4 -7
- data/features/code_check/W0646.feature +0 -1
- data/features/code_check/W0695.feature +0 -1
- data/features/code_check/W0705.feature +8 -0
- data/features/code_check/W0723.feature +0 -1
- data/features/code_check/W0745.feature +1 -0
- data/features/code_check/W0781.feature +1 -0
- data/features/code_check/W1057.feature +141 -0
- data/features/code_check/W1058.feature +93 -0
- data/features/code_check/W1059.feature +86 -0
- data/features/code_check/W1060.feature +77 -0
- data/features/code_check/W1061.feature +143 -0
- data/features/code_check/W1062.feature +162 -0
- data/features/code_check/W1063.feature +123 -0
- data/features/code_check/W1064.feature +83 -0
- data/features/code_check/W1065.feature +82 -0
- data/features/code_check/W9003.feature +2 -0
- data/features/step_definitions/code_check_steps.rb +1 -0
- data/features/support/env.rb +16 -13
- data/lib/adlint.rb +7 -4
- data/lib/adlint/analyzer.rb +131 -157
- data/lib/adlint/annot.rb +149 -0
- data/lib/adlint/cc1.rb +57 -0
- data/lib/adlint/{c → cc1}/branch.rb +74 -62
- data/lib/adlint/{c → cc1}/builtin.rb +21 -21
- data/lib/adlint/{c → cc1}/const.rb +119 -117
- data/lib/adlint/{c → cc1}/conv.rb +76 -78
- data/lib/adlint/{c → cc1}/ctrlexpr.rb +69 -86
- data/lib/adlint/cc1/domain.rb +8103 -0
- data/lib/adlint/{c → cc1}/enum.rb +3 -3
- data/lib/adlint/{c → cc1}/environ.rb +21 -21
- data/lib/adlint/{c → cc1}/expr.rb +232 -218
- data/lib/adlint/{c → cc1}/format.rb +305 -342
- data/lib/adlint/{c → cc1}/interp.rb +269 -220
- data/lib/adlint/cc1/lexer.rb +246 -0
- data/lib/adlint/{c → cc1}/mediator.rb +78 -84
- data/lib/adlint/{c → cc1}/object.rb +261 -264
- data/lib/adlint/{c → cc1}/operator.rb +7 -7
- data/lib/adlint/{c → cc1}/option.rb +4 -3
- data/lib/adlint/{c → cc1}/parser.rb +274 -506
- data/lib/adlint/{c → cc1}/parser.y +69 -301
- data/lib/adlint/cc1/phase.rb +138 -0
- data/lib/adlint/{c → cc1}/resolver.rb +66 -78
- data/lib/adlint/{c → cc1}/scanner.rb +57 -49
- data/lib/adlint/{c → cc1}/scope.rb +3 -3
- data/lib/adlint/{c → cc1}/seqp.rb +13 -5
- data/lib/adlint/{c → cc1}/syntax.rb +819 -1122
- data/lib/adlint/{c → cc1}/type.rb +1498 -1479
- data/lib/adlint/{c → cc1}/util.rb +20 -12
- data/lib/adlint/{c → cc1}/value.rb +699 -642
- data/lib/adlint/code.rb +163 -164
- data/lib/adlint/cpp.rb +2 -2
- data/lib/adlint/cpp/asm.rb +13 -14
- data/lib/adlint/cpp/constexpr.rb +42 -38
- data/lib/adlint/cpp/constexpr.y +44 -40
- data/lib/adlint/cpp/eval.rb +435 -435
- data/lib/adlint/cpp/lexer.rb +343 -340
- data/lib/adlint/cpp/macro.rb +188 -190
- data/lib/adlint/cpp/phase.rb +66 -45
- data/lib/adlint/cpp/scanner.rb +14 -17
- data/lib/adlint/cpp/source.rb +49 -55
- data/lib/adlint/cpp/subst.rb +65 -65
- data/lib/adlint/cpp/syntax.rb +155 -275
- data/lib/adlint/cpp/util.rb +22 -19
- data/lib/adlint/driver.rb +86 -93
- data/lib/adlint/error.rb +33 -52
- data/lib/adlint/exam.rb +158 -24
- data/lib/adlint/exam/c_builtin.rb +7 -7
- data/lib/adlint/exam/c_builtin/cc1_check.rb +20522 -0
- data/lib/adlint/exam/c_builtin/cc1_check_shima.rb +957 -0
- data/lib/adlint/exam/c_builtin/cc1_code.rb +459 -0
- data/lib/adlint/exam/c_builtin/cc1_metric.rb +794 -0
- data/lib/adlint/exam/c_builtin/cpp_check.rb +486 -441
- data/lib/adlint/exam/c_builtin/cpp_check_shima.rb +36 -39
- data/lib/adlint/exam/c_builtin/cpp_code.rb +63 -65
- data/lib/adlint/exam/c_builtin/ld_check.rb +136 -129
- data/lib/adlint/exam/c_builtin/ld_metric.rb +11 -11
- data/lib/adlint/lang.rb +25 -25
- data/lib/adlint/ld.rb +2 -2
- data/lib/adlint/ld/object.rb +220 -188
- data/lib/adlint/ld/phase.rb +94 -63
- data/lib/adlint/ld/typedef.rb +22 -11
- data/lib/adlint/ld/util.rb +43 -35
- data/lib/adlint/lexer.rb +59 -56
- data/lib/adlint/location.rb +140 -0
- data/lib/adlint/memo.rb +157 -0
- data/lib/adlint/message.rb +207 -156
- data/lib/adlint/metric.rb +139 -217
- data/lib/adlint/monitor.rb +45 -43
- data/lib/adlint/phase.rb +56 -29
- data/lib/adlint/prelude.rb +66 -54
- data/lib/adlint/report.rb +253 -332
- data/lib/adlint/source.rb +26 -27
- data/lib/adlint/supp.rb +131 -0
- data/lib/adlint/symbol.rb +14 -16
- data/lib/adlint/token.rb +19 -91
- data/lib/adlint/traits.rb +242 -226
- data/lib/adlint/util.rb +116 -205
- data/lib/adlint/version.rb +8 -8
- data/share/HEADER +2 -2
- data/share/doc/developers_guide_ja.html +148 -19
- data/share/doc/developers_guide_ja.texi +141 -11
- data/share/doc/samples/GNUmakefile +1 -1
- data/share/doc/samples/adlint_traits.yml +45 -36
- data/share/doc/users_guide_en.html +1321 -1252
- data/share/doc/users_guide_en.texi +475 -408
- data/share/doc/users_guide_ja.html +1932 -1878
- data/share/doc/users_guide_ja.texi +324 -273
- data/share/sample/bison-2.5/adlint/GNUmakefile +5 -1
- data/share/sample/bison-2.5/adlint/adlint_traits.yml +38 -38
- data/share/sample/bison-2.5/adlint/lib/GNUmakefile +1 -1
- data/share/sample/bison-2.5/adlint/lib/adlint_cinit.h +1 -1
- data/share/sample/bison-2.5/adlint/lib/adlint_pinit.h +1 -1
- data/share/sample/bison-2.5/adlint/lib/adlint_traits.yml +50 -42
- data/share/sample/bison-2.5/adlint/src/GNUmakefile +1 -1
- data/share/sample/bison-2.5/adlint/src/adlint_cinit.h +1 -1
- data/share/sample/bison-2.5/adlint/src/adlint_pinit.h +1 -1
- data/share/sample/bison-2.5/adlint/src/adlint_traits.yml +50 -42
- data/share/sample/ctags-5.8/adlint/GNUmakefile +1 -1
- data/share/sample/ctags-5.8/adlint/adlint_cinit.h +1 -1
- data/share/sample/ctags-5.8/adlint/adlint_pinit.h +1 -1
- data/share/sample/ctags-5.8/adlint/adlint_traits.yml +50 -42
- data/share/sample/flex-2.5.35/adlint/GNUmakefile +1 -1
- data/share/sample/flex-2.5.35/adlint/adlint_cinit.h +1 -1
- data/share/sample/flex-2.5.35/adlint/adlint_pinit.h +1 -1
- data/share/sample/flex-2.5.35/adlint/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/adlint_traits.yml +46 -38
- data/share/sample/ruby-1.9.3-p0/adlint/core/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/enc/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-date/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_traits.yml +50 -42
- data/share/sample/screen-4.0.3/adlint/GNUmakefile +1 -1
- data/share/sample/screen-4.0.3/adlint/adlint_cinit.h +1 -1
- data/share/sample/screen-4.0.3/adlint/adlint_pinit.h +1 -1
- data/share/sample/screen-4.0.3/adlint/adlint_traits.yml +50 -42
- data/share/sample/vim-7.3/adlint/vim/GNUmakefile +1 -1
- data/share/sample/vim-7.3/adlint/vim/adlint_cinit.h +1 -1
- data/share/sample/vim-7.3/adlint/vim/adlint_pinit.h +1 -1
- data/share/sample/vim-7.3/adlint/vim/adlint_traits.yml +50 -42
- data/share/sample/vim-7.3/adlint/xxd/GNUmakefile +1 -1
- data/share/sample/vim-7.3/adlint/xxd/adlint_cinit.h +1 -1
- data/share/sample/vim-7.3/adlint/xxd/adlint_pinit.h +1 -1
- data/share/sample/vim-7.3/adlint/xxd/adlint_traits.yml +49 -41
- data/share/sample/zsh-4.3.15/adlint/GNUmakefile +1 -1
- data/share/sample/zsh-4.3.15/adlint/adlint_traits.yml +46 -38
- data/share/sample/zsh-4.3.15/adlint/builtins/GNUmakefile +1 -1
- data/share/sample/zsh-4.3.15/adlint/builtins/adlint_cinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/builtins/adlint_pinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/builtins/adlint_traits.yml +50 -42
- data/share/sample/zsh-4.3.15/adlint/core/GNUmakefile +1 -1
- data/share/sample/zsh-4.3.15/adlint/core/adlint_cinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/core/adlint_pinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/core/adlint_traits.yml +50 -42
- data/share/sample/zsh-4.3.15/adlint/modules/GNUmakefile +1 -1
- data/share/sample/zsh-4.3.15/adlint/modules/adlint_cinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/modules/adlint_pinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/modules/adlint_traits.yml +50 -42
- data/share/sample/zsh-4.3.15/adlint/zle/GNUmakefile +1 -1
- data/share/sample/zsh-4.3.15/adlint/zle/adlint_cinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/zle/adlint_pinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/zle/adlint_traits.yml +50 -42
- data/spec/adlint/{c → cc1}/ctrlexpr_spec.rb +51 -49
- data/spec/adlint/{c → cc1}/domain_spec.rb +210 -179
- data/spec/adlint/{c → cc1}/operator_spec.rb +3 -3
- data/spec/adlint/{c → cc1}/syntax_spec.rb +10 -12
- data/spec/adlint/{c → cc1}/type_spec.rb +61 -68
- data/{lib/adlint/c.rb → spec/adlint/location_spec.rb} +24 -29
- data/spec/conf.d/default_traits.yml +38 -37
- data/spec/conf.d/empty_cinit.h +1 -1
- data/spec/conf.d/empty_pinit.h +1 -1
- data/spec/conf.d/project/foo.c +0 -0
- data/spec/spec_helper.rb +2 -2
- metadata +60 -40
- data/lib/adlint/c/domain.rb +0 -7931
- data/lib/adlint/c/lexer.rb +0 -252
- data/lib/adlint/c/phase.rb +0 -135
- data/lib/adlint/exam/c_builtin/c_check.rb +0 -20745
- data/lib/adlint/exam/c_builtin/c_check_shima.rb +0 -983
- data/lib/adlint/exam/c_builtin/c_code.rb +0 -477
- data/lib/adlint/exam/c_builtin/c_metric.rb +0 -818
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
|
|
3
3
|
# / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
|
|
4
4
|
# / __ |/ /_/ / /___/ / /| / / /
|
|
5
|
-
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-
|
|
5
|
+
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
|
|
6
6
|
#
|
|
7
7
|
# This file is part of AdLint.
|
|
8
8
|
#
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
# - "ERR:X99"
|
|
50
50
|
# format: "Your custom message for the error of E9999."
|
|
51
51
|
|
|
52
|
-
version: "
|
|
52
|
+
version: "3.0.0"
|
|
53
53
|
|
|
54
54
|
message_definition:
|
|
55
55
|
W0001:
|
|
@@ -2915,15 +2915,15 @@ message_definition:
|
|
|
2915
2915
|
W1061:
|
|
2916
2916
|
classes:
|
|
2917
2917
|
- "UNC:X99"
|
|
2918
|
-
format: "
|
|
2918
|
+
format: "仮引数が列挙型である関数の実引数に異なる型の非定数式の値が渡されています。"
|
|
2919
2919
|
W1062:
|
|
2920
2920
|
classes:
|
|
2921
2921
|
- "UNC:X99"
|
|
2922
|
-
format: "
|
|
2922
|
+
format: "異なる型の非定数式の値が列挙型オブジェクトに代入されています。"
|
|
2923
2923
|
W1063:
|
|
2924
2924
|
classes:
|
|
2925
2925
|
- "UNC:X99"
|
|
2926
|
-
format: "
|
|
2926
|
+
format: "戻り値が列挙型の関数から、異なる型の非定数式の値が返されています。"
|
|
2927
2927
|
W1064:
|
|
2928
2928
|
classes:
|
|
2929
2929
|
- "UNC:X99"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
|
|
3
3
|
# / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
|
|
4
4
|
# / __ |/ /_/ / /___/ / /| / / /
|
|
5
|
-
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-
|
|
5
|
+
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
|
|
6
6
|
#
|
|
7
7
|
# This file is part of AdLint.
|
|
8
8
|
#
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
# - "ERR:X99"
|
|
50
50
|
# format: "Your custom message for the error of E9999."
|
|
51
51
|
|
|
52
|
-
version: "
|
|
52
|
+
version: "3.0.0"
|
|
53
53
|
|
|
54
54
|
message_definition:
|
|
55
55
|
X0001:
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
|
|
3
3
|
# / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
|
|
4
4
|
# / __ |/ /_/ / /___/ / /| / / /
|
|
5
|
-
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-
|
|
5
|
+
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
|
|
6
6
|
#
|
|
7
7
|
# This file is part of AdLint.
|
|
8
8
|
#
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
# - "ERR:X99"
|
|
50
50
|
# format: "Your custom message for the error of E9999."
|
|
51
51
|
|
|
52
|
-
version: "
|
|
52
|
+
version: "3.0.0"
|
|
53
53
|
|
|
54
54
|
message_definition:
|
|
55
55
|
X0001:
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
Feature: W0018
|
|
2
|
+
|
|
3
|
+
W0018 detects that precision of the conversion-specifier in `*printf'
|
|
4
|
+
function call is greater than 509.
|
|
5
|
+
|
|
6
|
+
Scenario: precision of `%f' conversion-specifier in `printf' function call is
|
|
7
|
+
greater than 509
|
|
8
|
+
Given a target source named "fixture.c" with:
|
|
9
|
+
"""
|
|
10
|
+
#include <stdio.h>
|
|
11
|
+
|
|
12
|
+
int foo(double d)
|
|
13
|
+
{
|
|
14
|
+
return printf("%.512f", d); /* W0018 */
|
|
15
|
+
}
|
|
16
|
+
"""
|
|
17
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
18
|
+
Then the output should exactly match with:
|
|
19
|
+
| mesg | line | column |
|
|
20
|
+
| W0117 | 3 | 5 |
|
|
21
|
+
| W0018 | 5 | 19 |
|
|
22
|
+
| W0104 | 3 | 16 |
|
|
23
|
+
| W0947 | 5 | 19 |
|
|
24
|
+
| W0628 | 3 | 5 |
|
|
25
|
+
|
|
26
|
+
Scenario: precision of `%f' conversion-specifier in `printf' function call is
|
|
27
|
+
equal to 510
|
|
28
|
+
Given a target source named "fixture.c" with:
|
|
29
|
+
"""
|
|
30
|
+
#include <stdio.h>
|
|
31
|
+
|
|
32
|
+
int foo(double d)
|
|
33
|
+
{
|
|
34
|
+
return printf("%.510f", d); /* W0018 */
|
|
35
|
+
}
|
|
36
|
+
"""
|
|
37
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
38
|
+
Then the output should exactly match with:
|
|
39
|
+
| mesg | line | column |
|
|
40
|
+
| W0117 | 3 | 5 |
|
|
41
|
+
| W0018 | 5 | 19 |
|
|
42
|
+
| W0104 | 3 | 16 |
|
|
43
|
+
| W0947 | 5 | 19 |
|
|
44
|
+
| W0628 | 3 | 5 |
|
|
45
|
+
|
|
46
|
+
Scenario: precision of `%f' conversion-specifier in `printf' function call is
|
|
47
|
+
equal to 509
|
|
48
|
+
Given a target source named "fixture.c" with:
|
|
49
|
+
"""
|
|
50
|
+
#include <stdio.h>
|
|
51
|
+
|
|
52
|
+
int foo(double d)
|
|
53
|
+
{
|
|
54
|
+
return printf("%.509f", d); /* OK */
|
|
55
|
+
}
|
|
56
|
+
"""
|
|
57
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
58
|
+
Then the output should exactly match with:
|
|
59
|
+
| mesg | line | column |
|
|
60
|
+
| W0117 | 3 | 5 |
|
|
61
|
+
| W0104 | 3 | 16 |
|
|
62
|
+
| W0947 | 5 | 19 |
|
|
63
|
+
| W0628 | 3 | 5 |
|
|
64
|
+
|
|
65
|
+
Scenario: precision of `%f' conversion-specifier in `printf' function call is
|
|
66
|
+
less than 509
|
|
67
|
+
Given a target source named "fixture.c" with:
|
|
68
|
+
"""
|
|
69
|
+
#include <stdio.h>
|
|
70
|
+
|
|
71
|
+
int foo(double d)
|
|
72
|
+
{
|
|
73
|
+
return printf("%.500f", d); /* OK */
|
|
74
|
+
}
|
|
75
|
+
"""
|
|
76
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
77
|
+
Then the output should exactly match with:
|
|
78
|
+
| mesg | line | column |
|
|
79
|
+
| W0117 | 3 | 5 |
|
|
80
|
+
| W0104 | 3 | 16 |
|
|
81
|
+
| W0947 | 5 | 19 |
|
|
82
|
+
| W0628 | 3 | 5 |
|
|
83
|
+
|
|
84
|
+
Scenario: no precision of `%f' conversion-specifier in `printf' function call
|
|
85
|
+
Given a target source named "fixture.c" with:
|
|
86
|
+
"""
|
|
87
|
+
#include <stdio.h>
|
|
88
|
+
|
|
89
|
+
int foo(double d)
|
|
90
|
+
{
|
|
91
|
+
return printf("%f", d); /* OK */
|
|
92
|
+
}
|
|
93
|
+
"""
|
|
94
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
95
|
+
Then the output should exactly match with:
|
|
96
|
+
| mesg | line | column |
|
|
97
|
+
| W0117 | 3 | 5 |
|
|
98
|
+
| W0104 | 3 | 16 |
|
|
99
|
+
| W0947 | 5 | 19 |
|
|
100
|
+
| W0628 | 3 | 5 |
|
|
101
|
+
|
|
102
|
+
Scenario: precision of `%f' conversion-specifier in `fprintf' function call
|
|
103
|
+
is greater than 509
|
|
104
|
+
Given a target source named "fixture.c" with:
|
|
105
|
+
"""
|
|
106
|
+
#include <stdio.h>
|
|
107
|
+
|
|
108
|
+
int foo(double d)
|
|
109
|
+
{
|
|
110
|
+
return fprintf(stdout, "%.512f", d); /* W0018 */
|
|
111
|
+
}
|
|
112
|
+
"""
|
|
113
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
114
|
+
Then the output should exactly match with:
|
|
115
|
+
| mesg | line | column |
|
|
116
|
+
| W0117 | 3 | 5 |
|
|
117
|
+
| W0018 | 5 | 28 |
|
|
118
|
+
| W0104 | 3 | 16 |
|
|
119
|
+
| W0947 | 5 | 28 |
|
|
120
|
+
| W0628 | 3 | 5 |
|
|
121
|
+
|
|
122
|
+
Scenario: precision of `%f' conversion-specifier in `fprintf' function call
|
|
123
|
+
is equal to 510
|
|
124
|
+
Given a target source named "fixture.c" with:
|
|
125
|
+
"""
|
|
126
|
+
#include <stdio.h>
|
|
127
|
+
|
|
128
|
+
int foo(double d)
|
|
129
|
+
{
|
|
130
|
+
return fprintf(stdout, "%.510f", d); /* W0018 */
|
|
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
|
+
| W0117 | 3 | 5 |
|
|
137
|
+
| W0018 | 5 | 28 |
|
|
138
|
+
| W0104 | 3 | 16 |
|
|
139
|
+
| W0947 | 5 | 28 |
|
|
140
|
+
| W0628 | 3 | 5 |
|
|
141
|
+
|
|
142
|
+
Scenario: precision of `%f' conversion-specifier in `fprintf' function call
|
|
143
|
+
is equal to 509
|
|
144
|
+
Given a target source named "fixture.c" with:
|
|
145
|
+
"""
|
|
146
|
+
#include <stdio.h>
|
|
147
|
+
|
|
148
|
+
int foo(double d)
|
|
149
|
+
{
|
|
150
|
+
return fprintf(stdout, "%.509f", d); /* OK */
|
|
151
|
+
}
|
|
152
|
+
"""
|
|
153
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
154
|
+
Then the output should exactly match with:
|
|
155
|
+
| mesg | line | column |
|
|
156
|
+
| W0117 | 3 | 5 |
|
|
157
|
+
| W0104 | 3 | 16 |
|
|
158
|
+
| W0947 | 5 | 28 |
|
|
159
|
+
| W0628 | 3 | 5 |
|
|
160
|
+
|
|
161
|
+
Scenario: precision of `%f' conversion-specifier in `fprintf' function call
|
|
162
|
+
is less than 509
|
|
163
|
+
Given a target source named "fixture.c" with:
|
|
164
|
+
"""
|
|
165
|
+
#include <stdio.h>
|
|
166
|
+
|
|
167
|
+
int foo(double d)
|
|
168
|
+
{
|
|
169
|
+
return fprintf(stdout, "%.500f", d); /* OK */
|
|
170
|
+
}
|
|
171
|
+
"""
|
|
172
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
173
|
+
Then the output should exactly match with:
|
|
174
|
+
| mesg | line | column |
|
|
175
|
+
| W0117 | 3 | 5 |
|
|
176
|
+
| W0104 | 3 | 16 |
|
|
177
|
+
| W0947 | 5 | 28 |
|
|
178
|
+
| W0628 | 3 | 5 |
|
|
179
|
+
|
|
180
|
+
Scenario: no precision of `%f' conversion-specifier in `fprintf' function
|
|
181
|
+
call
|
|
182
|
+
Given a target source named "fixture.c" with:
|
|
183
|
+
"""
|
|
184
|
+
#include <stdio.h>
|
|
185
|
+
|
|
186
|
+
int foo(double d)
|
|
187
|
+
{
|
|
188
|
+
return fprintf(stdout, "%f", d); /* OK */
|
|
189
|
+
}
|
|
190
|
+
"""
|
|
191
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
192
|
+
Then the output should exactly match with:
|
|
193
|
+
| mesg | line | column |
|
|
194
|
+
| W0117 | 3 | 5 |
|
|
195
|
+
| W0104 | 3 | 16 |
|
|
196
|
+
| W0947 | 5 | 28 |
|
|
197
|
+
| W0628 | 3 | 5 |
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
Feature: W0019
|
|
2
|
+
|
|
3
|
+
W0019 detects that a pointer-cast deletes `const' qualifier.
|
|
4
|
+
|
|
5
|
+
Scenario: casting const int pointer to int pointer
|
|
6
|
+
Given a target source named "fixture.c" with:
|
|
7
|
+
"""
|
|
8
|
+
int foo(const int *p)
|
|
9
|
+
{
|
|
10
|
+
int *q;
|
|
11
|
+
q = (int *) p; /* W0019 */
|
|
12
|
+
return -1;
|
|
13
|
+
}
|
|
14
|
+
"""
|
|
15
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
16
|
+
Then the output should exactly match with:
|
|
17
|
+
| mesg | line | column |
|
|
18
|
+
| W0117 | 1 | 5 |
|
|
19
|
+
| W0019 | 4 | 9 |
|
|
20
|
+
| W0100 | 3 | 10 |
|
|
21
|
+
| W0104 | 1 | 20 |
|
|
22
|
+
| W0628 | 1 | 5 |
|
|
23
|
+
|
|
24
|
+
Scenario: casting const unsigned short pointer to short pointer
|
|
25
|
+
Given a target source named "fixture.c" with:
|
|
26
|
+
"""
|
|
27
|
+
int foo(const unsigned short *p)
|
|
28
|
+
{
|
|
29
|
+
unsigned short *q;
|
|
30
|
+
q = (short *) p; /* W0019 */
|
|
31
|
+
return -1;
|
|
32
|
+
}
|
|
33
|
+
"""
|
|
34
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
35
|
+
Then the output should exactly match with:
|
|
36
|
+
| mesg | line | column |
|
|
37
|
+
| W0117 | 1 | 5 |
|
|
38
|
+
| W0019 | 4 | 9 |
|
|
39
|
+
| W9003 | 4 | 9 |
|
|
40
|
+
| W0100 | 3 | 21 |
|
|
41
|
+
| W0104 | 1 | 31 |
|
|
42
|
+
| W0628 | 1 | 5 |
|
|
43
|
+
|
|
44
|
+
Scenario: assigning compatible const pointers
|
|
45
|
+
Given a target source named "fixture.c" with:
|
|
46
|
+
"""
|
|
47
|
+
int foo(const int *p)
|
|
48
|
+
{
|
|
49
|
+
const int *q;
|
|
50
|
+
q = p; /* OK */
|
|
51
|
+
return -1;
|
|
52
|
+
}
|
|
53
|
+
"""
|
|
54
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
55
|
+
Then the output should exactly match with:
|
|
56
|
+
| mesg | line | column |
|
|
57
|
+
| W0117 | 1 | 5 |
|
|
58
|
+
| W0100 | 3 | 16 |
|
|
59
|
+
| W0104 | 1 | 20 |
|
|
60
|
+
| W0628 | 1 | 5 |
|
|
61
|
+
|
|
62
|
+
Scenario: casting const int array pointer to int pointer
|
|
63
|
+
Given a target source named "fixture.c" with:
|
|
64
|
+
"""
|
|
65
|
+
const int a[] = { 0, 1, 2 };
|
|
66
|
+
|
|
67
|
+
int foo(void)
|
|
68
|
+
{
|
|
69
|
+
const int *p = a; /* OK */
|
|
70
|
+
return -1;
|
|
71
|
+
}
|
|
72
|
+
"""
|
|
73
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
74
|
+
Then the output should exactly match with:
|
|
75
|
+
| mesg | line | column |
|
|
76
|
+
| W0117 | 1 | 11 |
|
|
77
|
+
| W0117 | 3 | 5 |
|
|
78
|
+
| W0100 | 5 | 16 |
|
|
79
|
+
| W0628 | 3 | 5 |
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
Feature: W0021
|
|
2
|
+
|
|
3
|
+
W0021 detects that a pointer-cast deletes `volatile' qualifier.
|
|
4
|
+
|
|
5
|
+
Scenario: casting volatile int pointer to int pointer
|
|
6
|
+
Given a target source named "fixture.c" with:
|
|
7
|
+
"""
|
|
8
|
+
int foo(volatile int *p)
|
|
9
|
+
{
|
|
10
|
+
int *q;
|
|
11
|
+
q = (int *) p; /* W0021 */
|
|
12
|
+
return -1;
|
|
13
|
+
}
|
|
14
|
+
"""
|
|
15
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
16
|
+
Then the output should exactly match with:
|
|
17
|
+
| mesg | line | column |
|
|
18
|
+
| W0117 | 1 | 5 |
|
|
19
|
+
| W0021 | 4 | 9 |
|
|
20
|
+
| W0100 | 3 | 10 |
|
|
21
|
+
| W0104 | 1 | 23 |
|
|
22
|
+
| W0105 | 1 | 23 |
|
|
23
|
+
| W0628 | 1 | 5 |
|
|
24
|
+
|
|
25
|
+
Scenario: casting volatile const int pointer to int pointer
|
|
26
|
+
Given a target source named "fixture.c" with:
|
|
27
|
+
"""
|
|
28
|
+
int foo(volatile const int *p)
|
|
29
|
+
{
|
|
30
|
+
int *q;
|
|
31
|
+
q = (int *) p; /* W0021 */
|
|
32
|
+
return -1;
|
|
33
|
+
}
|
|
34
|
+
"""
|
|
35
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
36
|
+
Then the output should exactly match with:
|
|
37
|
+
| mesg | line | column |
|
|
38
|
+
| W0117 | 1 | 5 |
|
|
39
|
+
| W0019 | 4 | 9 |
|
|
40
|
+
| W0021 | 4 | 9 |
|
|
41
|
+
| W0100 | 3 | 10 |
|
|
42
|
+
| W0104 | 1 | 29 |
|
|
43
|
+
| W0628 | 1 | 5 |
|
|
44
|
+
|
|
45
|
+
Scenario: assigning compatible volatile pointers
|
|
46
|
+
Given a target source named "fixture.c" with:
|
|
47
|
+
"""
|
|
48
|
+
int foo(volatile int *p)
|
|
49
|
+
{
|
|
50
|
+
volatile int *q;
|
|
51
|
+
q = p; /* OK */
|
|
52
|
+
return -1;
|
|
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
|
+
| W0117 | 1 | 5 |
|
|
59
|
+
| W0100 | 3 | 19 |
|
|
60
|
+
| W0104 | 1 | 23 |
|
|
61
|
+
| W0105 | 1 | 23 |
|
|
62
|
+
| W0628 | 1 | 5 |
|
|
63
|
+
|
|
64
|
+
Scenario: casting volatile int array pointer to int pointer
|
|
65
|
+
Given a target source named "fixture.c" with:
|
|
66
|
+
"""
|
|
67
|
+
volatile int a[] = { 0, 1, 2 };
|
|
68
|
+
|
|
69
|
+
int foo(void)
|
|
70
|
+
{
|
|
71
|
+
volatile int *p = a; /* OK */
|
|
72
|
+
return -1;
|
|
73
|
+
}
|
|
74
|
+
"""
|
|
75
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
76
|
+
Then the output should exactly match with:
|
|
77
|
+
| mesg | line | column |
|
|
78
|
+
| W0117 | 1 | 14 |
|
|
79
|
+
| W0117 | 3 | 5 |
|
|
80
|
+
| W0100 | 5 | 19 |
|
|
81
|
+
| W0628 | 3 | 5 |
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
Feature: W0023
|
|
2
|
+
|
|
3
|
+
W0023 detects that a pointer variable appears in the arithmetic operation.
|
|
4
|
+
|
|
5
|
+
Scenario: additive-expression with a pointer variable
|
|
6
|
+
Given a target source named "fixture.c" with:
|
|
7
|
+
"""
|
|
8
|
+
long func(const int * const p)
|
|
9
|
+
{
|
|
10
|
+
const long r = p + 10L; /* W0023 */
|
|
11
|
+
return r;
|
|
12
|
+
}
|
|
13
|
+
"""
|
|
14
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
15
|
+
Then the output should exactly match with:
|
|
16
|
+
| mesg | line | column |
|
|
17
|
+
| W0117 | 1 | 6 |
|
|
18
|
+
| W9003 | 3 | 24 |
|
|
19
|
+
| W0023 | 3 | 22 |
|
|
20
|
+
| W0424 | 3 | 20 |
|
|
21
|
+
| W9003 | 3 | 22 |
|
|
22
|
+
| W0628 | 1 | 6 |
|
|
23
|
+
|
|
24
|
+
Scenario: multiplicative-expression with a pointer variable
|
|
25
|
+
Given a target source named "fixture.c" with:
|
|
26
|
+
"""
|
|
27
|
+
long func(const int * const p)
|
|
28
|
+
{
|
|
29
|
+
const long r = p * 2L; /* W0023 */
|
|
30
|
+
return r;
|
|
31
|
+
}
|
|
32
|
+
"""
|
|
33
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
34
|
+
Then the output should exactly match with:
|
|
35
|
+
| mesg | line | column |
|
|
36
|
+
| W0117 | 1 | 6 |
|
|
37
|
+
| W9003 | 3 | 24 |
|
|
38
|
+
| W0023 | 3 | 22 |
|
|
39
|
+
| W0424 | 3 | 20 |
|
|
40
|
+
| W9003 | 3 | 22 |
|
|
41
|
+
| W0628 | 1 | 6 |
|
|
42
|
+
|
|
43
|
+
Scenario: additive-expression with pointer variables
|
|
44
|
+
Given a target source named "fixture.c" with:
|
|
45
|
+
"""
|
|
46
|
+
long func(const int * const p, const int * const q)
|
|
47
|
+
{
|
|
48
|
+
const long r = p - q; /* W0023 */
|
|
49
|
+
return r;
|
|
50
|
+
}
|
|
51
|
+
"""
|
|
52
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
53
|
+
Then the output should exactly match with:
|
|
54
|
+
| mesg | line | column |
|
|
55
|
+
| W0117 | 1 | 6 |
|
|
56
|
+
| W0023 | 3 | 22 |
|
|
57
|
+
| W0424 | 3 | 20 |
|
|
58
|
+
| W0424 | 3 | 24 |
|
|
59
|
+
| W1052 | 3 | 22 |
|
|
60
|
+
| W9003 | 3 | 22 |
|
|
61
|
+
| W0628 | 1 | 6 |
|
|
62
|
+
|
|
63
|
+
Scenario: multiplicative-expression with pointer variables
|
|
64
|
+
Given a target source named "fixture.c" with:
|
|
65
|
+
"""
|
|
66
|
+
long func(const int * const p, const int * const q)
|
|
67
|
+
{
|
|
68
|
+
const long r = p / q; /* W0023 */
|
|
69
|
+
return r;
|
|
70
|
+
}
|
|
71
|
+
"""
|
|
72
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
73
|
+
Then the output should exactly match with:
|
|
74
|
+
| mesg | line | column |
|
|
75
|
+
| W0117 | 1 | 6 |
|
|
76
|
+
| W0023 | 3 | 22 |
|
|
77
|
+
| W0093 | 3 | 22 |
|
|
78
|
+
| W0424 | 3 | 20 |
|
|
79
|
+
| W0424 | 3 | 24 |
|
|
80
|
+
| W9003 | 3 | 22 |
|
|
81
|
+
| W0628 | 1 | 6 |
|
|
82
|
+
|
|
83
|
+
Scenario: additive-expression and multiplicative-expression with
|
|
84
|
+
pointer variables
|
|
85
|
+
Given a target source named "fixture.c" with:
|
|
86
|
+
"""
|
|
87
|
+
long func(const int * const p, const int * const q, const int * const r)
|
|
88
|
+
{
|
|
89
|
+
const long s = (p + q) * r; /* W0023 */
|
|
90
|
+
return s;
|
|
91
|
+
}
|
|
92
|
+
"""
|
|
93
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
94
|
+
Then the output should exactly match with:
|
|
95
|
+
| mesg | line | column |
|
|
96
|
+
| W0117 | 1 | 6 |
|
|
97
|
+
| W0023 | 3 | 23 |
|
|
98
|
+
| W0424 | 3 | 21 |
|
|
99
|
+
| W0424 | 3 | 25 |
|
|
100
|
+
| W1052 | 3 | 23 |
|
|
101
|
+
| W0023 | 3 | 28 |
|
|
102
|
+
| W0424 | 3 | 20 |
|
|
103
|
+
| W0424 | 3 | 30 |
|
|
104
|
+
| W1052 | 3 | 28 |
|
|
105
|
+
| W9003 | 3 | 28 |
|
|
106
|
+
| W0628 | 1 | 6 |
|
|
107
|
+
|
|
108
|
+
Scenario: additive-expression and increment operation with pointer variables
|
|
109
|
+
Given a target source named "fixture.c" with:
|
|
110
|
+
"""
|
|
111
|
+
long func(const int * const p, const int * const q)
|
|
112
|
+
{
|
|
113
|
+
const long r = q - p + 1; /* W0023 */
|
|
114
|
+
return r;
|
|
115
|
+
}
|
|
116
|
+
"""
|
|
117
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
118
|
+
Then the output should exactly match with:
|
|
119
|
+
| mesg | line | column |
|
|
120
|
+
| W0117 | 1 | 6 |
|
|
121
|
+
| W0023 | 3 | 22 |
|
|
122
|
+
| W0424 | 3 | 20 |
|
|
123
|
+
| W0424 | 3 | 24 |
|
|
124
|
+
| W1052 | 3 | 22 |
|
|
125
|
+
| W9003 | 3 | 28 |
|
|
126
|
+
| W0024 | 3 | 26 |
|
|
127
|
+
| W0424 | 3 | 22 |
|
|
128
|
+
| W9003 | 3 | 26 |
|
|
129
|
+
| W0498 | 3 | 20 |
|
|
130
|
+
| W0628 | 1 | 6 |
|
|
131
|
+
|
|
132
|
+
Scenario: additive-expression with an array vairable
|
|
133
|
+
Given a target source named "fixture.c" with:
|
|
134
|
+
"""
|
|
135
|
+
long func(void)
|
|
136
|
+
{
|
|
137
|
+
const long a[] = { 0, 1, 2 };
|
|
138
|
+
const long r = a + 10L; /* W0023 */
|
|
139
|
+
return r;
|
|
140
|
+
}
|
|
141
|
+
"""
|
|
142
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
143
|
+
Then the output should exactly match with:
|
|
144
|
+
| mesg | line | column |
|
|
145
|
+
| W0117 | 1 | 6 |
|
|
146
|
+
| W9003 | 4 | 24 |
|
|
147
|
+
| W0023 | 4 | 22 |
|
|
148
|
+
| W9003 | 4 | 22 |
|
|
149
|
+
| W0628 | 1 | 6 |
|
|
150
|
+
|
|
151
|
+
Scenario: shift-expression with pointer variables
|
|
152
|
+
Given a target source named "fixture.c" with:
|
|
153
|
+
"""
|
|
154
|
+
long func(const int * const p, const int * const q)
|
|
155
|
+
{
|
|
156
|
+
const long r = p << q; /* OK */
|
|
157
|
+
return r;
|
|
158
|
+
}
|
|
159
|
+
"""
|
|
160
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
161
|
+
Then the output should exactly match with:
|
|
162
|
+
| mesg | line | column |
|
|
163
|
+
| W0117 | 1 | 6 |
|
|
164
|
+
| W0116 | 3 | 22 |
|
|
165
|
+
| W0424 | 3 | 20 |
|
|
166
|
+
| W0424 | 3 | 25 |
|
|
167
|
+
| W9003 | 3 | 22 |
|
|
168
|
+
| W0628 | 1 | 6 |
|
|
169
|
+
|
|
170
|
+
Scenario: equality-expression with pointer variables
|
|
171
|
+
Given a target source named "fixture.c" with:
|
|
172
|
+
"""
|
|
173
|
+
int func(const int * const p, const int * const q)
|
|
174
|
+
{
|
|
175
|
+
return p != q; /* OK */
|
|
176
|
+
}
|
|
177
|
+
"""
|
|
178
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
179
|
+
Then the output should exactly match with:
|
|
180
|
+
| mesg | line | column |
|
|
181
|
+
| W0117 | 1 | 5 |
|
|
182
|
+
| W0027 | 3 | 14 |
|
|
183
|
+
| W0628 | 1 | 5 |
|
|
184
|
+
|
|
185
|
+
Scenario: assignment-expression with a pointer variable
|
|
186
|
+
Given a target source named "fixture.c" with:
|
|
187
|
+
"""
|
|
188
|
+
long func(const int * const p)
|
|
189
|
+
{
|
|
190
|
+
long r = 0;
|
|
191
|
+
r += p; /* OK */
|
|
192
|
+
return r;
|
|
193
|
+
}
|
|
194
|
+
"""
|
|
195
|
+
When I successfully run `adlint fixture.c` on noarch
|
|
196
|
+
Then the output should exactly match with:
|
|
197
|
+
| mesg | line | column |
|
|
198
|
+
| W0117 | 1 | 6 |
|
|
199
|
+
| W9003 | 4 | 5 |
|
|
200
|
+
| W0023 | 4 | 7 |
|
|
201
|
+
| W0424 | 4 | 10 |
|
|
202
|
+
| W9003 | 4 | 5 |
|
|
203
|
+
| W0628 | 1 | 6 |
|