adlint 1.14.0 → 1.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. data/ChangeLog +265 -0
  2. data/MANIFEST +15 -0
  3. data/NEWS +30 -4
  4. data/etc/conf.d/noarch/adlint_all_bat.erb +1 -1
  5. data/etc/mesg.d/en_US/messages.yml +3 -3
  6. data/etc/mesg.d/ja_JP/messages.yml +3 -3
  7. data/features/message_detection/W0001.feature +2 -0
  8. data/features/message_detection/W0007.feature +8 -0
  9. data/features/message_detection/W0010.feature +4 -1
  10. data/features/message_detection/W0013.feature +8 -0
  11. data/features/message_detection/W0093.feature +3 -0
  12. data/features/message_detection/W0104.feature +7 -0
  13. data/features/message_detection/W0643.feature +80 -0
  14. data/features/message_detection/W0646.feature +115 -0
  15. data/features/message_detection/W0691.feature +100 -0
  16. data/features/message_detection/W0692.feature +32 -0
  17. data/features/message_detection/W0694.feature +128 -0
  18. data/features/message_detection/W0716.feature +3 -0
  19. data/features/message_detection/W0717.feature +3 -0
  20. data/features/message_detection/W0718.feature +3 -0
  21. data/features/message_detection/W0723.feature +2 -0
  22. data/features/message_detection/W0732.feature +3 -0
  23. data/features/message_detection/W0733.feature +3 -0
  24. data/features/message_detection/W0734.feature +8 -0
  25. data/features/message_detection/W0735.feature +8 -0
  26. data/features/message_detection/W0805.feature +92 -0
  27. data/features/message_detection/W0811.feature +79 -0
  28. data/features/message_detection/W1031.feature +7 -0
  29. data/features/message_detection/W1040.feature +89 -0
  30. data/features/message_detection/W1041.feature +15 -0
  31. data/features/message_detection/W1046.feature +60 -0
  32. data/features/message_detection/W1052.feature +3 -0
  33. data/features/message_detection/W1066.feature +3 -0
  34. data/features/message_detection/W1067.feature +3 -0
  35. data/features/message_detection/W1068.feature +3 -0
  36. data/features/message_detection/W1069.feature +5 -0
  37. data/features/message_detection/W1070.feature +6 -0
  38. data/features/message_detection/W1072.feature +1 -0
  39. data/features/message_detection/W1073.feature +145 -0
  40. data/features/message_detection/W1074.feature +139 -0
  41. data/features/message_detection/W1075.feature +86 -0
  42. data/features/message_detection/W1076.feature +66 -0
  43. data/features/message_detection/W1077.feature +105 -0
  44. data/features/message_detection/W9003.feature +4 -0
  45. data/lib/adlint/c/ctrlexpr.rb +3 -0
  46. data/lib/adlint/c/interp.rb +11 -5
  47. data/lib/adlint/c/lexer.rb +14 -3
  48. data/lib/adlint/c/message.rb +192 -0
  49. data/lib/adlint/c/parser.rb +19 -3
  50. data/lib/adlint/c/parser.y +18 -2
  51. data/lib/adlint/c/phase.rb +19 -6
  52. data/lib/adlint/c/syntax.rb +6 -0
  53. data/lib/adlint/c/type.rb +5 -1
  54. data/lib/adlint/cpp/constexpr.rb +3 -3
  55. data/lib/adlint/cpp/constexpr.y +3 -3
  56. data/lib/adlint/cpp/eval.rb +60 -86
  57. data/lib/adlint/cpp/lexer.rb +82 -28
  58. data/lib/adlint/cpp/macro.rb +64 -35
  59. data/lib/adlint/cpp/message.rb +137 -4
  60. data/lib/adlint/cpp/phase.rb +8 -0
  61. data/lib/adlint/cpp/syntax.rb +25 -0
  62. data/lib/adlint/lang.rb +2 -1
  63. data/lib/adlint/version.rb +2 -2
  64. data/share/doc/developers_guide_ja.html +3 -3
  65. data/share/doc/developers_guide_ja.texi +1 -1
  66. data/share/doc/users_guide_en.html +102 -85
  67. data/share/doc/users_guide_en.texi +85 -69
  68. data/share/doc/users_guide_ja.html +102 -94
  69. data/share/doc/users_guide_ja.texi +85 -77
  70. metadata +17 -2
@@ -2,7 +2,7 @@
2
2
  @setfilename users_guide_ja.info
3
3
  @documentlanguage ja
4
4
  @documentencoding utf-8
5
- @settitle AdLint 1.14.0 利用者ガイド
5
+ @settitle AdLint 1.16.0 利用者ガイド
6
6
 
7
7
  @copying
8
8
  Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
@@ -2719,7 +2719,7 @@ context_line
2719
2719
  * W0689::#line 指令の構文が `#line 汎整数定数 "文字列"' の形式と合っていません。
2720
2720
  * W0690::#line 指令の後に行番号が記述されていません。
2721
2721
  * W0691::`##' 演算子の結果が有効な前処理字句ではありません。
2722
- * W0692::関数形式マクロに実引数が与えられていません。
2722
+ * W0692::関数形式マクロ `%s' に実引数が与えられていません。
2723
2723
  * W0693::関数形式マクロがその定義よりも少ない実引数で呼び出されています。
2724
2724
  * W0694::`assert' という名称の関数を呼び出す目的で、assert マクロが抑制されています。未定義の結果になります。
2725
2725
  * W0695::assert マクロを #undef してその名前の関数を呼び出しできるようにすると、未定義の結果になります。
@@ -2855,7 +2855,7 @@ context_line
2855
2855
  * W1037::外部結合をもつ `%s' が、二つ以上宣言されていますが互換性がありません。
2856
2856
  * W1039::変換指定子に `ll' が使われています。
2857
2857
  * W1040::前処理指令の後に認識できない文字列が記述されています。
2858
- * W1041::`#%s' は、ISO C 標準規格の正式な前処理指令ではありません。
2858
+ * W1041::`%s' は、ISO C 標準規格の正式な前処理指令ではありません。
2859
2859
  * W1042::前処理指令の中で sizeof 演算子を使っています。これは言語拡張です。
2860
2860
  * W1043::`@@ address' は、ISO C 標準規格ではサポートされていません。言語拡張と見なします。
2861
2861
  * W1044::文を包含する式は ISO C 標準規格ではサポートされていません。言語拡張と見なします。
@@ -26609,15 +26609,13 @@ void func(void)
26609
26609
 
26610
26610
  @subsection 内容
26611
26611
 
26612
- @b{このメッセージは AdLint 2.0.0 で出力する予定です。}
26613
-
26614
26612
  未定義の動作のため、予期しない動作を引き起こす可能性があります。
26615
26613
 
26616
26614
  @subsection サンプルコード
26617
26615
 
26618
- @c{未実装}
26619
26616
  @verbatim
26620
- /* 追記予定 */
26617
+ #define MACRO(x) #x
26618
+ const char *str = MACRO(foo\); /* W0643 */
26621
26619
  @end verbatim
26622
26620
 
26623
26621
  @subsection 関連メッセージ
@@ -26631,7 +26629,7 @@ void func(void)
26631
26629
 
26632
26630
  @subsection 対応バージョン
26633
26631
 
26634
- 2.0.0 の予定
26632
+ 1.16.0
26635
26633
 
26636
26634
  @node W0644
26637
26635
  @section W0644
@@ -26714,15 +26712,12 @@ void a;
26714
26712
 
26715
26713
  @subsection 内容
26716
26714
 
26717
- @b{このメッセージは AdLint 2.0.0 で出力する予定です。}
26718
-
26719
26715
  未定義の動作のため、予期しない動作を引き起こす可能性があります。
26720
26716
 
26721
26717
  @subsection サンプルコード
26722
26718
 
26723
- @c{未実装}
26724
26719
  @verbatim
26725
- /* 追記予定 */
26720
+ static const char *str = "foo" L"bar"; /* W0646 */
26726
26721
  @end verbatim
26727
26722
 
26728
26723
  @subsection 関連メッセージ
@@ -26736,7 +26731,7 @@ void a;
26736
26731
 
26737
26732
  @subsection 対応バージョン
26738
26733
 
26739
- 2.0.0 の予定
26734
+ 1.16.0
26740
26735
 
26741
26736
  @node W0649
26742
26737
  @section W0649
@@ -28991,15 +28986,14 @@ defined 演算子を削除する目的で #undef を使っています。
28991
28986
 
28992
28987
  @subsection 内容
28993
28988
 
28994
- @b{このメッセージは AdLint 2.0.0 で出力する予定です。}
28995
-
28996
28989
  このような記述は、未定義の動作のため、予期しない動作を引き起こす可能性があります。
28997
28990
 
28998
28991
  @subsection サンプルコード
28999
28992
 
29000
- @c{未実装}
29001
28993
  @verbatim
29002
- /* 追記予定 */
28994
+ #define MACRO(a, b) a ## b
28995
+
28996
+ double d = (double) MACRO(-, 123); /* W0691 */
29003
28997
  @end verbatim
29004
28998
 
29005
28999
  @subsection 関連メッセージ
@@ -29013,7 +29007,7 @@ defined 演算子を削除する目的で #undef を使っています。
29013
29007
 
29014
29008
  @subsection 対応バージョン
29015
29009
 
29016
- 2.0.0 の予定
29010
+ 1.16.0
29017
29011
 
29018
29012
  @node W0692
29019
29013
  @section W0692
@@ -29021,19 +29015,18 @@ defined 演算子を削除する目的で #undef を使っています。
29021
29015
 
29022
29016
  @subsection メッセージ本文
29023
29017
 
29024
- 関数形式マクロに実引数が与えられていません。
29018
+ 関数形式マクロ `%s' に実引数が与えられていません。
29025
29019
 
29026
29020
  @subsection 内容
29027
29021
 
29028
- @b{このメッセージは AdLint 2.0.0 で出力する予定です。}
29029
-
29030
29022
  このような記述は、言語制約違反になりますので、移植性を低下させます。
29031
29023
 
29032
29024
  @subsection サンプルコード
29033
29025
 
29034
- @c{未実装}
29035
29026
  @verbatim
29036
- /* 追記予定 */
29027
+ #define MACRO(a) #a
29028
+
29029
+ const char *s = (char *) MACRO(); /* W0692 */
29037
29030
  @end verbatim
29038
29031
 
29039
29032
  @subsection 関連メッセージ
@@ -29044,7 +29037,7 @@ defined 演算子を削除する目的で #undef を使っています。
29044
29037
 
29045
29038
  @subsection 対応バージョン
29046
29039
 
29047
- 2.0.0 の予定
29040
+ 1.16.0
29048
29041
 
29049
29042
  @node W0693
29050
29043
  @section W0693
@@ -29069,7 +29062,7 @@ defined 演算子を削除する目的で #undef を使っています。
29069
29062
  @subsection 関連メッセージ
29070
29063
 
29071
29064
  @itemize
29072
- @item @ref{W0692} 関数形式マクロに実引数が与えられていません。
29065
+ @item @ref{W0692} 関数形式マクロ `%s' に実引数が与えられていません。
29073
29066
  @end itemize
29074
29067
 
29075
29068
  @subsection 対応バージョン
@@ -29086,15 +29079,18 @@ defined 演算子を削除する目的で #undef を使っています。
29086
29079
 
29087
29080
  @subsection 内容
29088
29081
 
29089
- @b{このメッセージは AdLint 2.0.0 で出力する予定です。}
29090
-
29091
29082
  @code{assert} という名前の関数を作成すると、未定義の結果になります。
29092
29083
 
29093
29084
  @subsection サンプルコード
29094
29085
 
29095
- @c{未実装}
29096
29086
  @verbatim
29097
- /* 追記予定 */
29087
+ #undef assert
29088
+ extern void assert(int);
29089
+
29090
+ void foo(void)
29091
+ {
29092
+ assert("should not be reached" == ""); /* W0694 */
29093
+ }
29098
29094
  @end verbatim
29099
29095
 
29100
29096
  @subsection 関連メッセージ
@@ -29103,7 +29099,7 @@ defined 演算子を削除する目的で #undef を使っています。
29103
29099
 
29104
29100
  @subsection 対応バージョン
29105
29101
 
29106
- 2.0.0 の予定
29102
+ 1.16.0
29107
29103
 
29108
29104
  @node W0695
29109
29105
  @section W0695
@@ -32930,14 +32926,14 @@ defined 構文が、`defined(識別子)' あるいは `defined 識別子' のど
32930
32926
 
32931
32927
  @subsection 内容
32932
32928
 
32933
- @b{このメッセージは AdLint 2.0.0 で出力する予定です。}
32934
-
32935
32929
  このような記述は未定義の動作になります。したがって、予期しない動作を引き起こす可能性があります。
32936
32930
 
32937
32931
  @subsection サンプルコード
32938
32932
 
32939
32933
  @verbatim
32940
- #if defined() /* W0805 */
32934
+ #if defined "foo" /* W0805 */
32935
+ int i = 0;
32936
+ #endif
32941
32937
  @end verbatim
32942
32938
 
32943
32939
  @subsection 関連メッセージ
@@ -32948,7 +32944,7 @@ defined 構文が、`defined(識別子)' あるいは `defined 識別子' のど
32948
32944
 
32949
32945
  @subsection 対応バージョン
32950
32946
 
32951
- 2.0.0 の予定
32947
+ 1.16.0
32952
32948
 
32953
32949
  @node W0806
32954
32950
  @section W0806
@@ -33124,15 +33120,16 @@ int foo(int i, int j) {
33124
33120
 
33125
33121
  @subsection 内容
33126
33122
 
33127
- @b{このメッセージは AdLint 2.0.0 で出力する予定です。}
33128
-
33129
33123
  このような記述は、未定義の動作のため、予期しない動作を引き起こす可能性があります。
33130
33124
 
33131
33125
  @subsection サンプルコード
33132
33126
 
33133
- @c{未実装}
33134
33127
  @verbatim
33135
- /* 追記予定 */
33128
+ #define COND defined(FOO)
33129
+
33130
+ #if COND /* W0811 */
33131
+ int i = 0;
33132
+ #endif
33136
33133
  @end verbatim
33137
33134
 
33138
33135
  @subsection 関連メッセージ
@@ -33141,7 +33138,7 @@ int foo(int i, int j) {
33141
33138
 
33142
33139
  @subsection 対応バージョン
33143
33140
 
33144
- 2.0.0 の予定
33141
+ 1.16.0
33145
33142
 
33146
33143
  @node W0827
33147
33144
  @section W0827
@@ -33952,27 +33949,34 @@ extern long a; /* W1037 */
33952
33949
 
33953
33950
  @subsection 内容
33954
33951
 
33955
- @b{このメッセージは AdLint 2.0.0 で出力する予定です。}
33956
-
33957
33952
  このような前処理指令の記述は、ISO C90 標準規格ではサポートされていません。
33958
33953
 
33959
33954
  @subsection サンプルコード
33960
33955
 
33961
- @c{未実装}
33962
33956
  @verbatim
33963
- /* 追記予定 */
33957
+ #define TEST
33958
+
33959
+ #ifdef TEST
33960
+ #if defined(CASE_1)
33961
+ int i = 1;
33962
+ #elif defined(CASE_2)
33963
+ int i = 2;
33964
+ #endif CASE /* W1040 */
33965
+ #else
33966
+ int i = 0;
33967
+ #endif TEST /* W1040 */
33964
33968
  @end verbatim
33965
33969
 
33966
33970
  @subsection 関連メッセージ
33967
33971
 
33968
33972
  @itemize
33969
- @item @ref{W1041} `#%s' は、ISO C 標準規格の正式な前処理指令ではありません。
33973
+ @item @ref{W1041} `%s' は、ISO C 標準規格の正式な前処理指令ではありません。
33970
33974
  @item @ref{W1042} 前処理指令の中で sizeof 演算子を使っています。これは言語拡張です。
33971
33975
  @end itemize
33972
33976
 
33973
33977
  @subsection 対応バージョン
33974
33978
 
33975
- 2.0.0 の予定
33979
+ 1.16.0
33976
33980
 
33977
33981
  @node W1041
33978
33982
  @section W1041
@@ -33980,19 +33984,16 @@ extern long a; /* W1037 */
33980
33984
 
33981
33985
  @subsection メッセージ本文
33982
33986
 
33983
- `#%s' は、ISO C 標準規格の正式な前処理指令ではありません。
33987
+ `%s' は、ISO C 標準規格の正式な前処理指令ではありません。
33984
33988
 
33985
33989
  @subsection 内容
33986
33990
 
33987
- @b{このメッセージは AdLint 2.0.0 で出力する予定です。}
33988
-
33989
33991
  このような前処理指令の記述は、ISO C90 標準規格ではサポートされていません。
33990
33992
 
33991
33993
  @subsection サンプルコード
33992
33994
 
33993
- @c{未実装}
33994
33995
  @verbatim
33995
- /* 追記予定 */
33996
+ #compiler_specific_extension 1 2.3 "4" /* W1041 */
33996
33997
  @end verbatim
33997
33998
 
33998
33999
  @subsection 関連メッセージ
@@ -34004,7 +34005,7 @@ extern long a; /* W1037 */
34004
34005
 
34005
34006
  @subsection 対応バージョン
34006
34007
 
34007
- 2.0.0 の予定
34008
+ 1.16.0
34008
34009
 
34009
34010
  @node W1042
34010
34011
  @section W1042
@@ -34031,7 +34032,7 @@ extern long a; /* W1037 */
34031
34032
 
34032
34033
  @itemize
34033
34034
  @item @ref{W1040} 前処理指令の後に認識できない文字列が記述されています。
34034
- @item @ref{W1041} `#%s' は、ISO C 標準規格の正式な前処理指令ではありません。
34035
+ @item @ref{W1041} `%s' は、ISO C 標準規格の正式な前処理指令ではありません。
34035
34036
  @end itemize
34036
34037
 
34037
34038
  @subsection 対応バージョン
@@ -34144,15 +34145,15 @@ extern long a; /* W1037 */
34144
34145
 
34145
34146
  @subsection 内容
34146
34147
 
34147
- @b{このメッセージは AdLint 2.0.0 で出力する予定です。}
34148
-
34149
34148
  ISO C 規格ではバックスラッシュ文字の後に直接改行文字が続くべきであると規定しています。
34150
34149
 
34151
34150
  @subsection サンプルコード
34152
34151
 
34153
- @c{未実装}
34154
34152
  @verbatim
34155
- /* 追記予定 */
34153
+ #define FOO(a, b) /* OK */ \
34154
+ ( /* W1046 */ \
34155
+ (a) + (b) /* W1046 */ \
34156
+ )
34156
34157
  @end verbatim
34157
34158
 
34158
34159
  @subsection 関連メッセージ
@@ -34161,7 +34162,7 @@ ISO C 規格ではバックスラッシュ文字の後に直接改行文字が
34161
34162
 
34162
34163
  @subsection 対応バージョン
34163
34164
 
34164
- 2.0.0 の予定
34165
+ 1.16.0
34165
34166
 
34166
34167
  @node W1047
34167
34168
  @section W1047
@@ -35245,15 +35246,21 @@ Label2:
35245
35246
 
35246
35247
  @subsection 内容
35247
35248
 
35248
- @b{このメッセージは AdLint 2.0.0 で出力する予定です。}
35249
-
35250
35249
  関数の戻り値が使用されていない場合、その戻り値は無駄な要素といえます。コード中に無駄な要素があることで解析性が低下します。
35251
35250
  また、使用されない戻り値が多いことは、戻り値のチェックも怠っていることが推測されるため、障害許容性が低下している可能性が高いといえます。
35252
35251
 
35253
35252
  @subsection サンプルコード
35254
35253
 
35255
35254
  @verbatim
35256
- /* 追記予定 */
35255
+ extern int bar(void);
35256
+ static void foo(void)
35257
+ {
35258
+ int i;
35259
+ int j;
35260
+ for (i = 0, bar(); i < 10; i++) { /* W1073 */
35261
+ j = bar(); /* OK */
35262
+ }
35263
+ }
35257
35264
  @end verbatim
35258
35265
 
35259
35266
  @subsection 関連メッセージ
@@ -35262,7 +35269,7 @@ Label2:
35262
35269
 
35263
35270
  @subsection 対応バージョン
35264
35271
 
35265
- 2.0.0 の予定
35272
+ 1.16.0
35266
35273
 
35267
35274
  @node W1074
35268
35275
  @section W1074
@@ -35274,15 +35281,23 @@ Label2:
35274
35281
 
35275
35282
  @subsection 内容
35276
35283
 
35277
- @b{このメッセージは AdLint 2.0.0 で出力する予定です。}
35278
-
35279
35284
  サンプルコードで示したソースコードの場合、@code{sizeof} 演算子は式を評価しないため、@code{data++} は実行されません。
35280
35285
  従って @code{data++} が実行されていることが前提だとすると様々な予期しない問題が起きる可能性があります。
35281
35286
 
35282
35287
  @subsection サンプルコード
35283
35288
 
35284
35289
  @verbatim
35285
- int i = sizeof(data++); /* W1074 */
35290
+ static int foo(void)
35291
+ {
35292
+ int i = 0;
35293
+
35294
+ if (sizeof(i++) == 4) { /* W1074 */
35295
+ return 0;
35296
+ }
35297
+ else {
35298
+ return 1;
35299
+ }
35300
+ }
35286
35301
  @end verbatim
35287
35302
 
35288
35303
  @subsection 関連メッセージ
@@ -35291,7 +35306,7 @@ int i = sizeof(data++); /* W1074 */
35291
35306
 
35292
35307
  @subsection 対応バージョン
35293
35308
 
35294
- 2.0.0 の予定
35309
+ 1.16.0
35295
35310
 
35296
35311
  @node W1075
35297
35312
  @section W1075
@@ -35303,8 +35318,6 @@ int i = sizeof(data++); /* W1074 */
35303
35318
 
35304
35319
  @subsection 内容
35305
35320
 
35306
- @b{このメッセージは AdLint 2.0.0 で出力する予定です。}
35307
-
35308
35321
  static 記憶域クラス指定子が明示されていません。
35309
35322
 
35310
35323
  @subsection サンプルコード
@@ -35323,7 +35336,7 @@ int func(void) /* W1075 */
35323
35336
 
35324
35337
  @subsection 対応バージョン
35325
35338
 
35326
- 2.0.0 の予定
35339
+ 1.16.0
35327
35340
 
35328
35341
  @node W1076
35329
35342
  @section W1076
@@ -35335,8 +35348,6 @@ int func(void) /* W1075 */
35335
35348
 
35336
35349
  @subsection 内容
35337
35350
 
35338
- @b{このメッセージは AdLint 2.0.0 で出力する予定です。}
35339
-
35340
35351
  関数プロトタイプ宣言がないまま static 記憶域クラス指定子付きの関数が定義されています。
35341
35352
 
35342
35353
  @subsection サンプルコード
@@ -35344,8 +35355,7 @@ int func(void) /* W1075 */
35344
35355
  @verbatim
35345
35356
  static int func(void) /* W1076 */
35346
35357
  {
35347
- ...
35348
- return ret;
35358
+ return 0;
35349
35359
  }
35350
35360
  @end verbatim
35351
35361
 
@@ -35355,7 +35365,7 @@ static int func(void) /* W1076 */
35355
35365
 
35356
35366
  @subsection 対応バージョン
35357
35367
 
35358
- 2.0.0 の予定
35368
+ 1.16.0
35359
35369
 
35360
35370
  @node W1077
35361
35371
  @section W1077
@@ -35367,14 +35377,12 @@ static int func(void) /* W1076 */
35367
35377
 
35368
35378
  @subsection 内容
35369
35379
 
35370
- @b{このメッセージは AdLint 2.0.0 で出力する予定です。}
35371
-
35372
35380
  この配列は、サイズが明示されていません。
35373
35381
 
35374
35382
  @subsection サンプルコード
35375
35383
 
35376
35384
  @verbatim
35377
- extern int array[]; /* W1077 */
35385
+ extern int a[]; /* W1077 */
35378
35386
  @end verbatim
35379
35387
 
35380
35388
  @subsection 関連メッセージ
@@ -35383,7 +35391,7 @@ extern int array[]; /* W1077 */
35383
35391
 
35384
35392
  @subsection 対応バージョン
35385
35393
 
35386
- 2.0.0 の予定
35394
+ 1.16.0
35387
35395
 
35388
35396
  @node W9001
35389
35397
  @section W9001