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_en.info
3
3
  @documentlanguage en
4
4
  @documentencoding utf-8
5
- @settitle AdLint 1.14.0 User's Guide
5
+ @settitle AdLint 1.16.0 User's Guide
6
6
 
7
7
  @copying
8
8
  Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
@@ -2657,7 +2657,7 @@ context_line
2657
2657
  * W0689::#line directive syntax doesn't match `#line integer constant \"string\"'.
2658
2658
  * W0690::No line number after #line directive.
2659
2659
  * W0691::The result of `##' operator is not valid preprocessing token.
2660
- * W0692::A function-like macro doesn't given an actual argument.
2660
+ * W0692::A function-like macro `%s' doesn't given an actual argument.
2661
2661
  * W0693::A function-like macro is called by actual argument which its definition is smaller.
2662
2662
  * W0694::'assert' macro is inhibited to call the function named `assert'. This result is undefined.
2663
2663
  * W0695::If #undef the 'assert' macro, and enable to call its name function, the result is undefined.
@@ -2793,7 +2793,7 @@ context_line
2793
2793
  * W1037::`%s' which has external coupling is declared more than one, this is incompatible.
2794
2794
  * W1039::`ll' is used in conversion specifier.
2795
2795
  * W1040::An unrecognizable string is described after preprocessing directive.
2796
- * W1041::`#%s' is not official preprocessing directive of ISO C standards.
2796
+ * W1041::`%s' is not official preprocessing directive of ISO C standards.
2797
2797
  * W1042::'sizeof' operator is using in preprocessing directive. This is the language extension.
2798
2798
  * W1043::`@@ address' is not supported ISO C standards. It will be considered as language extension.
2799
2799
  * W1044::An expression which includes the statement is not supported ISO C standards. It will be considered as language extension.
@@ -26279,14 +26279,13 @@ This string literal constituted by a macro is illegal form unenclosed by `\"'. `
26279
26279
 
26280
26280
  @subsection Content
26281
26281
 
26282
- @b{This message will be supported in AdLint 2.0.0}
26283
-
26284
26282
  Under construction.
26285
26283
 
26286
26284
  @subsection Sample code
26287
26285
 
26288
26286
  @verbatim
26289
- /* will be added */
26287
+ #define MACRO(x) #x
26288
+ const char *str = MACRO(foo\); /* W0643 */
26290
26289
  @end verbatim
26291
26290
 
26292
26291
  @subsection Related message
@@ -26300,7 +26299,7 @@ Under construction.
26300
26299
 
26301
26300
  @subsection Since
26302
26301
 
26303
- 2.0.0 (planned)
26302
+ 1.16.0
26304
26303
 
26305
26304
  @node W0644
26306
26305
  @section W0644
@@ -26383,14 +26382,12 @@ A normal string literal and a wide string literal are contiguous.
26383
26382
 
26384
26383
  @subsection Content
26385
26384
 
26386
- @b{This message will be supported in AdLint 2.0.0}
26387
-
26388
26385
  Under construction.
26389
26386
 
26390
26387
  @subsection Sample code
26391
26388
 
26392
26389
  @verbatim
26393
- /* will be added */
26390
+ static const char *str = "foo" L"bar"; /* W0646 */
26394
26391
  @end verbatim
26395
26392
 
26396
26393
  @subsection Related message
@@ -26404,7 +26401,7 @@ Under construction.
26404
26401
 
26405
26402
  @subsection Since
26406
26403
 
26407
- 2.0.0 (planned)
26404
+ 1.16.0
26408
26405
 
26409
26406
  @node W0649
26410
26407
  @section W0649
@@ -28658,14 +28655,14 @@ The result of `##' operator is not valid preprocessing token.
28658
28655
 
28659
28656
  @subsection Content
28660
28657
 
28661
- @b{This message will be supported in AdLint 2.0.0}
28662
-
28663
28658
  Under construction.
28664
28659
 
28665
28660
  @subsection Sample code
28666
28661
 
28667
28662
  @verbatim
28668
- /* will be added */
28663
+ #define MACRO(a, b) a ## b
28664
+
28665
+ double d = (double) MACRO(-, 123); /* W0691 */
28669
28666
  @end verbatim
28670
28667
 
28671
28668
  @subsection Related message
@@ -28679,7 +28676,7 @@ Under construction.
28679
28676
 
28680
28677
  @subsection Since
28681
28678
 
28682
- 2.0.0 (planned)
28679
+ 1.16.0
28683
28680
 
28684
28681
  @node W0692
28685
28682
  @section W0692
@@ -28687,18 +28684,18 @@ Under construction.
28687
28684
 
28688
28685
  @subsection Message body
28689
28686
 
28690
- A function-like macro doesn't given an actual argument.
28687
+ A function-like macro `%s' doesn't given an actual argument.
28691
28688
 
28692
28689
  @subsection Content
28693
28690
 
28694
- @b{This message will be supported in AdLint 2.0.0}
28695
-
28696
28691
  Under construction.
28697
28692
 
28698
28693
  @subsection Sample code
28699
28694
 
28700
28695
  @verbatim
28701
- /* will be added */
28696
+ #define MACRO(a) #a
28697
+
28698
+ const char *s = (char *) MACRO(); /* W0692 */
28702
28699
  @end verbatim
28703
28700
 
28704
28701
  @subsection Related message
@@ -28709,7 +28706,7 @@ Under construction.
28709
28706
 
28710
28707
  @subsection Since
28711
28708
 
28712
- 2.0.0 (planned)
28709
+ 1.16.0
28713
28710
 
28714
28711
  @node W0693
28715
28712
  @section W0693
@@ -28734,7 +28731,7 @@ Under construction.
28734
28731
  @subsection Related message
28735
28732
 
28736
28733
  @itemize
28737
- @item @ref{W0692} A function-like macro doesn't given an actual argument.
28734
+ @item @ref{W0692} A function-like macro `%s' doesn't given an actual argument.
28738
28735
  @end itemize
28739
28736
 
28740
28737
  @subsection Since
@@ -28751,14 +28748,18 @@ After 2.0.0 (planned)
28751
28748
 
28752
28749
  @subsection Content
28753
28750
 
28754
- @b{This message will be supported in AdLint 2.0.0}
28755
-
28756
28751
  Under construction.
28757
28752
 
28758
28753
  @subsection Sample code
28759
28754
 
28760
28755
  @verbatim
28761
- /* will be added */
28756
+ #undef assert
28757
+ extern void assert(int);
28758
+
28759
+ void foo(void)
28760
+ {
28761
+ assert("should not be reached" == ""); /* W0694 */
28762
+ }
28762
28763
  @end verbatim
28763
28764
 
28764
28765
  @subsection Related message
@@ -28767,7 +28768,7 @@ None.
28767
28768
 
28768
28769
  @subsection Since
28769
28770
 
28770
- 2.0.0 (planned)
28771
+ 1.16.0
28771
28772
 
28772
28773
  @node W0695
28773
28774
  @section W0695
@@ -32544,14 +32545,14 @@ An identifier to be actual argument doesn't find in `defined'.
32544
32545
 
32545
32546
  @subsection Content
32546
32547
 
32547
- @b{This message will be supported in AdLint 2.0.0}
32548
-
32549
32548
  Under construction.
32550
32549
 
32551
32550
  @subsection Sample code
32552
32551
 
32553
32552
  @verbatim
32554
- #if defined() /* W0805 */
32553
+ #if defined "foo" /* W0805 */
32554
+ int i = 0;
32555
+ #endif
32555
32556
  @end verbatim
32556
32557
 
32557
32558
  @subsection Related message
@@ -32562,7 +32563,7 @@ Under construction.
32562
32563
 
32563
32564
  @subsection Since
32564
32565
 
32565
- 2.0.0 (planned)
32566
+ 1.16.0
32566
32567
 
32567
32568
  @node W0806
32568
32569
  @section W0806
@@ -32733,14 +32734,16 @@ The `defined' token which the expanded result of this macro doesn't allowed.
32733
32734
 
32734
32735
  @subsection Content
32735
32736
 
32736
- @b{This message will be supported in AdLint 2.0.0}
32737
-
32738
32737
  Under construction.
32739
32738
 
32740
32739
  @subsection Sample code
32741
32740
 
32742
32741
  @verbatim
32743
- /* will be added */
32742
+ #define COND defined(FOO)
32743
+
32744
+ #if COND /* W0811 */
32745
+ int i = 0;
32746
+ #endif
32744
32747
  @end verbatim
32745
32748
 
32746
32749
  @subsection Related message
@@ -32749,7 +32752,7 @@ None.
32749
32752
 
32750
32753
  @subsection Since
32751
32754
 
32752
- 2.0.0 (planned)
32755
+ 1.16.0
32753
32756
 
32754
32757
  @node W0827
32755
32758
  @section W0827
@@ -33552,26 +33555,34 @@ An unrecognizable string is described after preprocessing directive.
33552
33555
 
33553
33556
  @subsection Content
33554
33557
 
33555
- @b{This message will be supported in AdLint 2.0.0}
33556
-
33557
33558
  Under construction.
33558
33559
 
33559
33560
  @subsection Sample code
33560
33561
 
33561
33562
  @verbatim
33562
- /* will be added */
33563
+ #define TEST
33564
+
33565
+ #ifdef TEST
33566
+ #if defined(CASE_1)
33567
+ int i = 1;
33568
+ #elif defined(CASE_2)
33569
+ int i = 2;
33570
+ #endif CASE /* W1040 */
33571
+ #else
33572
+ int i = 0;
33573
+ #endif TEST /* W1040 */
33563
33574
  @end verbatim
33564
33575
 
33565
33576
  @subsection Related message
33566
33577
 
33567
33578
  @itemize
33568
- @item @ref{W1041} `#%s' is not official preprocessing directive of ISO C standards.
33579
+ @item @ref{W1041} `%s' is not official preprocessing directive of ISO C standards.
33569
33580
  @item @ref{W1042} 'sizeof' operator is using in preprocessing directive. This is the language extension.
33570
33581
  @end itemize
33571
33582
 
33572
33583
  @subsection Since
33573
33584
 
33574
- 2.0.0 (planned)
33585
+ 1.16.0
33575
33586
 
33576
33587
  @node W1041
33577
33588
  @section W1041
@@ -33579,18 +33590,16 @@ Under construction.
33579
33590
 
33580
33591
  @subsection Message body
33581
33592
 
33582
- `#%s' is not official preprocessing directive of ISO C standards.
33593
+ `%s' is not official preprocessing directive of ISO C standards.
33583
33594
 
33584
33595
  @subsection Content
33585
33596
 
33586
- @b{This message will be supported in AdLint 2.0.0}
33587
-
33588
33597
  Under construction.
33589
33598
 
33590
33599
  @subsection Sample code
33591
33600
 
33592
33601
  @verbatim
33593
- /* will be added */
33602
+ #compiler_specific_extension 1 2.3 "4" /* W1041 */
33594
33603
  @end verbatim
33595
33604
 
33596
33605
  @subsection Related message
@@ -33602,7 +33611,7 @@ Under construction.
33602
33611
 
33603
33612
  @subsection Since
33604
33613
 
33605
- 2.0.0 (planned)
33614
+ 1.16.0
33606
33615
 
33607
33616
  @node W1042
33608
33617
  @section W1042
@@ -33628,7 +33637,7 @@ Under construction.
33628
33637
 
33629
33638
  @itemize
33630
33639
  @item @ref{W1040} An unrecognizable string is described after preprocessing directive.
33631
- @item @ref{W1041} `#%s' is not official preprocessing directive of ISO C standards.
33640
+ @item @ref{W1041} `%s' is not official preprocessing directive of ISO C standards.
33632
33641
  @end itemize
33633
33642
 
33634
33643
  @subsection Since
@@ -33738,14 +33747,15 @@ A space character is ignored between `\' and line feed.
33738
33747
 
33739
33748
  @subsection Content
33740
33749
 
33741
- @b{This message will be supported in AdLint 2.0.0}
33742
-
33743
33750
  Under construction.
33744
33751
 
33745
33752
  @subsection Sample code
33746
33753
 
33747
33754
  @verbatim
33748
- /* will be added */
33755
+ #define FOO(a, b) /* OK */ \
33756
+ ( /* W1046 */ \
33757
+ (a) + (b) /* W1046 */ \
33758
+ )
33749
33759
  @end verbatim
33750
33760
 
33751
33761
  @subsection Related message
@@ -33754,7 +33764,7 @@ None.
33754
33764
 
33755
33765
  @subsection Since
33756
33766
 
33757
- 2.0.0 (planned)
33767
+ 1.16.0
33758
33768
 
33759
33769
  @node W1047
33760
33770
  @section W1047
@@ -34826,14 +34836,20 @@ A return value of function `%s' is not used.。
34826
34836
 
34827
34837
  @subsection Content
34828
34838
 
34829
- @b{This message will be supported in AdLint 2.0.0}
34830
-
34831
34839
  Under construction.
34832
34840
 
34833
34841
  @subsection Sample code
34834
34842
 
34835
34843
  @verbatim
34836
- /* will be added */
34844
+ extern int bar(void);
34845
+ static void foo(void)
34846
+ {
34847
+ int i;
34848
+ int j;
34849
+ for (i = 0, bar(); i < 10; i++) { /* W1073 */
34850
+ j = bar(); /* OK */
34851
+ }
34852
+ }
34837
34853
  @end verbatim
34838
34854
 
34839
34855
  @subsection Related message
@@ -34842,7 +34858,7 @@ None.
34842
34858
 
34843
34859
  @subsection Since
34844
34860
 
34845
- 2.0.0 (planned)
34861
+ 1.16.0
34846
34862
 
34847
34863
  @node W1074
34848
34864
  @section W1074
@@ -34854,14 +34870,22 @@ Side-effects in `sizeof' operand will not be recorded because the operand will n
34854
34870
 
34855
34871
  @subsection Content
34856
34872
 
34857
- @b{This message will be supported in AdLint 2.0.0}
34858
-
34859
34873
  Under construction.
34860
34874
 
34861
34875
  @subsection Sample code
34862
34876
 
34863
34877
  @verbatim
34864
- int i = sizeof(data++); /* W1074 */
34878
+ static int foo(void)
34879
+ {
34880
+ int i = 0;
34881
+
34882
+ if (sizeof(i++) == 4) { /* W1074 */
34883
+ return 0;
34884
+ }
34885
+ else {
34886
+ return 1;
34887
+ }
34888
+ }
34865
34889
  @end verbatim
34866
34890
 
34867
34891
  @subsection Related message
@@ -34870,7 +34894,7 @@ None.
34870
34894
 
34871
34895
  @subsection Since
34872
34896
 
34873
- 2.0.0 (planned)
34897
+ 1.16.0
34874
34898
 
34875
34899
  @node W1075
34876
34900
  @section W1075
@@ -34882,8 +34906,6 @@ This declaration has no `static' storage-class-specifier while the declaring obj
34882
34906
 
34883
34907
  @subsection Content
34884
34908
 
34885
- @b{This message will be supported in AdLint 2.0.0}
34886
-
34887
34909
  Under construction.
34888
34910
 
34889
34911
  @subsection Sample code
@@ -34902,7 +34924,7 @@ None.
34902
34924
 
34903
34925
  @subsection Since
34904
34926
 
34905
- 2.0.0 (planned)
34927
+ 1.16.0
34906
34928
 
34907
34929
  @node W1076
34908
34930
  @section W1076
@@ -34914,8 +34936,6 @@ None.
34914
34936
 
34915
34937
  @subsection Content
34916
34938
 
34917
- @b{This message will be supported in AdLint 2.0.0}
34918
-
34919
34939
  Under construction.
34920
34940
 
34921
34941
  @subsection Sample code
@@ -34923,8 +34943,7 @@ Under construction.
34923
34943
  @verbatim
34924
34944
  static int func(void) /* W1076 */
34925
34945
  {
34926
- ...
34927
- return ret;
34946
+ return 0;
34928
34947
  }
34929
34948
  @end verbatim
34930
34949
 
@@ -34934,7 +34953,7 @@ None.
34934
34953
 
34935
34954
  @subsection Since
34936
34955
 
34937
- 2.0.0 (planned)
34956
+ 1.16.0
34938
34957
 
34939
34958
  @node W1077
34940
34959
  @section W1077
@@ -34946,14 +34965,12 @@ Declaring array object without a size.
34946
34965
 
34947
34966
  @subsection Content
34948
34967
 
34949
- @b{This message will be supported in AdLint 2.0.0}
34950
-
34951
34968
  Under construction.
34952
34969
 
34953
34970
  @subsection Sample code
34954
34971
 
34955
34972
  @verbatim
34956
- extern int array[]; /* W1077 */
34973
+ extern int a[]; /* W1077 */
34957
34974
  @end verbatim
34958
34975
 
34959
34976
  @subsection Related message
@@ -34962,8 +34979,7 @@ None.
34962
34979
 
34963
34980
  @subsection Since
34964
34981
 
34965
- 2.0.0 (planned)
34966
-
34982
+ 1.16.0
34967
34983
 
34968
34984
  @node W9001
34969
34985
  @section W9001