adlint 1.12.0 → 1.14.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/ChangeLog +133 -34
- data/MANIFEST +10 -0
- data/NEWS +22 -4
- data/etc/mesg.d/en_US/messages.yml +1 -1
- data/etc/mesg.d/ja_JP/messages.yml +1 -1
- data/features/message_detection/W0093.feature +3 -3
- data/features/message_detection/W0104.feature +111 -0
- data/features/message_detection/W0606.feature +1 -1
- data/features/message_detection/W0645.feature +142 -0
- data/features/message_detection/W0697.feature +183 -0
- data/features/message_detection/W0699.feature +1 -0
- data/features/message_detection/W0700.feature +56 -0
- data/features/message_detection/W1031.feature +18 -18
- data/features/message_detection/W1066.feature +88 -0
- data/features/message_detection/W1067.feature +88 -0
- data/features/message_detection/W1068.feature +88 -0
- data/features/message_detection/W1069.feature +120 -0
- data/features/message_detection/W1070.feature +145 -0
- data/features/message_detection/W1072.feature +32 -0
- data/lib/adlint/c/interp.rb +17 -10
- data/lib/adlint/c/mediator.rb +1 -0
- data/lib/adlint/c/message_shima.rb +222 -0
- data/lib/adlint/c/phase.rb +9 -0
- data/lib/adlint/c/type.rb +13 -12
- data/lib/adlint/version.rb +2 -2
- data/share/doc/developers_guide_ja.html +3 -3
- data/share/doc/developers_guide_ja.texi +1 -1
- data/share/doc/users_guide_en.html +59 -50
- data/share/doc/users_guide_en.texi +48 -40
- data/share/doc/users_guide_ja.html +60 -52
- data/share/doc/users_guide_ja.texi +49 -41
- metadata +12 -2
@@ -1,8 +1,8 @@
|
|
1
1
|
<html lang="ja">
|
2
2
|
<head>
|
3
|
-
<title>AdLint 1.
|
3
|
+
<title>AdLint 1.14.0 利用者ガイド</title>
|
4
4
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
5
|
-
<meta name="description" content="AdLint 1.
|
5
|
+
<meta name="description" content="AdLint 1.14.0 利用者ガイド">
|
6
6
|
<meta name="generator" content="makeinfo 4.13">
|
7
7
|
<link title="Top" rel="top" href="#Top">
|
8
8
|
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
@@ -44,7 +44,7 @@ td { border: 1px solid black; }
|
|
44
44
|
--></style>
|
45
45
|
</head>
|
46
46
|
<body>
|
47
|
-
<h1 class="settitle">AdLint 1.
|
47
|
+
<h1 class="settitle">AdLint 1.14.0 利用者ガイド</h1>
|
48
48
|
<div class="node">
|
49
49
|
<a name="Top"></a>
|
50
50
|
<p><hr>
|
@@ -30894,14 +30894,14 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
30894
30894
|
|
30895
30895
|
<h4 class="subsection">6.527.2 内容</h4>
|
30896
30896
|
|
30897
|
-
<p
|
30898
|
-
|
30899
|
-
<p>未定義の動作のため、予期しない動作を引き起こす可能性があります。
|
30897
|
+
<p>未定義の動作のため、予期しない動作を引き起こす可能性があります。
|
30900
30898
|
|
30901
30899
|
<h4 class="subsection">6.527.3 サンプルコード</h4>
|
30902
30900
|
|
30903
|
-
|
30904
|
-
|
30901
|
+
<pre class="verbatim">extern void func(a) /* W0645 */
|
30902
|
+
void a;
|
30903
|
+
{
|
30904
|
+
}
|
30905
30905
|
</pre>
|
30906
30906
|
|
30907
30907
|
<h4 class="subsection">6.527.4 関連メッセージ</h4>
|
@@ -30915,7 +30915,7 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
30915
30915
|
|
30916
30916
|
<h4 class="subsection">6.527.5 対応バージョン</h4>
|
30917
30917
|
|
30918
|
-
<p>
|
30918
|
+
<p>1.14.0
|
30919
30919
|
|
30920
30920
|
<div class="node">
|
30921
30921
|
<a name="W0646"></a>
|
@@ -33778,9 +33778,7 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
33778
33778
|
|
33779
33779
|
<h4 class="subsection">6.575.2 内容</h4>
|
33780
33780
|
|
33781
|
-
<p
|
33782
|
-
|
33783
|
-
<p>式を持たない <code>return</code> 文は不定値を返します。
|
33781
|
+
<p>式を持たない <code>return</code> 文は不定値を返します。
|
33784
33782
|
|
33785
33783
|
<h4 class="subsection">6.575.3 サンプルコード</h4>
|
33786
33784
|
|
@@ -33789,7 +33787,7 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
33789
33787
|
if (value == 0) {
|
33790
33788
|
return 0;
|
33791
33789
|
}
|
33792
|
-
|
33790
|
+
/* No return statement at the end of this function. */
|
33793
33791
|
}
|
33794
33792
|
</pre>
|
33795
33793
|
|
@@ -33803,7 +33801,7 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
33803
33801
|
|
33804
33802
|
<h4 class="subsection">6.575.5 対応バージョン</h4>
|
33805
33803
|
|
33806
|
-
<p>
|
33804
|
+
<p>1.14.0
|
33807
33805
|
|
33808
33806
|
<div class="node">
|
33809
33807
|
<a name="W0698"></a>
|
@@ -33906,14 +33904,13 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
33906
33904
|
|
33907
33905
|
<h4 class="subsection">6.578.2 内容</h4>
|
33908
33906
|
|
33909
|
-
<p
|
33910
|
-
|
33911
|
-
<p>式を持たない <code>return</code> 文は不定値を返します。
|
33907
|
+
<p>式を持たない <code>return</code> 文は不定値を返します。
|
33912
33908
|
|
33913
33909
|
<h4 class="subsection">6.578.3 サンプルコード</h4>
|
33914
33910
|
|
33915
|
-
|
33916
|
-
|
33911
|
+
<pre class="verbatim">extern func(void) /* W0700 */
|
33912
|
+
{
|
33913
|
+
}
|
33917
33914
|
</pre>
|
33918
33915
|
|
33919
33916
|
<h4 class="subsection">6.578.4 関連メッセージ</h4>
|
@@ -33926,7 +33923,7 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
33926
33923
|
|
33927
33924
|
<h4 class="subsection">6.578.5 対応バージョン</h4>
|
33928
33925
|
|
33929
|
-
<p>
|
33926
|
+
<p>1.14.0
|
33930
33927
|
|
33931
33928
|
<div class="node">
|
33932
33929
|
<a name="W0703"></a>
|
@@ -40838,9 +40835,7 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
40838
40835
|
|
40839
40836
|
<h4 class="subsection">6.731.2 内容</h4>
|
40840
40837
|
|
40841
|
-
<p
|
40842
|
-
|
40843
|
-
<p>例えばサンプルコードでは <code>float</code> 型変数 <code>a</code> の 2 乗した値が <code>float</code> 型の範囲に収まらないことを想定して
|
40838
|
+
<p>例えばサンプルコードでは <code>float</code> 型変数 <code>a</code> の 2 乗した値が <code>float</code> 型の範囲に収まらないことを想定して
|
40844
40839
|
<code>double</code> 型変数 <code>b</code> へ代入しています。しかし、環境によっては <code>a * a</code> の演算はいったん <code>float</code> 型として
|
40845
40840
|
結果を出したあとに <code>double</code> 型にキャストされ、<code>b</code> へ代入される場合があります。その場合、<code>a</code> の値によっては精度落ちが起こります。
|
40846
40841
|
|
@@ -40861,7 +40856,7 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
40861
40856
|
|
40862
40857
|
<h4 class="subsection">6.731.5 対応バージョン</h4>
|
40863
40858
|
|
40864
|
-
<p>
|
40859
|
+
<p>1.14.0
|
40865
40860
|
|
40866
40861
|
<div class="node">
|
40867
40862
|
<a name="W1067"></a>
|
@@ -40882,9 +40877,7 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
40882
40877
|
|
40883
40878
|
<h4 class="subsection">6.732.2 内容</h4>
|
40884
40879
|
|
40885
|
-
<p
|
40886
|
-
|
40887
|
-
<p>例えばサンプルコードでは <code>float</code> 型変数 <code>a</code> の 2 乗した値が <code>float</code> 型の範囲に収まらないことを想定して
|
40880
|
+
<p>例えばサンプルコードでは <code>float</code> 型変数 <code>a</code> の 2 乗した値が <code>float</code> 型の範囲に収まらないことを想定して
|
40888
40881
|
<code>long double</code> 型変数 <code>b</code> へ代入しています。しかし、環境によっては <code>a * a</code> の演算はいったん <code>float</code> 型として
|
40889
40882
|
結果を出したあとに <code>long double</code> 型にキャストされ、<code>b</code> へ代入される場合があります。その場合、<code>a</code> の値によっては精度落ちが起こります。
|
40890
40883
|
|
@@ -40905,7 +40898,7 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
40905
40898
|
|
40906
40899
|
<h4 class="subsection">6.732.5 対応バージョン</h4>
|
40907
40900
|
|
40908
|
-
<p>
|
40901
|
+
<p>1.14.0
|
40909
40902
|
|
40910
40903
|
<div class="node">
|
40911
40904
|
<a name="W1068"></a>
|
@@ -40926,9 +40919,7 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
40926
40919
|
|
40927
40920
|
<h4 class="subsection">6.733.2 内容</h4>
|
40928
40921
|
|
40929
|
-
<p
|
40930
|
-
|
40931
|
-
<p>例えばサンプルコードでは <code>double</code> 型変数 <code>a</code> の 2 乗した値が <code>double</code> 型の範囲に収まらないことを想定して
|
40922
|
+
<p>例えばサンプルコードでは <code>double</code> 型変数 <code>a</code> の 2 乗した値が <code>double</code> 型の範囲に収まらないことを想定して
|
40932
40923
|
<code>long double</code> 型変数 <code>b</code> へ代入しています。しかし、環境によっては <code>a * a</code> の演算はいったん <code>double</code> 型として
|
40933
40924
|
結果を出したあとに <code>long double</code> 型にキャストされ、<code>b</code> へ代入される場合があります。その場合、<code>a</code> の値によっては精度落ちが起こります。
|
40934
40925
|
|
@@ -40949,7 +40940,7 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
40949
40940
|
|
40950
40941
|
<h4 class="subsection">6.733.5 対応バージョン</h4>
|
40951
40942
|
|
40952
|
-
<p>
|
40943
|
+
<p>1.14.0
|
40953
40944
|
|
40954
40945
|
<div class="node">
|
40955
40946
|
<a name="W1069"></a>
|
@@ -40970,13 +40961,20 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
40970
40961
|
|
40971
40962
|
<h4 class="subsection">6.734.2 内容</h4>
|
40972
40963
|
|
40973
|
-
<p><
|
40974
|
-
|
40975
|
-
<p><code>else</code> 節がないと、 <code>else</code> 節を書き忘れているのか、 <code>else</code> 節が発生しない <code>if-else if</code> 文なのかが分からず、混乱を招きます。
|
40964
|
+
<p><code>else</code> 節がないと、 <code>else</code> 節を書き忘れているのか、 <code>else</code> 節が発生しない <code>if-else if</code> 文なのかが分からず、混乱を招きます。
|
40976
40965
|
|
40977
40966
|
<h4 class="subsection">6.734.3 サンプルコード</h4>
|
40978
40967
|
|
40979
|
-
<pre class="verbatim"
|
40968
|
+
<pre class="verbatim">static int func(int i)
|
40969
|
+
{
|
40970
|
+
if (i == 2) { /* W1069 */
|
40971
|
+
return 0;
|
40972
|
+
}
|
40973
|
+
else if (i == 4) {
|
40974
|
+
return 1;
|
40975
|
+
}
|
40976
|
+
return 2;
|
40977
|
+
}
|
40980
40978
|
</pre>
|
40981
40979
|
|
40982
40980
|
<h4 class="subsection">6.734.4 関連メッセージ</h4>
|
@@ -40985,7 +40983,7 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
40985
40983
|
|
40986
40984
|
<h4 class="subsection">6.734.5 対応バージョン</h4>
|
40987
40985
|
|
40988
|
-
<p>
|
40986
|
+
<p>1.14.0
|
40989
40987
|
|
40990
40988
|
<div class="node">
|
40991
40989
|
<a name="W1070"></a>
|
@@ -41006,14 +41004,12 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
41006
41004
|
|
41007
41005
|
<h4 class="subsection">6.735.2 内容</h4>
|
41008
41006
|
|
41009
|
-
<p
|
41010
|
-
|
41011
|
-
<p>深刻な問題ではありませんが、通常 <code>switch</code> 文は 2 つ以上の分岐があることが想定されるので、
|
41007
|
+
<p>深刻な問題ではありませんが、通常 <code>switch</code> 文は 2 つ以上の分岐があることが想定されるので、
|
41012
41008
|
<code>case</code> 節が 1 つしかない <code>switch</code> 文では、実行パスの定義漏れが疑われます。
|
41013
41009
|
|
41014
41010
|
<h4 class="subsection">6.735.3 サンプルコード</h4>
|
41015
41011
|
|
41016
|
-
<pre class="verbatim">switch (x) {
|
41012
|
+
<pre class="verbatim">switch (x) { /* W1070 */
|
41017
41013
|
case 1:
|
41018
41014
|
...
|
41019
41015
|
break;
|
@@ -41028,7 +41024,7 @@ default:
|
|
41028
41024
|
|
41029
41025
|
<h4 class="subsection">6.735.5 対応バージョン</h4>
|
41030
41026
|
|
41031
|
-
<p>
|
41027
|
+
<p>1.14.0
|
41032
41028
|
|
41033
41029
|
<div class="node">
|
41034
41030
|
<a name="W1071"></a>
|
@@ -41093,13 +41089,24 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
41093
41089
|
|
41094
41090
|
<h4 class="subsection">6.737.2 内容</h4>
|
41095
41091
|
|
41096
|
-
<p
|
41097
|
-
|
41098
|
-
<p>ファイル内で <code>goto</code> 文が使用されています。
|
41092
|
+
<p>ファイル内で <code>goto</code> 文が使用されています。
|
41099
41093
|
|
41100
41094
|
<h4 class="subsection">6.737.3 サンプルコード</h4>
|
41101
41095
|
|
41102
|
-
<pre class="verbatim"
|
41096
|
+
<pre class="verbatim">static int func(int i)
|
41097
|
+
{
|
41098
|
+
if (i == 1) {
|
41099
|
+
goto Label1; /* W1072 */
|
41100
|
+
}
|
41101
|
+
|
41102
|
+
goto Label2; /* W1072 */
|
41103
|
+
|
41104
|
+
Label1:
|
41105
|
+
i = 10;
|
41106
|
+
Label2:
|
41107
|
+
i = 20;
|
41108
|
+
return i;
|
41109
|
+
}
|
41103
41110
|
</pre>
|
41104
41111
|
|
41105
41112
|
<h4 class="subsection">6.737.4 関連メッセージ</h4>
|
@@ -41108,7 +41115,7 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
41108
41115
|
|
41109
41116
|
<h4 class="subsection">6.737.5 対応バージョン</h4>
|
41110
41117
|
|
41111
|
-
<p>
|
41118
|
+
<p>1.14.0
|
41112
41119
|
|
41113
41120
|
<div class="node">
|
41114
41121
|
<a name="W1073"></a>
|
@@ -42168,11 +42175,12 @@ Up: <a rel="up" accesskey="u" href="#Metrics">Metrics</a>
|
|
42168
42175
|
|
42169
42176
|
<h4 class="subsection">7.12.1 メトリック名</h4>
|
42170
42177
|
|
42171
|
-
<p>関数内の完結していない <code>if</code> 文の数
|
42178
|
+
<p>関数内の完結していない <code>if-else</code> 文の数
|
42172
42179
|
|
42173
42180
|
<h4 class="subsection">7.12.2 内容</h4>
|
42174
42181
|
|
42175
|
-
<p>関数内の <code>if</code>
|
42182
|
+
<p>関数内の <code>if-else</code> 文で、明示的な <code>else</code> 節を持たないものの数を示しま
|
42183
|
+
す。
|
42176
42184
|
|
42177
42185
|
<h4 class="subsection">7.12.3 サンプルコード</h4>
|
42178
42186
|
|
@@ -42190,7 +42198,7 @@ Up: <a rel="up" accesskey="u" href="#Metrics">Metrics</a>
|
|
42190
42198
|
if (j % 2) {
|
42191
42199
|
return -1;
|
42192
42200
|
}
|
42193
|
-
/*
|
42201
|
+
/* A standalone if-statement does nothing to the FN_UELS metric */
|
42194
42202
|
|
42195
42203
|
if (i == 2) {
|
42196
42204
|
return 0;
|
@@ -42202,11 +42210,11 @@ Up: <a rel="up" accesskey="u" href="#Metrics">Metrics</a>
|
|
42202
42210
|
|
42203
42211
|
return 5;
|
42204
42212
|
|
42205
|
-
/* foo's FN_UELS ==
|
42213
|
+
/* foo's FN_UELS == 1 */
|
42206
42214
|
}
|
42207
42215
|
</pre>
|
42208
42216
|
|
42209
|
-
<pre class="example"> MET,FN_UELS,foo,int foo(int),test.c,1,5,
|
42217
|
+
<pre class="example"> MET,FN_UELS,foo,int foo(int),test.c,1,5,1
|
42210
42218
|
</pre>
|
42211
42219
|
<h4 class="subsection">7.12.4 対応バージョン</h4>
|
42212
42220
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
@setfilename users_guide_ja.info
|
3
3
|
@documentlanguage ja
|
4
4
|
@documentencoding utf-8
|
5
|
-
@settitle AdLint 1.
|
5
|
+
@settitle AdLint 1.14.0 利用者ガイド
|
6
6
|
|
7
7
|
@copying
|
8
8
|
Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
|
@@ -26680,15 +26680,15 @@ if(func() == 0) { /* W0644 */
|
|
26680
26680
|
|
26681
26681
|
@subsection 内容
|
26682
26682
|
|
26683
|
-
@b{このメッセージは AdLint 2.0.0 で出力する予定です。}
|
26684
|
-
|
26685
26683
|
未定義の動作のため、予期しない動作を引き起こす可能性があります。
|
26686
26684
|
|
26687
26685
|
@subsection サンプルコード
|
26688
26686
|
|
26689
|
-
@c{未実装}
|
26690
26687
|
@verbatim
|
26691
|
-
/*
|
26688
|
+
extern void func(a) /* W0645 */
|
26689
|
+
void a;
|
26690
|
+
{
|
26691
|
+
}
|
26692
26692
|
@end verbatim
|
26693
26693
|
|
26694
26694
|
@subsection 関連メッセージ
|
@@ -26702,7 +26702,7 @@ if(func() == 0) { /* W0644 */
|
|
26702
26702
|
|
26703
26703
|
@subsection 対応バージョン
|
26704
26704
|
|
26705
|
-
|
26705
|
+
1.14.0
|
26706
26706
|
|
26707
26707
|
@node W0646
|
26708
26708
|
@section W0646
|
@@ -29179,8 +29179,6 @@ extern void assert(int a);
|
|
29179
29179
|
|
29180
29180
|
@subsection 内容
|
29181
29181
|
|
29182
|
-
@b{このメッセージは AdLint 2.0.0 で出力する予定です。}
|
29183
|
-
|
29184
29182
|
式を持たない @code{return} 文は不定値を返します。
|
29185
29183
|
|
29186
29184
|
@subsection サンプルコード
|
@@ -29191,7 +29189,7 @@ int func(int value) /* W0697 */
|
|
29191
29189
|
if (value == 0) {
|
29192
29190
|
return 0;
|
29193
29191
|
}
|
29194
|
-
|
29192
|
+
/* No return statement at the end of this function. */
|
29195
29193
|
}
|
29196
29194
|
@end verbatim
|
29197
29195
|
|
@@ -29205,7 +29203,7 @@ int func(int value) /* W0697 */
|
|
29205
29203
|
|
29206
29204
|
@subsection 対応バージョン
|
29207
29205
|
|
29208
|
-
|
29206
|
+
1.14.0
|
29209
29207
|
|
29210
29208
|
@node W0698
|
29211
29209
|
@section W0698
|
@@ -29283,15 +29281,14 @@ extern func(void)
|
|
29283
29281
|
|
29284
29282
|
@subsection 内容
|
29285
29283
|
|
29286
|
-
@b{このメッセージは AdLint 2.0.0 で出力する予定です。}
|
29287
|
-
|
29288
29284
|
式を持たない @code{return} 文は不定値を返します。
|
29289
29285
|
|
29290
29286
|
@subsection サンプルコード
|
29291
29287
|
|
29292
|
-
@c{未実装}
|
29293
29288
|
@verbatim
|
29294
|
-
/*
|
29289
|
+
extern func(void) /* W0700 */
|
29290
|
+
{
|
29291
|
+
}
|
29295
29292
|
@end verbatim
|
29296
29293
|
|
29297
29294
|
@subsection 関連メッセージ
|
@@ -29304,7 +29301,7 @@ extern func(void)
|
|
29304
29301
|
|
29305
29302
|
@subsection 対応バージョン
|
29306
29303
|
|
29307
|
-
|
29304
|
+
1.14.0
|
29308
29305
|
|
29309
29306
|
@node W0703
|
29310
29307
|
@section W0703
|
@@ -35002,8 +34999,6 @@ int func(enum Color c)
|
|
35002
34999
|
|
35003
35000
|
@subsection 内容
|
35004
35001
|
|
35005
|
-
@b{このメッセージは AdLint 2.0.0 で出力する予定です。}
|
35006
|
-
|
35007
35002
|
例えばサンプルコードでは @code{float} 型変数 @code{a} の 2 乗した値が @code{float} 型の範囲に収まらないことを想定して
|
35008
35003
|
@code{double} 型変数 @code{b} へ代入しています。しかし、環境によっては @code{a * a} の演算はいったん @code{float} 型として
|
35009
35004
|
結果を出したあとに @code{double} 型にキャストされ、@code{b} へ代入される場合があります。その場合、@code{a} の値によっては精度落ちが起こります。
|
@@ -35026,7 +35021,7 @@ void func(float a)
|
|
35026
35021
|
|
35027
35022
|
@subsection 対応バージョン
|
35028
35023
|
|
35029
|
-
|
35024
|
+
1.14.0
|
35030
35025
|
|
35031
35026
|
@node W1067
|
35032
35027
|
@section W1067
|
@@ -35038,8 +35033,6 @@ void func(float a)
|
|
35038
35033
|
|
35039
35034
|
@subsection 内容
|
35040
35035
|
|
35041
|
-
@b{このメッセージは AdLint 2.0.0 で出力する予定です。}
|
35042
|
-
|
35043
35036
|
例えばサンプルコードでは @code{float} 型変数 @code{a} の 2 乗した値が @code{float} 型の範囲に収まらないことを想定して
|
35044
35037
|
@code{long double} 型変数 @code{b} へ代入しています。しかし、環境によっては @code{a * a} の演算はいったん @code{float} 型として
|
35045
35038
|
結果を出したあとに @code{long double} 型にキャストされ、@code{b} へ代入される場合があります。その場合、@code{a} の値によっては精度落ちが起こります。
|
@@ -35062,7 +35055,7 @@ void func(float a)
|
|
35062
35055
|
|
35063
35056
|
@subsection 対応バージョン
|
35064
35057
|
|
35065
|
-
|
35058
|
+
1.14.0
|
35066
35059
|
|
35067
35060
|
@node W1068
|
35068
35061
|
@section W1068
|
@@ -35074,8 +35067,6 @@ void func(float a)
|
|
35074
35067
|
|
35075
35068
|
@subsection 内容
|
35076
35069
|
|
35077
|
-
@b{このメッセージは AdLint 2.0.0 で出力する予定です。}
|
35078
|
-
|
35079
35070
|
例えばサンプルコードでは @code{double} 型変数 @code{a} の 2 乗した値が @code{double} 型の範囲に収まらないことを想定して
|
35080
35071
|
@code{long double} 型変数 @code{b} へ代入しています。しかし、環境によっては @code{a * a} の演算はいったん @code{double} 型として
|
35081
35072
|
結果を出したあとに @code{long double} 型にキャストされ、@code{b} へ代入される場合があります。その場合、@code{a} の値によっては精度落ちが起こります。
|
@@ -35098,7 +35089,7 @@ void func(double a)
|
|
35098
35089
|
|
35099
35090
|
@subsection 対応バージョン
|
35100
35091
|
|
35101
|
-
|
35092
|
+
1.14.0
|
35102
35093
|
|
35103
35094
|
@node W1069
|
35104
35095
|
@section W1069
|
@@ -35108,17 +35099,23 @@ void func(double a)
|
|
35108
35099
|
|
35109
35100
|
この `if-else-if' 文には、末尾の `else' 節がありません。
|
35110
35101
|
|
35111
|
-
|
35112
35102
|
@subsection 内容
|
35113
35103
|
|
35114
|
-
@b{このメッセージは AdLint 2.0.0 で出力する予定です。}
|
35115
|
-
|
35116
35104
|
@code{else} 節がないと、 @code{else} 節を書き忘れているのか、 @code{else} 節が発生しない @code{if-else if} 文なのかが分からず、混乱を招きます。
|
35117
35105
|
|
35118
35106
|
@subsection サンプルコード
|
35119
35107
|
|
35120
35108
|
@verbatim
|
35121
|
-
|
35109
|
+
static int func(int i)
|
35110
|
+
{
|
35111
|
+
if (i == 2) { /* W1069 */
|
35112
|
+
return 0;
|
35113
|
+
}
|
35114
|
+
else if (i == 4) {
|
35115
|
+
return 1;
|
35116
|
+
}
|
35117
|
+
return 2;
|
35118
|
+
}
|
35122
35119
|
@end verbatim
|
35123
35120
|
|
35124
35121
|
@subsection 関連メッセージ
|
@@ -35127,7 +35124,7 @@ void func(double a)
|
|
35127
35124
|
|
35128
35125
|
@subsection 対応バージョン
|
35129
35126
|
|
35130
|
-
|
35127
|
+
1.14.0
|
35131
35128
|
|
35132
35129
|
@node W1070
|
35133
35130
|
@section W1070
|
@@ -35139,15 +35136,13 @@ void func(double a)
|
|
35139
35136
|
|
35140
35137
|
@subsection 内容
|
35141
35138
|
|
35142
|
-
@b{このメッセージは AdLint 2.0.0 で出力する予定です。}
|
35143
|
-
|
35144
35139
|
深刻な問題ではありませんが、通常 @code{switch} 文は 2 つ以上の分岐があることが想定されるので、
|
35145
35140
|
@code{case} 節が 1 つしかない @code{switch} 文では、実行パスの定義漏れが疑われます。
|
35146
35141
|
|
35147
35142
|
@subsection サンプルコード
|
35148
35143
|
|
35149
35144
|
@verbatim
|
35150
|
-
switch (x) {
|
35145
|
+
switch (x) { /* W1070 */
|
35151
35146
|
case 1:
|
35152
35147
|
...
|
35153
35148
|
break;
|
@@ -35162,7 +35157,7 @@ default:
|
|
35162
35157
|
|
35163
35158
|
@subsection 対応バージョン
|
35164
35159
|
|
35165
|
-
|
35160
|
+
1.14.0
|
35166
35161
|
|
35167
35162
|
@node W1071
|
35168
35163
|
@section W1071
|
@@ -35210,14 +35205,26 @@ int func(int a)
|
|
35210
35205
|
|
35211
35206
|
@subsection 内容
|
35212
35207
|
|
35213
|
-
@b{このメッセージは AdLint 2.0.0 で出力する予定です。}
|
35214
35208
|
|
35215
35209
|
ファイル内で @code{goto} 文が使用されています。
|
35216
35210
|
|
35217
35211
|
@subsection サンプルコード
|
35218
35212
|
|
35219
35213
|
@verbatim
|
35220
|
-
|
35214
|
+
static int func(int i)
|
35215
|
+
{
|
35216
|
+
if (i == 1) {
|
35217
|
+
goto Label1; /* W1072 */
|
35218
|
+
}
|
35219
|
+
|
35220
|
+
goto Label2; /* W1072 */
|
35221
|
+
|
35222
|
+
Label1:
|
35223
|
+
i = 10;
|
35224
|
+
Label2:
|
35225
|
+
i = 20;
|
35226
|
+
return i;
|
35227
|
+
}
|
35221
35228
|
@end verbatim
|
35222
35229
|
|
35223
35230
|
@subsection 関連メッセージ
|
@@ -35226,7 +35233,7 @@ int func(int a)
|
|
35226
35233
|
|
35227
35234
|
@subsection 対応バージョン
|
35228
35235
|
|
35229
|
-
|
35236
|
+
1.14.0
|
35230
35237
|
|
35231
35238
|
@node W1073
|
35232
35239
|
@section W1073
|
@@ -36122,11 +36129,12 @@ MET,FN_RETN,bar,int bar(int),test.c,20,5,3
|
|
36122
36129
|
|
36123
36130
|
@subsection メトリック名
|
36124
36131
|
|
36125
|
-
関数内の完結していない @code{if} 文の数
|
36132
|
+
関数内の完結していない @code{if-else} 文の数
|
36126
36133
|
|
36127
36134
|
@subsection 内容
|
36128
36135
|
|
36129
|
-
関数内の @code{if}
|
36136
|
+
関数内の @code{if-else} 文で、明示的な @code{else} 節を持たないものの数を示しま
|
36137
|
+
す。
|
36130
36138
|
|
36131
36139
|
@subsection サンプルコード
|
36132
36140
|
|
@@ -36145,7 +36153,7 @@ int foo(int i)
|
|
36145
36153
|
if (j % 2) {
|
36146
36154
|
return -1;
|
36147
36155
|
}
|
36148
|
-
/*
|
36156
|
+
/* A standalone if-statement does nothing to the FN_UELS metric */
|
36149
36157
|
|
36150
36158
|
if (i == 2) {
|
36151
36159
|
return 0;
|
@@ -36157,12 +36165,12 @@ int foo(int i)
|
|
36157
36165
|
|
36158
36166
|
return 5;
|
36159
36167
|
|
36160
|
-
/* foo's FN_UELS ==
|
36168
|
+
/* foo's FN_UELS == 1 */
|
36161
36169
|
}
|
36162
36170
|
@end verbatim
|
36163
36171
|
|
36164
36172
|
@example
|
36165
|
-
MET,FN_UELS,foo,int foo(int),test.c,1,5,
|
36173
|
+
MET,FN_UELS,foo,int foo(int),test.c,1,5,1
|
36166
36174
|
@end example
|
36167
36175
|
|
36168
36176
|
@subsection 対応バージョン
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adlint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.14.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-04 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: ! 'AdLint is a source code static analyzer.
|
15
15
|
|
@@ -68,15 +68,19 @@ files:
|
|
68
68
|
- features/message_detection/W0010.feature
|
69
69
|
- features/message_detection/W0013.feature
|
70
70
|
- features/message_detection/W0093.feature
|
71
|
+
- features/message_detection/W0104.feature
|
71
72
|
- features/message_detection/W0109.feature
|
72
73
|
- features/message_detection/W0583.feature
|
73
74
|
- features/message_detection/W0606.feature
|
75
|
+
- features/message_detection/W0645.feature
|
74
76
|
- features/message_detection/W0687.feature
|
75
77
|
- features/message_detection/W0688.feature
|
76
78
|
- features/message_detection/W0689.feature
|
77
79
|
- features/message_detection/W0690.feature
|
80
|
+
- features/message_detection/W0697.feature
|
78
81
|
- features/message_detection/W0698.feature
|
79
82
|
- features/message_detection/W0699.feature
|
83
|
+
- features/message_detection/W0700.feature
|
80
84
|
- features/message_detection/W0703.feature
|
81
85
|
- features/message_detection/W0716.feature
|
82
86
|
- features/message_detection/W0717.feature
|
@@ -88,6 +92,12 @@ files:
|
|
88
92
|
- features/message_detection/W0735.feature
|
89
93
|
- features/message_detection/W1031.feature
|
90
94
|
- features/message_detection/W1052.feature
|
95
|
+
- features/message_detection/W1066.feature
|
96
|
+
- features/message_detection/W1067.feature
|
97
|
+
- features/message_detection/W1068.feature
|
98
|
+
- features/message_detection/W1069.feature
|
99
|
+
- features/message_detection/W1070.feature
|
100
|
+
- features/message_detection/W1072.feature
|
91
101
|
- features/message_detection/W9001.feature
|
92
102
|
- features/message_detection/W9003.feature
|
93
103
|
- features/step_definitions/message_detection_steps.rb
|