adlint 1.8.10 → 1.10.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +261 -3
- data/MANIFEST +25 -1
- data/NEWS +25 -5
- data/Rakefile +11 -0
- data/TODO +0 -1
- data/etc/mesg.d/en_US/messages.yml +1 -1
- data/etc/mesg.d/ja_JP/messages.yml +1 -1
- data/features/message_detection/W0001.feature +41 -0
- data/features/message_detection/W0002.feature +68 -0
- data/features/message_detection/W0003.feature +134 -0
- data/features/message_detection/W0007.feature +264 -0
- data/features/message_detection/W0010.feature +75 -0
- data/features/message_detection/W0013.feature +189 -0
- data/features/message_detection/W0109.feature +50 -0
- data/features/message_detection/W0583.feature +30 -0
- data/features/message_detection/W0606.feature +20 -0
- data/features/message_detection/W0698.feature +20 -0
- data/features/message_detection/W0699.feature +21 -0
- data/features/message_detection/W0703.feature +73 -0
- data/features/message_detection/W0716.feature +67 -0
- data/features/message_detection/W0717.feature +64 -0
- data/features/message_detection/W0718.feature +64 -0
- data/features/message_detection/W0723.feature +18 -0
- data/features/message_detection/W1031.feature +328 -0
- data/features/step_definitions/message_detection_steps.rb +45 -0
- data/features/support/env.rb +58 -0
- data/lib/adlint/c/branch.rb +16 -23
- data/lib/adlint/c/code.rb +1 -12
- data/lib/adlint/c/conv.rb +4 -4
- data/lib/adlint/c/ctrlexpr.rb +10 -6
- data/lib/adlint/c/domain.rb +2 -2
- data/lib/adlint/c/expr.rb +11 -33
- data/lib/adlint/c/format.rb +6 -6
- data/lib/adlint/c/interp.rb +137 -80
- data/lib/adlint/c/mediator.rb +5 -2
- data/lib/adlint/c/message.rb +123 -140
- data/lib/adlint/c/message_shima.rb +44 -0
- data/lib/adlint/c/object.rb +93 -26
- data/lib/adlint/c/option.rb +53 -0
- data/lib/adlint/c/phase.rb +4 -1
- data/lib/adlint/c/type.rb +112 -46
- data/lib/adlint/c.rb +1 -0
- data/lib/adlint/version.rb +3 -3
- 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 +35 -28
- data/share/doc/users_guide_en.texi +30 -22
- data/share/doc/users_guide_ja.html +35 -31
- data/share/doc/users_guide_ja.texi +30 -24
- data/spec/adlint/c/type_spec.rb +110 -0
- data/spec/conf.d/default_traits.yml +216 -0
- data/spec/conf.d/empty_cinit.h +11 -0
- data/spec/conf.d/empty_pinit.h +11 -0
- data/spec/spec_helper.rb +49 -0
- metadata +27 -3
- data/spec/MUST_WRITE_SPECS_WITH_RSPEC +0 -0
@@ -1,8 +1,8 @@
|
|
1
1
|
<html lang="en">
|
2
2
|
<head>
|
3
|
-
<title>AdLint 1.
|
3
|
+
<title>AdLint 1.10.0 User's Guide</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.10.0 User's Guide">
|
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.10.0 User's Guide</h1>
|
48
48
|
<div class="node">
|
49
49
|
<a name="Top"></a>
|
50
50
|
<p><hr>
|
@@ -3429,18 +3429,18 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
3429
3429
|
|
3430
3430
|
<pre class="verbatim">int value;
|
3431
3431
|
int number;
|
3432
|
-
switch(number) {
|
3432
|
+
switch (number) {
|
3433
3433
|
case 1:
|
3434
3434
|
value = 1;
|
3435
3435
|
break;
|
3436
3436
|
case 2:
|
3437
3437
|
value = 2;
|
3438
|
-
case 3
|
3438
|
+
case 3: /* W0007 */
|
3439
3439
|
value = 3;
|
3440
3440
|
break;
|
3441
3441
|
default:
|
3442
|
-
|
3443
|
-
|
3442
|
+
value = 0;
|
3443
|
+
break;
|
3444
3444
|
}
|
3445
3445
|
</pre>
|
3446
3446
|
|
@@ -3509,13 +3509,17 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
3509
3509
|
|
3510
3510
|
<h4 class="subsection">6.19.3 Sample code</h4>
|
3511
3511
|
|
3512
|
-
<pre class="verbatim">
|
3513
|
-
|
3512
|
+
<pre class="verbatim">static void foo(void)
|
3513
|
+
{
|
3514
|
+
int i;
|
3515
|
+
int j;
|
3514
3516
|
|
3515
|
-
|
3516
|
-
|
3517
|
-
|
3518
|
-
|
3517
|
+
i++;
|
3518
|
+
for (i = 1, j = 0; i < 20; i++) {
|
3519
|
+
j += 2;
|
3520
|
+
if ((j % i) == 3) {
|
3521
|
+
continue; /* W0013 */
|
3522
|
+
}
|
3519
3523
|
}
|
3520
3524
|
}
|
3521
3525
|
</pre>
|
@@ -33967,13 +33971,14 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
33967
33971
|
|
33968
33972
|
<h4 class="subsection">6.589.2 Content</h4>
|
33969
33973
|
|
33970
|
-
<p
|
33971
|
-
|
33972
|
-
<p>Under construction.
|
33974
|
+
<p>Under construction.
|
33973
33975
|
|
33974
33976
|
<h4 class="subsection">6.589.3 Sample code</h4>
|
33975
33977
|
|
33976
|
-
<pre class="verbatim"
|
33978
|
+
<pre class="verbatim">int func(int a, int b, int c, int d)
|
33979
|
+
{
|
33980
|
+
return (a > b) + (c > d); /* W0716 */
|
33981
|
+
}
|
33977
33982
|
</pre>
|
33978
33983
|
|
33979
33984
|
<h4 class="subsection">6.589.4 Related message</h4>
|
@@ -33987,7 +33992,7 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
33987
33992
|
|
33988
33993
|
<h4 class="subsection">6.589.5 Since</h4>
|
33989
33994
|
|
33990
|
-
<p>
|
33995
|
+
<p>1.10.0
|
33991
33996
|
|
33992
33997
|
<div class="node">
|
33993
33998
|
<a name="W0717"></a>
|
@@ -34008,13 +34013,14 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
34008
34013
|
|
34009
34014
|
<h4 class="subsection">6.590.2 Content</h4>
|
34010
34015
|
|
34011
|
-
<p
|
34012
|
-
|
34013
|
-
<p>Under construction.
|
34016
|
+
<p>Under construction.
|
34014
34017
|
|
34015
34018
|
<h4 class="subsection">6.590.3 Sample code</h4>
|
34016
34019
|
|
34017
|
-
<pre class="verbatim"
|
34020
|
+
<pre class="verbatim">int func(int a, int b, int c)
|
34021
|
+
{
|
34022
|
+
return (a > b) + c; /* W0717 */
|
34023
|
+
}
|
34018
34024
|
</pre>
|
34019
34025
|
|
34020
34026
|
<h4 class="subsection">6.590.4 Related message</h4>
|
@@ -34028,7 +34034,7 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
34028
34034
|
|
34029
34035
|
<h4 class="subsection">6.590.5 Since</h4>
|
34030
34036
|
|
34031
|
-
<p>
|
34037
|
+
<p>1.10.0
|
34032
34038
|
|
34033
34039
|
<div class="node">
|
34034
34040
|
<a name="W0718"></a>
|
@@ -34049,13 +34055,14 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
34049
34055
|
|
34050
34056
|
<h4 class="subsection">6.591.2 Content</h4>
|
34051
34057
|
|
34052
|
-
<p
|
34053
|
-
|
34054
|
-
<p>Under construction.
|
34058
|
+
<p>Under construction.
|
34055
34059
|
|
34056
34060
|
<h4 class="subsection">6.591.3 Sample code</h4>
|
34057
34061
|
|
34058
|
-
<pre class="verbatim"
|
34062
|
+
<pre class="verbatim">int func(int a, int b, int c)
|
34063
|
+
{
|
34064
|
+
return a + (b > c); /* W0718 */
|
34065
|
+
}
|
34059
34066
|
</pre>
|
34060
34067
|
|
34061
34068
|
<h4 class="subsection">6.591.4 Related message</h4>
|
@@ -34069,7 +34076,7 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
34069
34076
|
|
34070
34077
|
<h4 class="subsection">6.591.5 Since</h4>
|
34071
34078
|
|
34072
|
-
<p>
|
34079
|
+
<p>1.10.0
|
34073
34080
|
|
34074
34081
|
<div class="node">
|
34075
34082
|
<a name="W0719"></a>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
@setfilename users_guide_en.info
|
3
3
|
@documentlanguage en
|
4
4
|
@documentencoding utf-8
|
5
|
-
@settitle AdLint 1.
|
5
|
+
@settitle AdLint 1.10.0 User's Guide
|
6
6
|
|
7
7
|
@copying
|
8
8
|
Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
|
@@ -3291,18 +3291,18 @@ Under construction.
|
|
3291
3291
|
@verbatim
|
3292
3292
|
int value;
|
3293
3293
|
int number;
|
3294
|
-
switch(number) {
|
3294
|
+
switch (number) {
|
3295
3295
|
case 1:
|
3296
3296
|
value = 1;
|
3297
3297
|
break;
|
3298
3298
|
case 2:
|
3299
3299
|
value = 2;
|
3300
|
-
case 3
|
3300
|
+
case 3: /* W0007 */
|
3301
3301
|
value = 3;
|
3302
3302
|
break;
|
3303
3303
|
default:
|
3304
|
-
|
3305
|
-
|
3304
|
+
value = 0;
|
3305
|
+
break;
|
3306
3306
|
}
|
3307
3307
|
@end verbatim
|
3308
3308
|
|
@@ -3355,13 +3355,17 @@ Under construction.
|
|
3355
3355
|
@subsection Sample code
|
3356
3356
|
|
3357
3357
|
@verbatim
|
3358
|
-
|
3359
|
-
|
3358
|
+
static void foo(void)
|
3359
|
+
{
|
3360
|
+
int i;
|
3361
|
+
int j;
|
3360
3362
|
|
3361
|
-
|
3362
|
-
|
3363
|
-
|
3364
|
-
|
3363
|
+
i++;
|
3364
|
+
for (i = 1, j = 0; i < 20; i++) {
|
3365
|
+
j += 2;
|
3366
|
+
if ((j % i) == 3) {
|
3367
|
+
continue; /* W0013 */
|
3368
|
+
}
|
3365
3369
|
}
|
3366
3370
|
}
|
3367
3371
|
@end verbatim
|
@@ -29292,14 +29296,16 @@ A bit operator or both sides operand of arithmetic operator is a substantive 'bo
|
|
29292
29296
|
|
29293
29297
|
@subsection Content
|
29294
29298
|
|
29295
|
-
@b{This message will be supported in AdLint 2.0.0}
|
29296
29299
|
|
29297
29300
|
Under construction.
|
29298
29301
|
|
29299
29302
|
@subsection Sample code
|
29300
29303
|
|
29301
29304
|
@verbatim
|
29302
|
-
|
29305
|
+
int func(int a, int b, int c, int d)
|
29306
|
+
{
|
29307
|
+
return (a > b) + (c > d); /* W0716 */
|
29308
|
+
}
|
29303
29309
|
@end verbatim
|
29304
29310
|
|
29305
29311
|
@subsection Related message
|
@@ -29313,7 +29319,7 @@ Under construction.
|
|
29313
29319
|
|
29314
29320
|
@subsection Since
|
29315
29321
|
|
29316
|
-
|
29322
|
+
1.10.0
|
29317
29323
|
|
29318
29324
|
@node W0717
|
29319
29325
|
@section W0717
|
@@ -29325,14 +29331,15 @@ A bit operator or left side operand of arithmetic operator is a substantive 'boo
|
|
29325
29331
|
|
29326
29332
|
@subsection Content
|
29327
29333
|
|
29328
|
-
@b{This message will be supported in AdLint 2.0.0}
|
29329
|
-
|
29330
29334
|
Under construction.
|
29331
29335
|
|
29332
29336
|
@subsection Sample code
|
29333
29337
|
|
29334
29338
|
@verbatim
|
29335
|
-
|
29339
|
+
int func(int a, int b, int c)
|
29340
|
+
{
|
29341
|
+
return (a > b) + c; /* W0717 */
|
29342
|
+
}
|
29336
29343
|
@end verbatim
|
29337
29344
|
|
29338
29345
|
@subsection Related message
|
@@ -29346,7 +29353,7 @@ Under construction.
|
|
29346
29353
|
|
29347
29354
|
@subsection Since
|
29348
29355
|
|
29349
|
-
|
29356
|
+
1.10.0
|
29350
29357
|
|
29351
29358
|
@node W0718
|
29352
29359
|
@section W0718
|
@@ -29358,14 +29365,15 @@ A bit operator or right side operand of arithmetic operator is a substantive 'bo
|
|
29358
29365
|
|
29359
29366
|
@subsection Content
|
29360
29367
|
|
29361
|
-
@b{This message will be supported in AdLint 2.0.0}
|
29362
|
-
|
29363
29368
|
Under construction.
|
29364
29369
|
|
29365
29370
|
@subsection Sample code
|
29366
29371
|
|
29367
29372
|
@verbatim
|
29368
|
-
|
29373
|
+
int func(int a, int b, int c)
|
29374
|
+
{
|
29375
|
+
return a + (b > c); /* W0718 */
|
29376
|
+
}
|
29369
29377
|
@end verbatim
|
29370
29378
|
|
29371
29379
|
@subsection Related message
|
@@ -29379,7 +29387,7 @@ Under construction.
|
|
29379
29387
|
|
29380
29388
|
@subsection Since
|
29381
29389
|
|
29382
|
-
|
29390
|
+
1.10.0
|
29383
29391
|
|
29384
29392
|
@node W0719
|
29385
29393
|
@section W0719
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<html lang="ja">
|
2
2
|
<head>
|
3
|
-
<title>AdLint 1.
|
3
|
+
<title>AdLint 1.10.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.10.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.10.0 利用者ガイド</h1>
|
48
48
|
<div class="node">
|
49
49
|
<a name="Top"></a>
|
50
50
|
<p><hr>
|
@@ -3517,18 +3517,18 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
3517
3517
|
|
3518
3518
|
<pre class="verbatim">int value;
|
3519
3519
|
int number;
|
3520
|
-
switch(number) {
|
3520
|
+
switch (number) {
|
3521
3521
|
case 1:
|
3522
3522
|
value = 1;
|
3523
3523
|
break;
|
3524
3524
|
case 2:
|
3525
3525
|
value = 2;
|
3526
|
-
case 3
|
3526
|
+
case 3: /* W0007 */
|
3527
3527
|
value = 3;
|
3528
3528
|
break;
|
3529
3529
|
default:
|
3530
|
-
|
3531
|
-
|
3530
|
+
value = 0;
|
3531
|
+
break;
|
3532
3532
|
}
|
3533
3533
|
</pre>
|
3534
3534
|
|
@@ -3598,13 +3598,17 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
3598
3598
|
|
3599
3599
|
<h4 class="subsection">6.19.3 サンプルコード</h4>
|
3600
3600
|
|
3601
|
-
<pre class="verbatim">
|
3602
|
-
|
3601
|
+
<pre class="verbatim">static void foo(void)
|
3602
|
+
{
|
3603
|
+
int i;
|
3604
|
+
int j;
|
3603
3605
|
|
3604
|
-
|
3605
|
-
|
3606
|
-
|
3607
|
-
|
3606
|
+
i++;
|
3607
|
+
for (i = 1, j = 0; i < 20; i++) {
|
3608
|
+
j += 2;
|
3609
|
+
if ((j % i) == 3) {
|
3610
|
+
continue; /* W0013 */
|
3611
|
+
}
|
3608
3612
|
}
|
3609
3613
|
}
|
3610
3614
|
</pre>
|
@@ -34342,14 +34346,14 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
34342
34346
|
|
34343
34347
|
<h4 class="subsection">6.589.2 内容</h4>
|
34344
34348
|
|
34345
|
-
<p
|
34346
|
-
|
34347
|
-
<p>このような記述は誤りの可能性があります。
|
34349
|
+
<p>このような記述は誤りの可能性があります。
|
34348
34350
|
|
34349
34351
|
<h4 class="subsection">6.589.3 サンプルコード</h4>
|
34350
34352
|
|
34351
|
-
|
34352
|
-
|
34353
|
+
<pre class="verbatim">int func(int a, int b, int c, int d)
|
34354
|
+
{
|
34355
|
+
return (a > b) + (c > d); /* W0716 */
|
34356
|
+
}
|
34353
34357
|
</pre>
|
34354
34358
|
|
34355
34359
|
<h4 class="subsection">6.589.4 関連メッセージ</h4>
|
@@ -34363,7 +34367,7 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
34363
34367
|
|
34364
34368
|
<h4 class="subsection">6.589.5 対応バージョン</h4>
|
34365
34369
|
|
34366
|
-
<p>
|
34370
|
+
<p>1.10.0
|
34367
34371
|
|
34368
34372
|
<div class="node">
|
34369
34373
|
<a name="W0717"></a>
|
@@ -34384,14 +34388,14 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
34384
34388
|
|
34385
34389
|
<h4 class="subsection">6.590.2 内容</h4>
|
34386
34390
|
|
34387
|
-
<p
|
34388
|
-
|
34389
|
-
<p>このような記述は誤りの可能性があります。
|
34391
|
+
<p>このような記述は誤りの可能性があります。
|
34390
34392
|
|
34391
34393
|
<h4 class="subsection">6.590.3 サンプルコード</h4>
|
34392
34394
|
|
34393
|
-
|
34394
|
-
|
34395
|
+
<pre class="verbatim">int func(int a, int b, int c)
|
34396
|
+
{
|
34397
|
+
return (a > b) + c; /* W0717 */
|
34398
|
+
}
|
34395
34399
|
</pre>
|
34396
34400
|
|
34397
34401
|
<h4 class="subsection">6.590.4 関連メッセージ</h4>
|
@@ -34405,7 +34409,7 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
34405
34409
|
|
34406
34410
|
<h4 class="subsection">6.590.5 対応バージョン</h4>
|
34407
34411
|
|
34408
|
-
<p>
|
34412
|
+
<p>1.10.0
|
34409
34413
|
|
34410
34414
|
<div class="node">
|
34411
34415
|
<a name="W0718"></a>
|
@@ -34426,14 +34430,14 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
34426
34430
|
|
34427
34431
|
<h4 class="subsection">6.591.2 内容</h4>
|
34428
34432
|
|
34429
|
-
<p
|
34430
|
-
|
34431
|
-
<p>このような記述は誤りの可能性があります。
|
34433
|
+
<p>このような記述は誤りの可能性があります。
|
34432
34434
|
|
34433
34435
|
<h4 class="subsection">6.591.3 サンプルコード</h4>
|
34434
34436
|
|
34435
|
-
|
34436
|
-
|
34437
|
+
<pre class="verbatim">int func(int a, int b, int c)
|
34438
|
+
{
|
34439
|
+
return a + (b > c); /* W0718 */
|
34440
|
+
}
|
34437
34441
|
</pre>
|
34438
34442
|
|
34439
34443
|
<h4 class="subsection">6.591.4 関連メッセージ</h4>
|
@@ -34447,7 +34451,7 @@ Up: <a rel="up" accesskey="u" href="#Messages">Messages</a>
|
|
34447
34451
|
|
34448
34452
|
<h4 class="subsection">6.591.5 対応バージョン</h4>
|
34449
34453
|
|
34450
|
-
<p>
|
34454
|
+
<p>1.10.0
|
34451
34455
|
|
34452
34456
|
<div class="node">
|
34453
34457
|
<a name="W0719"></a>
|
@@ -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.10.0 利用者ガイド
|
6
6
|
|
7
7
|
@copying
|
8
8
|
Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
|
@@ -3371,18 +3371,18 @@ int foo(int i)
|
|
3371
3371
|
@verbatim
|
3372
3372
|
int value;
|
3373
3373
|
int number;
|
3374
|
-
switch(number) {
|
3374
|
+
switch (number) {
|
3375
3375
|
case 1:
|
3376
3376
|
value = 1;
|
3377
3377
|
break;
|
3378
3378
|
case 2:
|
3379
3379
|
value = 2;
|
3380
|
-
case 3
|
3380
|
+
case 3: /* W0007 */
|
3381
3381
|
value = 3;
|
3382
3382
|
break;
|
3383
3383
|
default:
|
3384
|
-
|
3385
|
-
|
3384
|
+
value = 0;
|
3385
|
+
break;
|
3386
3386
|
}
|
3387
3387
|
@end verbatim
|
3388
3388
|
|
@@ -3436,13 +3436,17 @@ x = (a > 0) ? b++ : b--; /* W0010 */
|
|
3436
3436
|
@subsection サンプルコード
|
3437
3437
|
|
3438
3438
|
@verbatim
|
3439
|
-
|
3440
|
-
|
3439
|
+
static void foo(void)
|
3440
|
+
{
|
3441
|
+
int i;
|
3442
|
+
int j;
|
3441
3443
|
|
3442
|
-
|
3443
|
-
|
3444
|
-
|
3445
|
-
|
3444
|
+
i++;
|
3445
|
+
for (i = 1, j = 0; i < 20; i++) {
|
3446
|
+
j += 2;
|
3447
|
+
if ((j % i) == 3) {
|
3448
|
+
continue; /* W0013 */
|
3449
|
+
}
|
3446
3450
|
}
|
3447
3451
|
}
|
3448
3452
|
@end verbatim
|
@@ -29631,15 +29635,15 @@ int func(int a, int b, int c, int d)
|
|
29631
29635
|
|
29632
29636
|
@subsection 内容
|
29633
29637
|
|
29634
|
-
@b{このメッセージは AdLint 2.0.0 で出力する予定です。}
|
29635
|
-
|
29636
29638
|
このような記述は誤りの可能性があります。
|
29637
29639
|
|
29638
29640
|
@subsection サンプルコード
|
29639
29641
|
|
29640
|
-
@c{未実装}
|
29641
29642
|
@verbatim
|
29642
|
-
|
29643
|
+
int func(int a, int b, int c, int d)
|
29644
|
+
{
|
29645
|
+
return (a > b) + (c > d); /* W0716 */
|
29646
|
+
}
|
29643
29647
|
@end verbatim
|
29644
29648
|
|
29645
29649
|
@subsection 関連メッセージ
|
@@ -29653,7 +29657,7 @@ int func(int a, int b, int c, int d)
|
|
29653
29657
|
|
29654
29658
|
@subsection 対応バージョン
|
29655
29659
|
|
29656
|
-
|
29660
|
+
1.10.0
|
29657
29661
|
|
29658
29662
|
@node W0717
|
29659
29663
|
@section W0717
|
@@ -29665,15 +29669,16 @@ int func(int a, int b, int c, int d)
|
|
29665
29669
|
|
29666
29670
|
@subsection 内容
|
29667
29671
|
|
29668
|
-
@b{このメッセージは AdLint 2.0.0 で出力する予定です。}
|
29669
29672
|
|
29670
29673
|
このような記述は誤りの可能性があります。
|
29671
29674
|
|
29672
29675
|
@subsection サンプルコード
|
29673
29676
|
|
29674
|
-
@c{未実装}
|
29675
29677
|
@verbatim
|
29676
|
-
|
29678
|
+
int func(int a, int b, int c)
|
29679
|
+
{
|
29680
|
+
return (a > b) + c; /* W0717 */
|
29681
|
+
}
|
29677
29682
|
@end verbatim
|
29678
29683
|
|
29679
29684
|
@subsection 関連メッセージ
|
@@ -29687,7 +29692,7 @@ int func(int a, int b, int c, int d)
|
|
29687
29692
|
|
29688
29693
|
@subsection 対応バージョン
|
29689
29694
|
|
29690
|
-
|
29695
|
+
1.10.0
|
29691
29696
|
|
29692
29697
|
@node W0718
|
29693
29698
|
@section W0718
|
@@ -29699,15 +29704,16 @@ int func(int a, int b, int c, int d)
|
|
29699
29704
|
|
29700
29705
|
@subsection 内容
|
29701
29706
|
|
29702
|
-
@b{このメッセージは AdLint 2.0.0 で出力する予定です。}
|
29703
29707
|
|
29704
29708
|
このような記述は誤りの可能性があります。
|
29705
29709
|
|
29706
29710
|
@subsection サンプルコード
|
29707
29711
|
|
29708
|
-
@c{未実装}
|
29709
29712
|
@verbatim
|
29710
|
-
|
29713
|
+
int func(int a, int b, int c)
|
29714
|
+
{
|
29715
|
+
return a + (b > c); /* W0718 */
|
29716
|
+
}
|
29711
29717
|
@end verbatim
|
29712
29718
|
|
29713
29719
|
@subsection 関連メッセージ
|
@@ -29721,7 +29727,7 @@ int func(int a, int b, int c, int d)
|
|
29721
29727
|
|
29722
29728
|
@subsection 対応バージョン
|
29723
29729
|
|
29724
|
-
|
29730
|
+
1.10.0
|
29725
29731
|
|
29726
29732
|
@node W0719
|
29727
29733
|
@section W0719
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# Unit specification of C type models.
|
2
|
+
#
|
3
|
+
# Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
4
|
+
# Copyright:: Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
|
5
|
+
# License:: GPLv3+: GNU General Public License version 3 or later
|
6
|
+
#
|
7
|
+
# Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
8
|
+
|
9
|
+
#--
|
10
|
+
# ___ ____ __ ___ _________
|
11
|
+
# / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
|
12
|
+
# / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
|
13
|
+
# / __ |/ /_/ / /___/ / /| / / /
|
14
|
+
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
|
15
|
+
#
|
16
|
+
# This file is part of AdLint.
|
17
|
+
#
|
18
|
+
# AdLint is free software: you can redistribute it and/or modify it under the
|
19
|
+
# terms of the GNU General Public License as published by the Free Software
|
20
|
+
# Foundation, either version 3 of the License, or (at your option) any later
|
21
|
+
# version.
|
22
|
+
#
|
23
|
+
# AdLint is distributed in the hope that it will be useful, but WITHOUT ANY
|
24
|
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
25
|
+
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
26
|
+
#
|
27
|
+
# You should have received a copy of the GNU General Public License along with
|
28
|
+
# AdLint. If not, see <http://www.gnu.org/licenses/>.
|
29
|
+
#
|
30
|
+
#++
|
31
|
+
|
32
|
+
require "spec_helper"
|
33
|
+
|
34
|
+
module AdLint
|
35
|
+
module C
|
36
|
+
|
37
|
+
describe Type do
|
38
|
+
before(:all) { Traits.instance.read_from($default_traits) }
|
39
|
+
|
40
|
+
let(:type_table) { TypeTable.new }
|
41
|
+
let(:int_ptr) { pointer_type(int_type) }
|
42
|
+
let(:const_int_ptr) { pointer_type(qualified_type(int_type, :const)) }
|
43
|
+
let(:const_int) { qualified_type(int_type, :const) }
|
44
|
+
let(:volatile_int) { qualified_type(int_type, :volatile) }
|
45
|
+
let(:const_volatile_int) { qualified_type(int_type, :const, :volatile) }
|
46
|
+
|
47
|
+
describe ArrayType do
|
48
|
+
context "detecting W0583" do
|
49
|
+
subject { array_type(int_type, 3) }
|
50
|
+
it { should be_convertible(const_int_ptr) }
|
51
|
+
end
|
52
|
+
|
53
|
+
context "detecting W0583" do
|
54
|
+
subject { array_type(int_type, 3) }
|
55
|
+
it { should be_convertible(int_ptr) }
|
56
|
+
end
|
57
|
+
|
58
|
+
context "detecting W0583" do
|
59
|
+
subject { array_type(int_type) }
|
60
|
+
it { should be_convertible(const_int_ptr) }
|
61
|
+
end
|
62
|
+
|
63
|
+
context "detecting W0583" do
|
64
|
+
subject { array_type(int_type) }
|
65
|
+
it { should be_convertible(int_ptr) }
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe PointerType do
|
70
|
+
context "detecting W0583" do
|
71
|
+
subject { const_int_ptr }
|
72
|
+
it { should_not be_convertible(array_type(int_type)) }
|
73
|
+
end
|
74
|
+
|
75
|
+
context "detecting W0583" do
|
76
|
+
subject { int_ptr }
|
77
|
+
it { should be_convertible(array_type(int_type)) }
|
78
|
+
end
|
79
|
+
|
80
|
+
context "more cv-qualified check of `const > none'" do
|
81
|
+
subject { const_int }
|
82
|
+
it { should be_more_cv_qualified(int_type) }
|
83
|
+
end
|
84
|
+
|
85
|
+
context "more cv-qualified check of `volatile > none'" do
|
86
|
+
subject { volatile_int }
|
87
|
+
it { should be_more_cv_qualified(int_type) }
|
88
|
+
end
|
89
|
+
|
90
|
+
context "more cv-qualified check of `const volatile > none'" do
|
91
|
+
subject { const_volatile_int }
|
92
|
+
it { should be_more_cv_qualified(int_type) }
|
93
|
+
end
|
94
|
+
|
95
|
+
context "more cv-qualified check of `const volatile > const'" do
|
96
|
+
subject { const_volatile_int }
|
97
|
+
it { should be_more_cv_qualified(const_int) }
|
98
|
+
end
|
99
|
+
|
100
|
+
context "more cv-qualified check of `const volatile > volatile'" do
|
101
|
+
subject { const_volatile_int }
|
102
|
+
it { should be_more_cv_qualified(volatile_int) }
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
include TypeTableMediator
|
107
|
+
end
|
108
|
+
|
109
|
+
end
|
110
|
+
end
|