adlint 1.2.0 → 1.4.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 -1
- data/ChangeLog +272 -0
- data/MANIFEST +4 -0
- data/NEWS +39 -4
- data/etc/mesg.d/en_US/messages.yml +2 -2
- data/etc/mesg.d/ja_JP/messages.yml +2 -2
- data/lib/adlint/c.rb +1 -0
- data/lib/adlint/c/expr.rb +20 -26
- data/lib/adlint/c/interp.rb +137 -45
- data/lib/adlint/c/mediator.rb +4 -0
- data/lib/adlint/c/message.rb +479 -16
- data/lib/adlint/c/message_shima.rb +151 -0
- data/lib/adlint/c/phase.rb +23 -0
- data/lib/adlint/c/resolver.rb +1 -0
- data/lib/adlint/c/syntax.rb +93 -89
- data/lib/adlint/c/type.rb +70 -0
- data/lib/adlint/cpp/eval.rb +12 -1
- data/lib/adlint/cpp/message_shima.rb +51 -0
- data/lib/adlint/cpp/phase.rb +3 -0
- data/lib/adlint/version.rb +2 -2
- data/share/demo/Makefile +3 -0
- data/share/demo/bad_enum/bad_enum.c +27 -0
- data/share/demo/bad_macro/bad_macro.c +4 -0
- data/share/demo/bad_return/bad_return.c +83 -0
- data/share/demo/incomplete_type/incomplete_type.c +3 -0
- data/share/demo/overflow/overflow.c +59 -5
- data/share/demo/union_type/union_type.c +13 -0
- data/share/demo/unnamed_member/unnamed_member.c +13 -0
- data/share/demo/various_fundef/various_fundef.c +43 -0
- data/share/demo/wrap_around/wrap_around.c +95 -21
- 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 +222 -149
- data/share/doc/users_guide_en.texi +194 -120
- data/share/doc/users_guide_ja.html +224 -167
- data/share/doc/users_guide_ja.texi +194 -137
- metadata +6 -2
@@ -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.4.0 User's Guide
|
6
6
|
|
7
7
|
@copying
|
8
8
|
Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
|
@@ -2685,7 +2685,7 @@ context_line
|
|
2685
2685
|
* W0722::A value of signed statement is overflow.
|
2686
2686
|
* W0723::A value of signed statement might be overflow.
|
2687
2687
|
* W0724::An unrecognized preprocessing directive is ignored by conditional include directive.
|
2688
|
-
* W0726::A function `%s()' which return value is declared as qualified void type
|
2688
|
+
* W0726::A function `%s()' which return value is declared as qualified void type, `return expression;' is found.
|
2689
2689
|
* W0727::The value not part of the enumeration type is used.
|
2690
2690
|
* W0728::Other enumeration literal of enumeration type is passed to enumeration literal of formal argument as actual argument.
|
2691
2691
|
* W0729::An enumeration literal of the other enumeration type is substituted for enumeration type object.
|
@@ -25297,14 +25297,15 @@ An union has a member which type is floating-point.
|
|
25297
25297
|
|
25298
25298
|
@subsection Content
|
25299
25299
|
|
25300
|
-
@b{This message will be supported in AdLint 2.0.0}
|
25301
|
-
|
25302
25300
|
Under construction.
|
25303
25301
|
|
25304
25302
|
@subsection Sample code
|
25305
25303
|
|
25306
25304
|
@verbatim
|
25307
|
-
|
25305
|
+
union UNI { /* W0606 */
|
25306
|
+
float a;
|
25307
|
+
int b;
|
25308
|
+
};
|
25308
25309
|
@end verbatim
|
25309
25310
|
|
25310
25311
|
@subsection Related message
|
@@ -25313,7 +25314,7 @@ None.
|
|
25313
25314
|
|
25314
25315
|
@subsection Since
|
25315
25316
|
|
25316
|
-
|
25317
|
+
1.4.0
|
25317
25318
|
|
25318
25319
|
@node W0607
|
25319
25320
|
@section W0607
|
@@ -28491,8 +28492,6 @@ Under construction.
|
|
28491
28492
|
|
28492
28493
|
@subsection Content
|
28493
28494
|
|
28494
|
-
@b{This message will be supported in AdLint 2.0.0}
|
28495
|
-
|
28496
28495
|
Under construction.
|
28497
28496
|
|
28498
28497
|
@subsection Sample code
|
@@ -28512,7 +28511,7 @@ Under construction.
|
|
28512
28511
|
|
28513
28512
|
@subsection Since
|
28514
28513
|
|
28515
|
-
|
28514
|
+
1.4.0
|
28516
28515
|
|
28517
28516
|
@node W0688
|
28518
28517
|
@section W0688
|
@@ -28742,17 +28741,13 @@ If #undef the 'assert' macro, and enable to call its name function, the result i
|
|
28742
28741
|
|
28743
28742
|
@subsection Content
|
28744
28743
|
|
28745
|
-
@b{This message will be supported in AdLint 2.0.0}
|
28746
|
-
|
28747
28744
|
Under construction.
|
28748
28745
|
|
28749
28746
|
@subsection Sample code
|
28750
28747
|
|
28751
28748
|
@verbatim
|
28752
28749
|
#undef assert /* W0695 */
|
28753
|
-
void assert(int a)
|
28754
|
-
{
|
28755
|
-
}
|
28750
|
+
extern void assert(int a);
|
28756
28751
|
@end verbatim
|
28757
28752
|
|
28758
28753
|
@subsection Related message
|
@@ -28761,7 +28756,7 @@ None.
|
|
28761
28756
|
|
28762
28757
|
@subsection Since
|
28763
28758
|
|
28764
|
-
|
28759
|
+
1.4.0
|
28765
28760
|
|
28766
28761
|
@node W0696
|
28767
28762
|
@section W0696
|
@@ -28847,14 +28842,15 @@ A `return;' statement is found in a function `%s' which has a return value.
|
|
28847
28842
|
|
28848
28843
|
@subsection Content
|
28849
28844
|
|
28850
|
-
@b{This message will be supported in AdLint 2.0.0}
|
28851
|
-
|
28852
28845
|
Under construction.
|
28853
28846
|
|
28854
28847
|
@subsection Sample code
|
28855
28848
|
|
28856
28849
|
@verbatim
|
28857
|
-
|
28850
|
+
int func(void)
|
28851
|
+
{
|
28852
|
+
return; /* W0698 */
|
28853
|
+
}
|
28858
28854
|
@end verbatim
|
28859
28855
|
|
28860
28856
|
@subsection Related message
|
@@ -28867,7 +28863,7 @@ Under construction.
|
|
28867
28863
|
|
28868
28864
|
@subsection Since
|
28869
28865
|
|
28870
|
-
|
28866
|
+
1.4.0
|
28871
28867
|
|
28872
28868
|
@node W0699
|
28873
28869
|
@section W0699
|
@@ -28879,14 +28875,15 @@ The return value of function `%s()' is unspecified. The return value is implicit
|
|
28879
28875
|
|
28880
28876
|
@subsection Content
|
28881
28877
|
|
28882
|
-
@b{This message will be supported in AdLint 2.0.0}
|
28883
|
-
|
28884
28878
|
Under construction.
|
28885
28879
|
|
28886
28880
|
@subsection Sample code
|
28887
28881
|
|
28888
28882
|
@verbatim
|
28889
|
-
|
28883
|
+
extern func(void)
|
28884
|
+
{
|
28885
|
+
return; /* W0699 */
|
28886
|
+
}
|
28890
28887
|
@end verbatim
|
28891
28888
|
|
28892
28889
|
@subsection Related message
|
@@ -28899,7 +28896,7 @@ Under construction.
|
|
28899
28896
|
|
28900
28897
|
@subsection Since
|
28901
28898
|
|
28902
|
-
|
28899
|
+
1.4.0
|
28903
28900
|
|
28904
28901
|
@node W0700
|
28905
28902
|
@section W0700
|
@@ -29398,14 +29395,16 @@ The value with floating-point type doesn't fit in the range of converted type.
|
|
29398
29395
|
|
29399
29396
|
@subsection Content
|
29400
29397
|
|
29401
|
-
@b{This message will be supported in AdLint 2.0.0}
|
29402
|
-
|
29403
29398
|
Under construction.
|
29404
29399
|
|
29405
29400
|
@subsection Sample code
|
29406
29401
|
|
29407
29402
|
@verbatim
|
29408
|
-
|
29403
|
+
signed char sc1 = (signed char) 127.5; /* OK */
|
29404
|
+
signed char sc2 = (signed char) 128.5; /* W0720 */
|
29405
|
+
|
29406
|
+
signed char sc3 = (signed char) -128.5; /* OK */
|
29407
|
+
signed char sc4 = (signed char) -129.5; /* W0720 */
|
29409
29408
|
@end verbatim
|
29410
29409
|
|
29411
29410
|
@subsection Related message
|
@@ -29414,7 +29413,7 @@ None.
|
|
29414
29413
|
|
29415
29414
|
@subsection Since
|
29416
29415
|
|
29417
|
-
|
29416
|
+
1.4.0
|
29418
29417
|
|
29419
29418
|
@node W0721
|
29420
29419
|
@section W0721
|
@@ -29426,15 +29425,16 @@ This volatile integer type doesn't have enough size to keep pointer value.
|
|
29426
29425
|
|
29427
29426
|
@subsection Content
|
29428
29427
|
|
29429
|
-
@b{This message will be supported in AdLint 2.0.0}
|
29430
|
-
|
29431
29428
|
Under construction.
|
29432
29429
|
|
29433
29430
|
@subsection Sample code
|
29434
29431
|
|
29435
29432
|
@verbatim
|
29436
|
-
|
29437
|
-
|
29433
|
+
void func(int *p)
|
29434
|
+
{
|
29435
|
+
/* when short is 16 bit long and pointer is 32 bit long */
|
29436
|
+
unsigned short us = (unsigned short) p; /* W0721 */
|
29437
|
+
}
|
29438
29438
|
@end verbatim
|
29439
29439
|
|
29440
29440
|
@subsection Related message
|
@@ -29443,7 +29443,7 @@ None.
|
|
29443
29443
|
|
29444
29444
|
@subsection Since
|
29445
29445
|
|
29446
|
-
|
29446
|
+
1.4.0
|
29447
29447
|
|
29448
29448
|
@node W0722
|
29449
29449
|
@section W0722
|
@@ -29455,17 +29455,19 @@ A value of signed statement is overflow.
|
|
29455
29455
|
|
29456
29456
|
@subsection Content
|
29457
29457
|
|
29458
|
-
@b{This message will be supported in AdLint 2.0.0}
|
29459
|
-
|
29460
29458
|
Under construction.
|
29461
29459
|
|
29462
29460
|
@subsection Sample code
|
29463
29461
|
|
29464
29462
|
@verbatim
|
29465
|
-
int func(int a)
|
29463
|
+
int func(int a)
|
29466
29464
|
{
|
29467
|
-
|
29468
|
-
|
29465
|
+
/* when int is 32 bit long */
|
29466
|
+
if (a < 0) {
|
29467
|
+
return a + 1; /* OK */
|
29468
|
+
}
|
29469
|
+
else if (a < 2147483647) {
|
29470
|
+
return a + 1; /* OK */
|
29469
29471
|
}
|
29470
29472
|
|
29471
29473
|
return a + 1; /* W0722 */
|
@@ -29480,7 +29482,7 @@ int func(int a) /* int type is 32 bit long */
|
|
29480
29482
|
|
29481
29483
|
@subsection Since
|
29482
29484
|
|
29483
|
-
|
29485
|
+
1.4.0
|
29484
29486
|
|
29485
29487
|
@node W0723
|
29486
29488
|
@section W0723
|
@@ -29492,14 +29494,23 @@ A value of signed statement might be overflow.
|
|
29492
29494
|
|
29493
29495
|
@subsection Content
|
29494
29496
|
|
29495
|
-
@b{This message will be supported in AdLint 2.0.0}
|
29496
|
-
|
29497
29497
|
Under construction.
|
29498
29498
|
|
29499
29499
|
@subsection Sample code
|
29500
29500
|
|
29501
29501
|
@verbatim
|
29502
|
-
|
29502
|
+
int func(int a)
|
29503
|
+
{
|
29504
|
+
/* when int is 32 bit long */
|
29505
|
+
if (a < 0) {
|
29506
|
+
return a + 1; /* OK */
|
29507
|
+
}
|
29508
|
+
else if (a < 2000000000) {
|
29509
|
+
return a + 1; /* OK */
|
29510
|
+
}
|
29511
|
+
|
29512
|
+
return a + 1; /* W0723 */
|
29513
|
+
}
|
29503
29514
|
@end verbatim
|
29504
29515
|
|
29505
29516
|
@subsection Related message
|
@@ -29510,7 +29521,7 @@ Under construction.
|
|
29510
29521
|
|
29511
29522
|
@subsection Since
|
29512
29523
|
|
29513
|
-
|
29524
|
+
1.4.0
|
29514
29525
|
|
29515
29526
|
@node W0724
|
29516
29527
|
@section W0724
|
@@ -29546,20 +29557,18 @@ None.
|
|
29546
29557
|
|
29547
29558
|
@subsection Message body
|
29548
29559
|
|
29549
|
-
A function `%s()' which return value is declared as qualified void type
|
29560
|
+
A function `%s()' which return value is declared as qualified void type, `return expression;' is found.
|
29550
29561
|
|
29551
29562
|
@subsection Content
|
29552
29563
|
|
29553
|
-
@b{This message will be supported in AdLint 2.0.0}
|
29554
|
-
|
29555
29564
|
Under construction.
|
29556
29565
|
|
29557
29566
|
@subsection Sample code
|
29558
29567
|
|
29559
29568
|
@verbatim
|
29560
|
-
void func(int a)
|
29569
|
+
const void func(int a)
|
29561
29570
|
{
|
29562
|
-
if(a == 0) {
|
29571
|
+
if (a == 0) {
|
29563
29572
|
return 0; /* W0726 */
|
29564
29573
|
}
|
29565
29574
|
}
|
@@ -29571,7 +29580,7 @@ None.
|
|
29571
29580
|
|
29572
29581
|
@subsection Since
|
29573
29582
|
|
29574
|
-
|
29583
|
+
1.4.0
|
29575
29584
|
|
29576
29585
|
@node W0727
|
29577
29586
|
@section W0727
|
@@ -29583,18 +29592,18 @@ The value not part of the enumeration type is used.
|
|
29583
29592
|
|
29584
29593
|
@subsection Content
|
29585
29594
|
|
29586
|
-
@b{This message will be supported in AdLint 2.0.0}
|
29587
|
-
|
29588
29595
|
Under construction.
|
29589
29596
|
|
29590
29597
|
@subsection Sample code
|
29591
29598
|
|
29592
29599
|
@verbatim
|
29593
29600
|
enum Fruits {
|
29594
|
-
|
29595
|
-
|
29596
|
-
|
29601
|
+
APPLE = 1,
|
29602
|
+
BANANA,
|
29603
|
+
ORANGE
|
29597
29604
|
};
|
29605
|
+
|
29606
|
+
enum Fruits fruit = 5; /* W0727 */
|
29598
29607
|
@end verbatim
|
29599
29608
|
|
29600
29609
|
@subsection Related message
|
@@ -29608,7 +29617,7 @@ enum Fruits {
|
|
29608
29617
|
|
29609
29618
|
@subsection Since
|
29610
29619
|
|
29611
|
-
|
29620
|
+
1.4.0
|
29612
29621
|
|
29613
29622
|
@node W0728
|
29614
29623
|
@section W0728
|
@@ -29620,14 +29629,20 @@ Other enumeration literal of enumeration type is passed to enumeration literal o
|
|
29620
29629
|
|
29621
29630
|
@subsection Content
|
29622
29631
|
|
29623
|
-
@b{This message will be supported in AdLint 2.0.0}
|
29624
|
-
|
29625
29632
|
Under construction.
|
29626
29633
|
|
29627
29634
|
@subsection Sample code
|
29628
29635
|
|
29629
29636
|
@verbatim
|
29630
|
-
|
29637
|
+
enum Color { RED, BLUE, GREEN };
|
29638
|
+
enum Fruits { APPLE, BANANA, ORANGE };
|
29639
|
+
|
29640
|
+
extern void func1(enum Color);
|
29641
|
+
|
29642
|
+
void func2(void)
|
29643
|
+
{
|
29644
|
+
func1(ORANGE); /* W0728 */
|
29645
|
+
}
|
29631
29646
|
@end verbatim
|
29632
29647
|
|
29633
29648
|
@subsection Related message
|
@@ -29641,7 +29656,7 @@ Under construction.
|
|
29641
29656
|
|
29642
29657
|
@subsection Since
|
29643
29658
|
|
29644
|
-
|
29659
|
+
1.4.0
|
29645
29660
|
|
29646
29661
|
@node W0729
|
29647
29662
|
@section W0729
|
@@ -29653,14 +29668,20 @@ An enumeration literal of the other enumeration type is substituted for enumerat
|
|
29653
29668
|
|
29654
29669
|
@subsection Content
|
29655
29670
|
|
29656
|
-
@b{This message will be supported in AdLint 2.0.0}
|
29657
|
-
|
29658
29671
|
Under construction.
|
29659
29672
|
|
29660
29673
|
@subsection Sample code
|
29661
29674
|
|
29662
29675
|
@verbatim
|
29663
|
-
|
29676
|
+
enum Color { RED, BLUE, GREEN };
|
29677
|
+
enum Fruits { APPLE, BANANA, ORANGE };
|
29678
|
+
|
29679
|
+
void func(void)
|
29680
|
+
{
|
29681
|
+
enum Color c;
|
29682
|
+
|
29683
|
+
c = ORANGE; /* W0729 */
|
29684
|
+
}
|
29664
29685
|
@end verbatim
|
29665
29686
|
|
29666
29687
|
@subsection Related message
|
@@ -29674,7 +29695,7 @@ Under construction.
|
|
29674
29695
|
|
29675
29696
|
@subsection Since
|
29676
29697
|
|
29677
|
-
|
29698
|
+
1.4.0
|
29678
29699
|
|
29679
29700
|
@node W0730
|
29680
29701
|
@section W0730
|
@@ -29686,14 +29707,18 @@ A function declared return value to enumeration type returned an enumeration lit
|
|
29686
29707
|
|
29687
29708
|
@subsection Content
|
29688
29709
|
|
29689
|
-
@b{This message will be supported in AdLint 2.0.0}
|
29690
|
-
|
29691
29710
|
Under construction.
|
29692
29711
|
|
29693
29712
|
@subsection Sample code
|
29694
29713
|
|
29695
29714
|
@verbatim
|
29696
|
-
|
29715
|
+
enum Color { RED, BLUE, GREEN };
|
29716
|
+
enum Fruits { APPLE, BANANA, ORANGE };
|
29717
|
+
|
29718
|
+
enum Color func(void)
|
29719
|
+
{
|
29720
|
+
return ORANGE; /* W0730 */
|
29721
|
+
}
|
29697
29722
|
@end verbatim
|
29698
29723
|
|
29699
29724
|
@subsection Related message
|
@@ -29707,7 +29732,7 @@ Under construction.
|
|
29707
29732
|
|
29708
29733
|
@subsection Since
|
29709
29734
|
|
29710
|
-
|
29735
|
+
1.4.0
|
29711
29736
|
|
29712
29737
|
@node W0731
|
29713
29738
|
@section W0731
|
@@ -29719,14 +29744,25 @@ The value of `%s' in 'case' label of 'switch' statement doesn't belong enumerati
|
|
29719
29744
|
|
29720
29745
|
@subsection Content
|
29721
29746
|
|
29722
|
-
@b{This message will be supported in AdLint 2.0.0}
|
29723
|
-
|
29724
29747
|
Under construction.
|
29725
29748
|
|
29726
29749
|
@subsection Sample code
|
29727
29750
|
|
29728
29751
|
@verbatim
|
29729
|
-
|
29752
|
+
enum Color { RED, BLUE, GREEN };
|
29753
|
+
enum Fruits { APPLE, BANANA, ORANGE, GRAPE };
|
29754
|
+
|
29755
|
+
int func(enum Color c)
|
29756
|
+
{
|
29757
|
+
switch (c) {
|
29758
|
+
case RED:
|
29759
|
+
return 1;
|
29760
|
+
case GRAPE: /* W0731 */
|
29761
|
+
return 2;
|
29762
|
+
}
|
29763
|
+
|
29764
|
+
return 0;
|
29765
|
+
}
|
29730
29766
|
@end verbatim
|
29731
29767
|
|
29732
29768
|
@subsection Related message
|
@@ -29740,7 +29776,7 @@ Under construction.
|
|
29740
29776
|
|
29741
29777
|
@subsection Since
|
29742
29778
|
|
29743
|
-
|
29779
|
+
1.4.0
|
29744
29780
|
|
29745
29781
|
@node W0732
|
29746
29782
|
@section W0732
|
@@ -29916,14 +29952,12 @@ The content of `enum %s' is unknown. The enumeration tag is declared without def
|
|
29916
29952
|
|
29917
29953
|
@subsection Content
|
29918
29954
|
|
29919
|
-
@b{This message will be supported in AdLint 2.0.0}
|
29920
|
-
|
29921
29955
|
Under construction.
|
29922
29956
|
|
29923
29957
|
@subsection Sample code
|
29924
29958
|
|
29925
29959
|
@verbatim
|
29926
|
-
|
29960
|
+
extern enum Foo foo; /* W0737 */
|
29927
29961
|
@end verbatim
|
29928
29962
|
|
29929
29963
|
@subsection Related message
|
@@ -29932,7 +29966,7 @@ None.
|
|
29932
29966
|
|
29933
29967
|
@subsection Since
|
29934
29968
|
|
29935
|
-
|
29969
|
+
1.4.0
|
29936
29970
|
|
29937
29971
|
@node W0738
|
29938
29972
|
@section W0738
|
@@ -29944,14 +29978,18 @@ An implicit type conversion from positive integer constant expression to smaller
|
|
29944
29978
|
|
29945
29979
|
@subsection Content
|
29946
29980
|
|
29947
|
-
@b{This message will be supported in AdLint 2.0.0}
|
29948
|
-
|
29949
29981
|
Under construction.
|
29950
29982
|
|
29951
29983
|
@subsection Sample code
|
29952
29984
|
|
29953
29985
|
@verbatim
|
29954
|
-
|
29986
|
+
/* when char is 8 bit long */
|
29987
|
+
const unsigned char uc1 = 255; /* OK */
|
29988
|
+
const unsigned char uc2 = 256; /* W0738 */
|
29989
|
+
|
29990
|
+
/* when int is 32 bit long */
|
29991
|
+
const unsigned int ui1 = 4294967295; /* OK */
|
29992
|
+
const unsigned int ui2 = 4294967296; /* W0738 */
|
29955
29993
|
@end verbatim
|
29956
29994
|
|
29957
29995
|
@subsection Related message
|
@@ -29960,7 +29998,7 @@ None.
|
|
29960
29998
|
|
29961
29999
|
@subsection Since
|
29962
30000
|
|
29963
|
-
|
30001
|
+
1.4.0
|
29964
30002
|
|
29965
30003
|
@node W0739
|
29966
30004
|
@section W0739
|
@@ -29972,14 +30010,13 @@ The result of unsigned subtraction in constant expression is minus.
|
|
29972
30010
|
|
29973
30011
|
@subsection Content
|
29974
30012
|
|
29975
|
-
@b{This message will be supported in AdLint 2.0.0}
|
29976
|
-
|
29977
30013
|
Under construction.
|
29978
30014
|
|
29979
30015
|
@subsection Sample code
|
29980
30016
|
|
29981
30017
|
@verbatim
|
29982
|
-
unsigned int
|
30018
|
+
const unsigned int ui1 = 3U - 3U; /* OK */
|
30019
|
+
const unsigned int ui2 = 3U - 5U; /* W0739 */
|
29983
30020
|
@end verbatim
|
29984
30021
|
|
29985
30022
|
@subsection Related message
|
@@ -29991,7 +30028,7 @@ unsigned int ui = 5U - 10U; /* W0739 */
|
|
29991
30028
|
|
29992
30029
|
@subsection Since
|
29993
30030
|
|
29994
|
-
|
30031
|
+
1.4.0
|
29995
30032
|
|
29996
30033
|
@node W0740
|
29997
30034
|
@section W0740
|
@@ -30003,16 +30040,14 @@ The result of unsigned addition in constant expression beyond the maximum.
|
|
30003
30040
|
|
30004
30041
|
@subsection Content
|
30005
30042
|
|
30006
|
-
@b{This message will be supported in AdLint 2.0.0}
|
30007
|
-
|
30008
30043
|
Under construction.
|
30009
30044
|
|
30010
30045
|
@subsection Sample code
|
30011
30046
|
|
30012
30047
|
@verbatim
|
30013
|
-
|
30014
|
-
|
30015
|
-
unsigned
|
30048
|
+
/* when int is 32 bit long */
|
30049
|
+
const unsigned int ui1 = 4294967294U + 1U; /* OK */
|
30050
|
+
const unsigned int ui2 = 4294967295U + 1U; /* W0740 */
|
30016
30051
|
@end verbatim
|
30017
30052
|
|
30018
30053
|
@subsection Related message
|
@@ -30024,7 +30059,7 @@ unsigned char uc = MACRO + 10; /* W0740 */
|
|
30024
30059
|
|
30025
30060
|
@subsection Since
|
30026
30061
|
|
30027
|
-
|
30062
|
+
1.4.0
|
30028
30063
|
|
30029
30064
|
@node W0741
|
30030
30065
|
@section W0741
|
@@ -30036,14 +30071,14 @@ The result of unsigned multiplication in constant expression beyond the maximum.
|
|
30036
30071
|
|
30037
30072
|
@subsection Content
|
30038
30073
|
|
30039
|
-
@b{This message will be supported in AdLint 2.0.0}
|
30040
|
-
|
30041
30074
|
Under construction.
|
30042
30075
|
|
30043
30076
|
@subsection Sample code
|
30044
30077
|
|
30045
30078
|
@verbatim
|
30046
|
-
/*
|
30079
|
+
/* when int is 32 bit long */
|
30080
|
+
const unsigned int ui1 = 2000000000U * 2U; /* OK */
|
30081
|
+
const unsigned int ui2 = 3000000000U * 2U; /* W0741 */
|
30047
30082
|
@end verbatim
|
30048
30083
|
|
30049
30084
|
@subsection Related message
|
@@ -30055,7 +30090,7 @@ Under construction.
|
|
30055
30090
|
|
30056
30091
|
@subsection Since
|
30057
30092
|
|
30058
|
-
|
30093
|
+
1.4.0
|
30059
30094
|
|
30060
30095
|
@node W0742
|
30061
30096
|
@section W0742
|
@@ -30097,18 +30132,18 @@ The value of integer constant expression beyond the range of might be expressed
|
|
30097
30132
|
|
30098
30133
|
@subsection Content
|
30099
30134
|
|
30100
|
-
@b{This message will be supported in AdLint 2.0.0}
|
30101
|
-
|
30102
30135
|
Under construction.
|
30103
30136
|
|
30104
30137
|
@subsection Sample code
|
30105
30138
|
|
30106
30139
|
@verbatim
|
30107
|
-
|
30108
|
-
|
30109
|
-
signed char
|
30140
|
+
/* when char is 8 bit long */
|
30141
|
+
const signed char sc1 = 127; /* OK */
|
30142
|
+
const signed char sc2 = 128; /* W0743 */
|
30110
30143
|
|
30111
|
-
|
30144
|
+
/* when int is 32 bit long */
|
30145
|
+
const int si1 = 2147483647; /* OK */
|
30146
|
+
const int si2 = 2147483648; /* W0743 */
|
30112
30147
|
@end verbatim
|
30113
30148
|
|
30114
30149
|
@subsection Related message
|
@@ -30117,7 +30152,7 @@ None.
|
|
30117
30152
|
|
30118
30153
|
@subsection Since
|
30119
30154
|
|
30120
|
-
|
30155
|
+
1.4.0
|
30121
30156
|
|
30122
30157
|
@node W0744
|
30123
30158
|
@section W0744
|
@@ -32279,14 +32314,19 @@ This structure or union doesn't have a named member.
|
|
32279
32314
|
|
32280
32315
|
@subsection Content
|
32281
32316
|
|
32282
|
-
@b{This message will be supported in AdLint 2.0.0}
|
32283
|
-
|
32284
32317
|
Under construction.
|
32285
32318
|
|
32286
32319
|
@subsection Sample code
|
32287
32320
|
|
32288
32321
|
@verbatim
|
32289
|
-
struct
|
32322
|
+
struct foo { /* W0801 */
|
32323
|
+
};
|
32324
|
+
|
32325
|
+
struct bar { /* W0801 */
|
32326
|
+
int;
|
32327
|
+
int :1;
|
32328
|
+
long;
|
32329
|
+
double;
|
32290
32330
|
};
|
32291
32331
|
@end verbatim
|
32292
32332
|
|
@@ -32296,7 +32336,7 @@ None.
|
|
32296
32336
|
|
32297
32337
|
@subsection Since
|
32298
32338
|
|
32299
|
-
|
32339
|
+
1.4.0
|
32300
32340
|
|
32301
32341
|
@node W0802
|
32302
32342
|
@section W0802
|
@@ -32426,14 +32466,12 @@ It is trying to define a macro named `defined'.
|
|
32426
32466
|
|
32427
32467
|
@subsection Content
|
32428
32468
|
|
32429
|
-
@b{This message will be supported in AdLint 2.0.0}
|
32430
|
-
|
32431
32469
|
Under construction.
|
32432
32470
|
|
32433
32471
|
@subsection Sample code
|
32434
32472
|
|
32435
32473
|
@verbatim
|
32436
|
-
|
32474
|
+
#define defined !defined /* W0806 */
|
32437
32475
|
@end verbatim
|
32438
32476
|
|
32439
32477
|
@subsection Related message
|
@@ -32445,7 +32483,7 @@ Under construction.
|
|
32445
32483
|
|
32446
32484
|
@subsection Since
|
32447
32485
|
|
32448
|
-
|
32486
|
+
1.4.0
|
32449
32487
|
|
32450
32488
|
@node W0807
|
32451
32489
|
@section W0807
|
@@ -32802,6 +32840,8 @@ A long long type is using.
|
|
32802
32840
|
|
32803
32841
|
@subsection Content
|
32804
32842
|
|
32843
|
+
@b{This message will be supported in AdLint 2.0.0}
|
32844
|
+
|
32805
32845
|
Under construction.
|
32806
32846
|
|
32807
32847
|
@subsection Sample code
|
@@ -32818,7 +32858,7 @@ long long a = 0; /* W0834 */
|
|
32818
32858
|
|
32819
32859
|
@subsection Since
|
32820
32860
|
|
32821
|
-
|
32861
|
+
2.0.0 (planned)
|
32822
32862
|
|
32823
32863
|
@node W0835
|
32824
32864
|
@section W0835
|
@@ -33185,14 +33225,25 @@ A 'volatile' or 'const' qualifier is used for the type of function return value.
|
|
33185
33225
|
|
33186
33226
|
@subsection Content
|
33187
33227
|
|
33188
|
-
@b{This message will be supported in AdLint 2.0.0}
|
33189
|
-
|
33190
33228
|
Under construction.
|
33191
33229
|
|
33192
33230
|
@subsection Sample code
|
33193
33231
|
|
33194
33232
|
@verbatim
|
33195
|
-
|
33233
|
+
extern const int func1(int); /* W1033 */
|
33234
|
+
|
33235
|
+
const int func2(int i) /* W1033 */
|
33236
|
+
{
|
33237
|
+
return i + 1;
|
33238
|
+
}
|
33239
|
+
|
33240
|
+
const int *func3(int i) /* OK */
|
33241
|
+
{
|
33242
|
+
static int j;
|
33243
|
+
|
33244
|
+
j = i;
|
33245
|
+
return &j;
|
33246
|
+
}
|
33196
33247
|
@end verbatim
|
33197
33248
|
|
33198
33249
|
@subsection Related message
|
@@ -33201,7 +33252,7 @@ None.
|
|
33201
33252
|
|
33202
33253
|
@subsection Since
|
33203
33254
|
|
33204
|
-
|
33255
|
+
1.4.0
|
33205
33256
|
|
33206
33257
|
@node W1034
|
33207
33258
|
@section W1034
|
@@ -34246,13 +34297,25 @@ A integer constant is used in switch statement where case label is enumeration t
|
|
34246
34297
|
|
34247
34298
|
@subsection Content
|
34248
34299
|
|
34249
|
-
@b{This message will be supported in AdLint 2.0.0}
|
34250
|
-
|
34251
34300
|
Under construction.
|
34252
34301
|
|
34253
34302
|
@subsection Sample code
|
34254
34303
|
|
34255
|
-
|
34304
|
+
@verbatim
|
34305
|
+
enum Color { RED, BLUE, GREEN };
|
34306
|
+
|
34307
|
+
int func(enum Color c)
|
34308
|
+
{
|
34309
|
+
switch (c) {
|
34310
|
+
case RED: /* OK */
|
34311
|
+
return 1;
|
34312
|
+
case 1: /* W1064 */
|
34313
|
+
return 2;
|
34314
|
+
}
|
34315
|
+
|
34316
|
+
return 0;
|
34317
|
+
}
|
34318
|
+
@end verbatim
|
34256
34319
|
|
34257
34320
|
@subsection Related message
|
34258
34321
|
|
@@ -34273,7 +34336,7 @@ Under construction.
|
|
34273
34336
|
|
34274
34337
|
@subsection Since
|
34275
34338
|
|
34276
|
-
|
34339
|
+
1.4.0
|
34277
34340
|
|
34278
34341
|
@node W1065
|
34279
34342
|
@section W1065
|
@@ -34285,14 +34348,25 @@ A value of different enumeration type is used in switch statement where case la
|
|
34285
34348
|
|
34286
34349
|
@subsection Content
|
34287
34350
|
|
34288
|
-
@b{This message will be supported in AdLint 2.0.0}
|
34289
|
-
|
34290
34351
|
Under construction.
|
34291
34352
|
|
34292
34353
|
@subsection Sample code
|
34293
34354
|
|
34294
34355
|
@verbatim
|
34295
|
-
|
34356
|
+
enum Color { RED, BLUE, GREEN };
|
34357
|
+
enum Fruits { APPLE, BANANA, ORANGE, GRAPE };
|
34358
|
+
|
34359
|
+
int func(enum Color c)
|
34360
|
+
{
|
34361
|
+
switch (c) {
|
34362
|
+
case RED: /* OK */
|
34363
|
+
return 1;
|
34364
|
+
case ORANGE: /* W1065 */
|
34365
|
+
return 2;
|
34366
|
+
}
|
34367
|
+
|
34368
|
+
return 0;
|
34369
|
+
}
|
34296
34370
|
@end verbatim
|
34297
34371
|
|
34298
34372
|
@subsection Related message
|
@@ -34314,7 +34388,7 @@ Under construction.
|
|
34314
34388
|
|
34315
34389
|
@subsection Since
|
34316
34390
|
|
34317
|
-
|
34391
|
+
1.4.0
|
34318
34392
|
|
34319
34393
|
@node W9001
|
34320
34394
|
@section W9001
|