adlint 1.4.0 → 1.6.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 +413 -5
- data/MANIFEST +6 -0
- data/NEWS +43 -4
- data/etc/mesg.d/en_US/messages.yml +1 -1
- data/etc/mesg.d/ja_JP/messages.yml +1 -1
- data/lib/adlint/c.rb +1 -0
- data/lib/adlint/c/enum.rb +52 -0
- data/lib/adlint/c/expr.rb +43 -102
- data/lib/adlint/c/interp.rb +1 -1
- data/lib/adlint/c/mediator.rb +1 -0
- data/lib/adlint/c/message.rb +831 -49
- data/lib/adlint/c/message_shima.rb +236 -0
- data/lib/adlint/c/metric.rb +9 -0
- data/lib/adlint/c/object.rb +37 -32
- data/lib/adlint/c/parser.rb +7 -7
- data/lib/adlint/c/parser.y +7 -7
- data/lib/adlint/c/phase.rb +21 -0
- data/lib/adlint/c/syntax.rb +11 -4
- data/lib/adlint/c/type.rb +1 -1
- data/lib/adlint/cpp.rb +1 -0
- data/lib/adlint/cpp/asm.rb +73 -0
- data/lib/adlint/cpp/message.rb +13 -0
- data/lib/adlint/cpp/message_shima.rb +36 -0
- data/lib/adlint/cpp/phase.rb +3 -0
- data/lib/adlint/cpp/source.rb +9 -0
- data/lib/adlint/version.rb +3 -3
- data/share/demo/Makefile +4 -0
- data/share/demo/bad_conv/bad_conv.c +12 -0
- data/share/demo/bad_enum/bad_enum.c +48 -2
- data/share/demo/bad_label/bad_label.c +26 -0
- data/share/demo/bad_macro/bad_macro.c +3 -0
- data/share/demo/implicit_conv/implicit_conv.c +1 -0
- data/share/demo/inline_asm/inline_asm.c +18 -0
- data/share/demo/invalid_call/invalid_call.c +5 -0
- data/share/demo/multi_decl/multi_decl_1.c +30 -0
- data/share/demo/overflow/overflow.c +3 -3
- data/share/demo/redundant_select/redundant_select.c +25 -0
- data/share/demo/reserved_ident/reserved_ident.c +98 -0
- 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 +234 -126
- data/share/doc/users_guide_en.texi +207 -98
- data/share/doc/users_guide_ja.html +247 -156
- data/share/doc/users_guide_ja.texi +221 -130
- data/share/sample/vim-7.3/adlint/xxd/adlint_traits.yml +1 -1
- metadata +8 -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.6.0 User's Guide
|
6
6
|
|
7
7
|
@copying
|
8
8
|
Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
|
@@ -3260,7 +3260,7 @@ case 1:
|
|
3260
3260
|
case 2:
|
3261
3261
|
value = 2;
|
3262
3262
|
break;
|
3263
|
-
case 3
|
3263
|
+
case 3:
|
3264
3264
|
value = 3;
|
3265
3265
|
break; /* W0003 */
|
3266
3266
|
}
|
@@ -23624,14 +23624,29 @@ This function mixed weaves C code with inline assembly code.
|
|
23624
23624
|
|
23625
23625
|
@subsection Content
|
23626
23626
|
|
23627
|
-
@b{This message will be supported in AdLint 2.0.0}
|
23628
|
-
|
23629
23627
|
Under construction.
|
23630
23628
|
|
23631
23629
|
@subsection Sample code
|
23632
23630
|
|
23633
23631
|
@verbatim
|
23634
|
-
|
23632
|
+
void foo(int arg1, int *arg2, int arg3)
|
23633
|
+
{
|
23634
|
+
asm("movl %ecx, %eax"); /* W0541 */
|
23635
|
+
__asm__("movl %ecx, (%eax)"); /* W0541 */
|
23636
|
+
|
23637
|
+
asm { /* W0541 */
|
23638
|
+
xorl eax, eax
|
23639
|
+
}
|
23640
|
+
|
23641
|
+
__asm__ volatile ( /* W0541 */
|
23642
|
+
"int $0x80"
|
23643
|
+
: "=a" (r)
|
23644
|
+
"+b" (arg1),
|
23645
|
+
"+c" (arg2),
|
23646
|
+
"+d" (arg3)
|
23647
|
+
: "a" (128)
|
23648
|
+
: "memory", "cc");
|
23649
|
+
}
|
23635
23650
|
@end verbatim
|
23636
23651
|
|
23637
23652
|
@subsection Related message
|
@@ -23640,7 +23655,7 @@ None.
|
|
23640
23655
|
|
23641
23656
|
@subsection Since
|
23642
23657
|
|
23643
|
-
|
23658
|
+
1.6.0
|
23644
23659
|
|
23645
23660
|
@node W0542
|
23646
23661
|
@section W0542
|
@@ -24484,8 +24499,6 @@ A `-' character in scanset in `[]' is implementation defined.
|
|
24484
24499
|
|
24485
24500
|
@subsection Content
|
24486
24501
|
|
24487
|
-
@b{This message will be supported in AdLint 2.0.0}
|
24488
|
-
|
24489
24502
|
Under construction.
|
24490
24503
|
|
24491
24504
|
@subsection Sample code
|
@@ -24501,7 +24514,7 @@ None.
|
|
24501
24514
|
|
24502
24515
|
@subsection Since
|
24503
24516
|
|
24504
|
-
|
24517
|
+
1.6.0
|
24505
24518
|
|
24506
24519
|
@node W0574
|
24507
24520
|
@section W0574
|
@@ -24662,8 +24675,6 @@ Cast from compound expression of volatile integer type to bigger type.
|
|
24662
24675
|
|
24663
24676
|
@subsection Content
|
24664
24677
|
|
24665
|
-
@b{This message will be supported in AdLint 2.0.0}
|
24666
|
-
|
24667
24678
|
Under construction.
|
24668
24679
|
|
24669
24680
|
@subsection Sample code
|
@@ -24681,7 +24692,7 @@ None.
|
|
24681
24692
|
|
24682
24693
|
@subsection Since
|
24683
24694
|
|
24684
|
-
|
24695
|
+
1.6.0
|
24685
24696
|
|
24686
24697
|
@node W0580
|
24687
24698
|
@section W0580
|
@@ -26210,13 +26221,13 @@ It is impossible to get the array's address which declared with 'register'.
|
|
26210
26221
|
|
26211
26222
|
Under construction.
|
26212
26223
|
|
26224
|
+
@subsection Sample code
|
26225
|
+
|
26213
26226
|
@verbatim
|
26214
26227
|
register int arr1[3]; /* W0642 */
|
26215
26228
|
int* p = arr1;
|
26216
26229
|
@end verbatim
|
26217
26230
|
|
26218
|
-
Under construction.
|
26219
|
-
|
26220
26231
|
@subsection Related message
|
26221
26232
|
|
26222
26233
|
@itemize
|
@@ -28372,14 +28383,13 @@ A character preceding the `-' in scanset o `[]' is bigger than a character follo
|
|
28372
28383
|
|
28373
28384
|
@subsection Content
|
28374
28385
|
|
28375
|
-
@b{This message will be supported in AdLint 2.0.0}
|
28376
|
-
|
28377
28386
|
Under construction.
|
28378
28387
|
|
28379
28388
|
@subsection Sample code
|
28380
28389
|
|
28381
28390
|
@verbatim
|
28382
|
-
|
28391
|
+
char c;
|
28392
|
+
scanf("%[z-a]", &c); /* W0685 */
|
28383
28393
|
@end verbatim
|
28384
28394
|
|
28385
28395
|
@subsection Related message
|
@@ -28420,7 +28430,7 @@ Under construction.
|
|
28420
28430
|
|
28421
28431
|
@subsection Since
|
28422
28432
|
|
28423
|
-
|
28433
|
+
1.6.0
|
28424
28434
|
|
28425
28435
|
@node W0686
|
28426
28436
|
@section W0686
|
@@ -28432,14 +28442,13 @@ The same characters are described in scanset (characters enclosed by `[]').
|
|
28432
28442
|
|
28433
28443
|
@subsection Content
|
28434
28444
|
|
28435
|
-
@b{This message will be supported in AdLint 2.0.0}
|
28436
|
-
|
28437
28445
|
Under construction.
|
28438
28446
|
|
28439
28447
|
@subsection Sample code
|
28440
28448
|
|
28441
28449
|
@verbatim
|
28442
|
-
|
28450
|
+
char c;
|
28451
|
+
scanf("%[abcda]", &c); /* W0686 */
|
28443
28452
|
@end verbatim
|
28444
28453
|
|
28445
28454
|
@subsection Related message
|
@@ -28480,7 +28489,7 @@ Under construction.
|
|
28480
28489
|
|
28481
28490
|
@subsection Since
|
28482
28491
|
|
28483
|
-
|
28492
|
+
1.6.0
|
28484
28493
|
|
28485
28494
|
@node W0687
|
28486
28495
|
@section W0687
|
@@ -31691,14 +31700,36 @@ This 'switch' statement have only one path. It's verbose.
|
|
31691
31700
|
|
31692
31701
|
@subsection Content
|
31693
31702
|
|
31694
|
-
@b{This message will be supported in AdLint 2.0.0}
|
31695
|
-
|
31696
31703
|
Under construction.
|
31697
31704
|
|
31698
31705
|
@subsection Sample code
|
31699
31706
|
|
31700
31707
|
@verbatim
|
31701
|
-
|
31708
|
+
int foo(const int i)
|
31709
|
+
{
|
31710
|
+
if (i > 5) {
|
31711
|
+
switch (i) { /* W0781 */
|
31712
|
+
case 0:
|
31713
|
+
return 1;
|
31714
|
+
case 5:
|
31715
|
+
return 2;
|
31716
|
+
default:
|
31717
|
+
return 3;
|
31718
|
+
}
|
31719
|
+
}
|
31720
|
+
|
31721
|
+
switch (i) { /* OK */
|
31722
|
+
case 0:
|
31723
|
+
return 4;
|
31724
|
+
default:
|
31725
|
+
switch (i) { /* W0781 */
|
31726
|
+
case 10:
|
31727
|
+
return 5;
|
31728
|
+
default:
|
31729
|
+
return 6;
|
31730
|
+
}
|
31731
|
+
}
|
31732
|
+
}
|
31702
31733
|
@end verbatim
|
31703
31734
|
|
31704
31735
|
@subsection Related message
|
@@ -31707,7 +31738,7 @@ None.
|
|
31707
31738
|
|
31708
31739
|
@subsection Since
|
31709
31740
|
|
31710
|
-
|
31741
|
+
1.6.0
|
31711
31742
|
|
31712
31743
|
@node W0783
|
31713
31744
|
@section W0783
|
@@ -31837,14 +31868,22 @@ A type of `%s' is different from the past declaration in the different scope.
|
|
31837
31868
|
|
31838
31869
|
@subsection Content
|
31839
31870
|
|
31840
|
-
@b{This message will be supported in AdLint 2.0.0}
|
31841
|
-
|
31842
31871
|
Under construction.
|
31843
31872
|
|
31844
31873
|
@subsection Sample code
|
31845
31874
|
|
31846
31875
|
@verbatim
|
31847
|
-
|
31876
|
+
void func1(void)
|
31877
|
+
{
|
31878
|
+
extern int num;
|
31879
|
+
extern void func3(void);
|
31880
|
+
}
|
31881
|
+
|
31882
|
+
void func2(void)
|
31883
|
+
{
|
31884
|
+
extern double num; /* W0787 */
|
31885
|
+
extern void func3(int); /* W0787 */
|
31886
|
+
}
|
31848
31887
|
@end verbatim
|
31849
31888
|
|
31850
31889
|
@subsection Related message
|
@@ -31856,7 +31895,7 @@ Under construction.
|
|
31856
31895
|
|
31857
31896
|
@subsection Since
|
31858
31897
|
|
31859
|
-
|
31898
|
+
1.6.0
|
31860
31899
|
|
31861
31900
|
@node W0788
|
31862
31901
|
@section W0788
|
@@ -31868,14 +31907,18 @@ A type of `%s' is different from the past declaration in the same scope.
|
|
31868
31907
|
|
31869
31908
|
@subsection Content
|
31870
31909
|
|
31871
|
-
@b{This message will be supported in AdLint 2.0.0}
|
31872
|
-
|
31873
31910
|
Under construction.
|
31874
31911
|
|
31875
31912
|
@subsection Sample code
|
31876
31913
|
|
31877
31914
|
@verbatim
|
31878
|
-
|
31915
|
+
extern int func(void);
|
31916
|
+
|
31917
|
+
void func(void) /* W0788 */
|
31918
|
+
{
|
31919
|
+
typedef int num;
|
31920
|
+
double num; /* W0788 */
|
31921
|
+
}
|
31879
31922
|
@end verbatim
|
31880
31923
|
|
31881
31924
|
@subsection Related message
|
@@ -31887,7 +31930,7 @@ Under construction.
|
|
31887
31930
|
|
31888
31931
|
@subsection Since
|
31889
31932
|
|
31890
|
-
|
31933
|
+
1.6.0
|
31891
31934
|
|
31892
31935
|
@node W0789
|
31893
31936
|
@section W0789
|
@@ -31899,14 +31942,19 @@ A type of `%s' is different from the past declaration in the wider scope.
|
|
31899
31942
|
|
31900
31943
|
@subsection Content
|
31901
31944
|
|
31902
|
-
@b{This message will be supported in AdLint 2.0.0}
|
31903
|
-
|
31904
31945
|
Under construction.
|
31905
31946
|
|
31906
31947
|
@subsection Sample code
|
31907
31948
|
|
31908
31949
|
@verbatim
|
31909
|
-
|
31950
|
+
int num = 0;
|
31951
|
+
extern int func1(void);
|
31952
|
+
|
31953
|
+
void func2(void)
|
31954
|
+
{
|
31955
|
+
extern double num; /* W0789 */
|
31956
|
+
extern void func1(void); /* W0789 */
|
31957
|
+
}
|
31910
31958
|
@end verbatim
|
31911
31959
|
|
31912
31960
|
@subsection Related message
|
@@ -31918,7 +31966,7 @@ Under construction.
|
|
31918
31966
|
|
31919
31967
|
@subsection Since
|
31920
31968
|
|
31921
|
-
|
31969
|
+
1.6.0
|
31922
31970
|
|
31923
31971
|
@node W0790
|
31924
31972
|
@section W0790
|
@@ -32495,14 +32543,12 @@ It is trying to delete pre-defined macro `%s'.
|
|
32495
32543
|
|
32496
32544
|
@subsection Content
|
32497
32545
|
|
32498
|
-
@b{This message will be supported in AdLint 2.0.0}
|
32499
|
-
|
32500
32546
|
Under construction.
|
32501
32547
|
|
32502
32548
|
@subsection Sample code
|
32503
32549
|
|
32504
32550
|
@verbatim
|
32505
|
-
|
32551
|
+
#undef __STDC_VERSION__ /* W0807 */
|
32506
32552
|
@end verbatim
|
32507
32553
|
|
32508
32554
|
@subsection Related message
|
@@ -32514,7 +32560,7 @@ Under construction.
|
|
32514
32560
|
|
32515
32561
|
@subsection Since
|
32516
32562
|
|
32517
|
-
|
32563
|
+
1.6.0
|
32518
32564
|
|
32519
32565
|
@node W0808
|
32520
32566
|
@section W0808
|
@@ -32526,14 +32572,12 @@ It is trying to redefine pre-defined macro `%s'.
|
|
32526
32572
|
|
32527
32573
|
@subsection Content
|
32528
32574
|
|
32529
|
-
@b{This message will be supported in AdLint 2.0.0}
|
32530
|
-
|
32531
32575
|
Under construction.
|
32532
32576
|
|
32533
32577
|
@subsection Sample code
|
32534
32578
|
|
32535
32579
|
@verbatim
|
32536
|
-
|
32580
|
+
#define __FILE__ "test.c" /* W0808 */
|
32537
32581
|
@end verbatim
|
32538
32582
|
|
32539
32583
|
@subsection Related message
|
@@ -32545,7 +32589,7 @@ Under construction.
|
|
32545
32589
|
|
32546
32590
|
@subsection Since
|
32547
32591
|
|
32548
|
-
|
32592
|
+
1.6.0
|
32549
32593
|
|
32550
32594
|
@node W0809
|
32551
32595
|
@section W0809
|
@@ -32557,14 +32601,14 @@ An identifier `%s' is reserved by the library.
|
|
32557
32601
|
|
32558
32602
|
@subsection Content
|
32559
32603
|
|
32560
|
-
@b{This message will be supported in AdLint 2.0.0}
|
32561
|
-
|
32562
32604
|
Under construction.
|
32563
32605
|
|
32564
32606
|
@subsection Sample code
|
32565
32607
|
|
32566
32608
|
@verbatim
|
32567
|
-
|
32609
|
+
extern int __value; /* W0809 */
|
32610
|
+
int _VAL = 10; /* W0809 */
|
32611
|
+
static void _func(void); /* W0809 */
|
32568
32612
|
@end verbatim
|
32569
32613
|
|
32570
32614
|
@subsection Related message
|
@@ -32573,7 +32617,7 @@ None.
|
|
32573
32617
|
|
32574
32618
|
@subsection Since
|
32575
32619
|
|
32576
|
-
|
32620
|
+
1.6.0
|
32577
32621
|
|
32578
32622
|
@node W0810
|
32579
32623
|
@section W0810
|
@@ -33137,14 +33181,27 @@ A label `%s' is used more than two times in this function.
|
|
33137
33181
|
|
33138
33182
|
@subsection Content
|
33139
33183
|
|
33140
|
-
@b{This message will be supported in AdLint 2.0.0}
|
33141
|
-
|
33142
33184
|
Under construction.
|
33143
33185
|
|
33144
33186
|
@subsection Sample code
|
33145
33187
|
|
33146
33188
|
@verbatim
|
33147
|
-
|
33189
|
+
void func(int a, int b)
|
33190
|
+
{
|
33191
|
+
if (a == 0) {
|
33192
|
+
int c = 0;
|
33193
|
+
RETRY:
|
33194
|
+
b = 10;
|
33195
|
+
}
|
33196
|
+
|
33197
|
+
if (b != 0) {
|
33198
|
+
goto RETRY;
|
33199
|
+
}
|
33200
|
+
RETRY: /* W1030 */
|
33201
|
+
b = 1;
|
33202
|
+
|
33203
|
+
...snip...
|
33204
|
+
}
|
33148
33205
|
@end verbatim
|
33149
33206
|
|
33150
33207
|
@subsection Related message
|
@@ -33153,7 +33210,7 @@ None.
|
|
33153
33210
|
|
33154
33211
|
@subsection Since
|
33155
33212
|
|
33156
|
-
|
33213
|
+
1.6.0
|
33157
33214
|
|
33158
33215
|
@node W1031
|
33159
33216
|
@section W1031
|
@@ -33848,14 +33905,19 @@ A numeric constants is passed to an actual argument which formal argument is enu
|
|
33848
33905
|
|
33849
33906
|
@subsection Content
|
33850
33907
|
|
33851
|
-
@b{This message will be supported in AdLint 2.0.0}
|
33852
|
-
|
33853
33908
|
Under construction.
|
33854
33909
|
|
33855
33910
|
@subsection Sample code
|
33856
33911
|
|
33857
33912
|
@verbatim
|
33858
|
-
|
33913
|
+
enum Color { RED = 1, GREEN = 2, BLUE = 4 };
|
33914
|
+
|
33915
|
+
extern void func1(enum Color);
|
33916
|
+
|
33917
|
+
void func2(void)
|
33918
|
+
{
|
33919
|
+
func1(4); /* W1053 */
|
33920
|
+
}
|
33859
33921
|
@end verbatim
|
33860
33922
|
|
33861
33923
|
@subsection Related message
|
@@ -33877,7 +33939,7 @@ Under construction.
|
|
33877
33939
|
|
33878
33940
|
@subsection Since
|
33879
33941
|
|
33880
|
-
|
33942
|
+
1.6.0
|
33881
33943
|
|
33882
33944
|
@node W1054
|
33883
33945
|
@section W1054
|
@@ -33889,14 +33951,19 @@ A non enumeration type expression is substituted for the enumeration type.
|
|
33889
33951
|
|
33890
33952
|
@subsection Content
|
33891
33953
|
|
33892
|
-
@b{This message will be supported in AdLint 2.0.0}
|
33893
|
-
|
33894
33954
|
Under construction.
|
33895
33955
|
|
33896
33956
|
@subsection Sample code
|
33897
33957
|
|
33898
33958
|
@verbatim
|
33899
|
-
|
33959
|
+
enum Color { RED = 1, GREEN = 2, BLUE = 4 };
|
33960
|
+
|
33961
|
+
extern enum Color col;
|
33962
|
+
|
33963
|
+
void func2(void)
|
33964
|
+
{
|
33965
|
+
col = 4; /* W1054 */
|
33966
|
+
}
|
33900
33967
|
@end verbatim
|
33901
33968
|
|
33902
33969
|
@subsection Related message
|
@@ -33918,7 +33985,7 @@ Under construction.
|
|
33918
33985
|
|
33919
33986
|
@subsection Since
|
33920
33987
|
|
33921
|
-
|
33988
|
+
1.6.0
|
33922
33989
|
|
33923
33990
|
@node W1055
|
33924
33991
|
@section W1055
|
@@ -33930,14 +33997,17 @@ A non enumeration type expression is returned from the function which return val
|
|
33930
33997
|
|
33931
33998
|
@subsection Content
|
33932
33999
|
|
33933
|
-
@b{This message will be supported in AdLint 2.0.0}
|
33934
|
-
|
33935
34000
|
Under construction.
|
33936
34001
|
|
33937
34002
|
@subsection Sample code
|
33938
34003
|
|
33939
34004
|
@verbatim
|
33940
|
-
|
34005
|
+
enum Color { RED = 1, GREEN = 2, BLUE = 4 };
|
34006
|
+
|
34007
|
+
enum Color func(void)
|
34008
|
+
{
|
34009
|
+
return 4; /* W1055 */
|
34010
|
+
}
|
33941
34011
|
@end verbatim
|
33942
34012
|
|
33943
34013
|
@subsection Related message
|
@@ -33959,7 +34029,7 @@ Under construction.
|
|
33959
34029
|
|
33960
34030
|
@subsection Since
|
33961
34031
|
|
33962
|
-
|
34032
|
+
1.6.0
|
33963
34033
|
|
33964
34034
|
@node W1056
|
33965
34035
|
@section W1056
|
@@ -33971,14 +34041,20 @@ An object of actual argument is different enumeration type which formal argument
|
|
33971
34041
|
|
33972
34042
|
@subsection Content
|
33973
34043
|
|
33974
|
-
@b{This message will be supported in AdLint 2.0.0}
|
33975
|
-
|
33976
34044
|
Under construction.
|
33977
34045
|
|
33978
34046
|
@subsection Sample code
|
33979
34047
|
|
33980
34048
|
@verbatim
|
33981
|
-
|
34049
|
+
enum Color { RED = 1, GREEN= 2, BLUE = 4 };
|
34050
|
+
enum Season { SPRING = 1, SUMMER, AUTUMN, WINTER };
|
34051
|
+
|
34052
|
+
extern void func1(enum Color);
|
34053
|
+
|
34054
|
+
void func2(enum Season ssn)
|
34055
|
+
{
|
34056
|
+
func1(ssn); /* W1056 */
|
34057
|
+
}
|
33982
34058
|
@end verbatim
|
33983
34059
|
|
33984
34060
|
@subsection Related message
|
@@ -34000,7 +34076,7 @@ Under construction.
|
|
34000
34076
|
|
34001
34077
|
@subsection Since
|
34002
34078
|
|
34003
|
-
|
34079
|
+
1.6.0
|
34004
34080
|
|
34005
34081
|
@node W1057
|
34006
34082
|
@section W1057
|
@@ -34012,14 +34088,20 @@ An enumeration value is substituted for different enumeration type object.
|
|
34012
34088
|
|
34013
34089
|
@subsection Content
|
34014
34090
|
|
34015
|
-
@b{This message will be supported in AdLint 2.0.0}
|
34016
|
-
|
34017
34091
|
Under construction.
|
34018
34092
|
|
34019
34093
|
@subsection Sample code
|
34020
34094
|
|
34021
34095
|
@verbatim
|
34022
|
-
|
34096
|
+
enum Color { RED = 1, GREEN = 2, BLUE = 4 };
|
34097
|
+
enum Season { SPRING = 1, SUMMER, AUTUMN, WINTER };
|
34098
|
+
|
34099
|
+
extern enum Color col;
|
34100
|
+
|
34101
|
+
void func(enum Season ssn)
|
34102
|
+
{
|
34103
|
+
col = ssn; /* W1057 */
|
34104
|
+
}
|
34023
34105
|
@end verbatim
|
34024
34106
|
|
34025
34107
|
@subsection Related message
|
@@ -34041,7 +34123,7 @@ Under construction.
|
|
34041
34123
|
|
34042
34124
|
@subsection Since
|
34043
34125
|
|
34044
|
-
|
34126
|
+
1.6.0
|
34045
34127
|
|
34046
34128
|
@node W1058
|
34047
34129
|
@section W1058
|
@@ -34053,14 +34135,18 @@ A different enumeration type of value is returned from a function which return v
|
|
34053
34135
|
|
34054
34136
|
@subsection Content
|
34055
34137
|
|
34056
|
-
@b{This message will be supported in AdLint 2.0.0}
|
34057
|
-
|
34058
34138
|
Under construction.
|
34059
34139
|
|
34060
34140
|
@subsection Sample code
|
34061
34141
|
|
34062
34142
|
@verbatim
|
34063
|
-
|
34143
|
+
enum Color { RED = 1, GREEN = 2, BLUE = 4 };
|
34144
|
+
enum Season { SPRING = 1, SUMMER, AUTUMN, WINTER };
|
34145
|
+
|
34146
|
+
enum Color func(enum Season ssn)
|
34147
|
+
{
|
34148
|
+
return ssn; /* W1058 */
|
34149
|
+
}
|
34064
34150
|
@end verbatim
|
34065
34151
|
|
34066
34152
|
@subsection Related message
|
@@ -34082,7 +34168,7 @@ Under construction.
|
|
34082
34168
|
|
34083
34169
|
@subsection Since
|
34084
34170
|
|
34085
|
-
|
34171
|
+
1.6.0
|
34086
34172
|
|
34087
34173
|
@node W1059
|
34088
34174
|
@section W1059
|
@@ -34094,14 +34180,19 @@ An enumeration value is passed to actual argument which formal argument is not e
|
|
34094
34180
|
|
34095
34181
|
@subsection Content
|
34096
34182
|
|
34097
|
-
@b{This message will be supported in AdLint 2.0.0}
|
34098
|
-
|
34099
34183
|
Under construction.
|
34100
34184
|
|
34101
34185
|
@subsection Sample code
|
34102
34186
|
|
34103
34187
|
@verbatim
|
34104
|
-
|
34188
|
+
enum Color { RED = 1, GREEN = 2, BLUE = 4 };
|
34189
|
+
|
34190
|
+
extern void func1(int num);
|
34191
|
+
|
34192
|
+
void func2(enum Color col)
|
34193
|
+
{
|
34194
|
+
func1(col); /* W1059 */
|
34195
|
+
}
|
34105
34196
|
@end verbatim
|
34106
34197
|
|
34107
34198
|
@subsection Related message
|
@@ -34123,7 +34214,7 @@ Under construction.
|
|
34123
34214
|
|
34124
34215
|
@subsection Since
|
34125
34216
|
|
34126
|
-
|
34217
|
+
1.6.0
|
34127
34218
|
|
34128
34219
|
@node W1060
|
34129
34220
|
@section W1060
|
@@ -34135,14 +34226,17 @@ An enumeration value is returned from a function which return value is not enume
|
|
34135
34226
|
|
34136
34227
|
@subsection Content
|
34137
34228
|
|
34138
|
-
@b{This message will be supported in AdLint 2.0.0}
|
34139
|
-
|
34140
34229
|
Under construction.
|
34141
34230
|
|
34142
34231
|
@subsection Sample code
|
34143
34232
|
|
34144
34233
|
@verbatim
|
34145
|
-
|
34234
|
+
enum Color { RED = 1, GREEN = 2, BLUE = 4 };
|
34235
|
+
|
34236
|
+
int func2(enum Color col)
|
34237
|
+
{
|
34238
|
+
return col; /* W1060 */
|
34239
|
+
}
|
34146
34240
|
@end verbatim
|
34147
34241
|
|
34148
34242
|
@subsection Related message
|
@@ -34164,7 +34258,7 @@ Under construction.
|
|
34164
34258
|
|
34165
34259
|
@subsection Since
|
34166
34260
|
|
34167
|
-
|
34261
|
+
1.6.0
|
34168
34262
|
|
34169
34263
|
@node W1061
|
34170
34264
|
@section W1061
|
@@ -34176,14 +34270,19 @@ Non constant expression of non enumeration type is passed to actual argument whi
|
|
34176
34270
|
|
34177
34271
|
@subsection Content
|
34178
34272
|
|
34179
|
-
@b{This message will be supported in AdLint 2.0.0}
|
34180
|
-
|
34181
34273
|
Under construction.
|
34182
34274
|
|
34183
34275
|
@subsection Sample code
|
34184
34276
|
|
34185
34277
|
@verbatim
|
34186
|
-
|
34278
|
+
enum Color { RED = 1, GREEN = 2, BLUE = 4 };
|
34279
|
+
|
34280
|
+
extern void func1(enum Color);
|
34281
|
+
|
34282
|
+
void func2(int num)
|
34283
|
+
{
|
34284
|
+
func1(num); /* W1061 */
|
34285
|
+
}
|
34187
34286
|
@end verbatim
|
34188
34287
|
|
34189
34288
|
@subsection Related message
|
@@ -34205,7 +34304,7 @@ Under construction.
|
|
34205
34304
|
|
34206
34305
|
@subsection Since
|
34207
34306
|
|
34208
|
-
|
34307
|
+
1.6.0
|
34209
34308
|
|
34210
34309
|
@node W1062
|
34211
34310
|
@section W1062
|
@@ -34217,13 +34316,20 @@ Non constant expression is substituted for the enumeration type object.
|
|
34217
34316
|
|
34218
34317
|
@subsection Content
|
34219
34318
|
|
34220
|
-
@b{This message will be supported in AdLint 2.0.0}
|
34221
|
-
|
34222
34319
|
Under construction.
|
34223
34320
|
|
34224
34321
|
@subsection Sample code
|
34225
34322
|
|
34226
|
-
|
34323
|
+
@verbatim
|
34324
|
+
enum Color { RED = 1, GREEN = 2, BLUE = 4 };
|
34325
|
+
|
34326
|
+
extern enum Color col;
|
34327
|
+
|
34328
|
+
void func(int num)
|
34329
|
+
{
|
34330
|
+
col = num + 1; /* W1062 */
|
34331
|
+
}
|
34332
|
+
@end verbatim
|
34227
34333
|
|
34228
34334
|
@subsection Related message
|
34229
34335
|
|
@@ -34244,7 +34350,7 @@ Under construction.
|
|
34244
34350
|
|
34245
34351
|
@subsection Since
|
34246
34352
|
|
34247
|
-
|
34353
|
+
1.6.0
|
34248
34354
|
|
34249
34355
|
@node W1063
|
34250
34356
|
@section W1063
|
@@ -34256,14 +34362,17 @@ The return value returned from enumeration type function to non constant express
|
|
34256
34362
|
|
34257
34363
|
@subsection Content
|
34258
34364
|
|
34259
|
-
@b{This message will be supported in AdLint 2.0.0}
|
34260
|
-
|
34261
34365
|
Under construction.
|
34262
34366
|
|
34263
34367
|
@subsection Sample code
|
34264
34368
|
|
34265
34369
|
@verbatim
|
34266
|
-
|
34370
|
+
enum Color { RED = 1, GREEN = 2, BLUE = 4 };
|
34371
|
+
|
34372
|
+
enum Color func(int num)
|
34373
|
+
{
|
34374
|
+
return num / 2; /* W1063 */
|
34375
|
+
}
|
34267
34376
|
@end verbatim
|
34268
34377
|
|
34269
34378
|
@subsection Related message
|
@@ -34285,7 +34394,7 @@ Under construction.
|
|
34285
34394
|
|
34286
34395
|
@subsection Since
|
34287
34396
|
|
34288
|
-
|
34397
|
+
1.6.0
|
34289
34398
|
|
34290
34399
|
@node W1064
|
34291
34400
|
@section W1064
|