adlint 2.4.10 → 2.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 +209 -0
 - data/MANIFEST +4 -0
 - data/NEWS +19 -4
 - data/etc/mesg.d/c_builtin/en_US/messages.yml +2 -2
 - data/etc/mesg.d/c_builtin/ja_JP/messages.yml +2 -2
 - data/etc/mesg.d/core/en_US/messages.yml +1 -1
 - data/etc/mesg.d/core/ja_JP/messages.yml +1 -1
 - data/features/code_check/W0088.feature +153 -0
 - data/features/code_check/W0582.feature +72 -0
 - data/features/code_check/W0583.feature +93 -0
 - data/features/code_check/W0584.feature +139 -0
 - data/features/code_check/W0635.feature +0 -2
 - data/features/code_check/W0722.feature +68 -0
 - data/features/code_check/W0723.feature +1 -1
 - data/features/code_check/W0732.feature +0 -15
 - data/features/code_check/W0733.feature +0 -15
 - data/features/code_check/W0734.feature +0 -36
 - data/features/code_check/W0735.feature +0 -40
 - data/features/code_check/W0745.feature +1 -0
 - data/features/code_check/W9003.feature +85 -0
 - data/lib/adlint/c/conv.rb +32 -0
 - data/lib/adlint/c/interp.rb +17 -1
 - data/lib/adlint/c/mediator.rb +2 -0
 - data/lib/adlint/c/syntax.rb +72 -0
 - data/lib/adlint/c/type.rb +10 -3
 - data/lib/adlint/exam/c_builtin/c_check.rb +164 -48
 - 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 +12 -12
 - data/share/doc/users_guide_en.texi +10 -10
 - data/share/doc/users_guide_ja.html +12 -12
 - data/share/doc/users_guide_ja.texi +10 -10
 - metadata +6 -2
 
| 
         @@ -0,0 +1,72 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Feature: W0582
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
              W0582 detects that number or types of arguments of a function call does not
         
     | 
| 
      
 4 
     | 
    
         
            +
              conform with a prototype declaration of the function appears after the
         
     | 
| 
      
 5 
     | 
    
         
            +
              function call.
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
              Scenario: call with matched arguments
         
     | 
| 
      
 8 
     | 
    
         
            +
                Given a target source named "fixture.c" with:
         
     | 
| 
      
 9 
     | 
    
         
            +
                  """
         
     | 
| 
      
 10 
     | 
    
         
            +
                  static void foo(int *p)
         
     | 
| 
      
 11 
     | 
    
         
            +
                  {
         
     | 
| 
      
 12 
     | 
    
         
            +
                      bar(NULL, *p); /* OK */
         
     | 
| 
      
 13 
     | 
    
         
            +
                  }
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                  static void bar(int *, int);
         
     | 
| 
      
 16 
     | 
    
         
            +
                  """
         
     | 
| 
      
 17 
     | 
    
         
            +
                When I successfully run `adlint fixture.c` on noarch
         
     | 
| 
      
 18 
     | 
    
         
            +
                Then the output should exactly match with:
         
     | 
| 
      
 19 
     | 
    
         
            +
                  | mesg  | line | column |
         
     | 
| 
      
 20 
     | 
    
         
            +
                  | W1076 | 1    | 13     |
         
     | 
| 
      
 21 
     | 
    
         
            +
                  | W0422 | 3    | 15     |
         
     | 
| 
      
 22 
     | 
    
         
            +
                  | W0109 | 3    | 8      |
         
     | 
| 
      
 23 
     | 
    
         
            +
                  | W0104 | 1    | 22     |
         
     | 
| 
      
 24 
     | 
    
         
            +
                  | W0105 | 1    | 22     |
         
     | 
| 
      
 25 
     | 
    
         
            +
                  | W1073 | 3    | 8      |
         
     | 
| 
      
 26 
     | 
    
         
            +
                  | W0629 | 1    | 13     |
         
     | 
| 
      
 27 
     | 
    
         
            +
                  | W0628 | 1    | 13     |
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
              Scenario: call with unmatched arguments
         
     | 
| 
      
 30 
     | 
    
         
            +
                Given a target source named "fixture.c" with:
         
     | 
| 
      
 31 
     | 
    
         
            +
                  """
         
     | 
| 
      
 32 
     | 
    
         
            +
                  static void foo(int *p)
         
     | 
| 
      
 33 
     | 
    
         
            +
                  {
         
     | 
| 
      
 34 
     | 
    
         
            +
                      bar(NULL, p); /* W0582 */
         
     | 
| 
      
 35 
     | 
    
         
            +
                  }
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                  static void bar(int *, int);
         
     | 
| 
      
 38 
     | 
    
         
            +
                  """
         
     | 
| 
      
 39 
     | 
    
         
            +
                When I successfully run `adlint fixture.c` on noarch
         
     | 
| 
      
 40 
     | 
    
         
            +
                Then the output should exactly match with:
         
     | 
| 
      
 41 
     | 
    
         
            +
                  | mesg  | line | column |
         
     | 
| 
      
 42 
     | 
    
         
            +
                  | W1076 | 1    | 13     |
         
     | 
| 
      
 43 
     | 
    
         
            +
                  | W0109 | 3    | 8      |
         
     | 
| 
      
 44 
     | 
    
         
            +
                  | W0104 | 1    | 22     |
         
     | 
| 
      
 45 
     | 
    
         
            +
                  | W0105 | 1    | 22     |
         
     | 
| 
      
 46 
     | 
    
         
            +
                  | W1073 | 3    | 8      |
         
     | 
| 
      
 47 
     | 
    
         
            +
                  | W0582 | 3    | 8      |
         
     | 
| 
      
 48 
     | 
    
         
            +
                  | W0629 | 1    | 13     |
         
     | 
| 
      
 49 
     | 
    
         
            +
                  | W0628 | 1    | 13     |
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
              Scenario: call with unmatched constant pointer
         
     | 
| 
      
 52 
     | 
    
         
            +
                Given a target source named "fixture.c" with:
         
     | 
| 
      
 53 
     | 
    
         
            +
                  """
         
     | 
| 
      
 54 
     | 
    
         
            +
                  static void foo(int *p)
         
     | 
| 
      
 55 
     | 
    
         
            +
                  {
         
     | 
| 
      
 56 
     | 
    
         
            +
                      bar(3, *p); /* W0582 */
         
     | 
| 
      
 57 
     | 
    
         
            +
                  }
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
                  static void bar(int *, int);
         
     | 
| 
      
 60 
     | 
    
         
            +
                  """
         
     | 
| 
      
 61 
     | 
    
         
            +
                When I successfully run `adlint fixture.c` on noarch
         
     | 
| 
      
 62 
     | 
    
         
            +
                Then the output should exactly match with:
         
     | 
| 
      
 63 
     | 
    
         
            +
                  | mesg  | line | column |
         
     | 
| 
      
 64 
     | 
    
         
            +
                  | W1076 | 1    | 13     |
         
     | 
| 
      
 65 
     | 
    
         
            +
                  | W0422 | 3    | 12     |
         
     | 
| 
      
 66 
     | 
    
         
            +
                  | W0109 | 3    | 8      |
         
     | 
| 
      
 67 
     | 
    
         
            +
                  | W0104 | 1    | 22     |
         
     | 
| 
      
 68 
     | 
    
         
            +
                  | W0105 | 1    | 22     |
         
     | 
| 
      
 69 
     | 
    
         
            +
                  | W1073 | 3    | 8      |
         
     | 
| 
      
 70 
     | 
    
         
            +
                  | W0582 | 3    | 8      |
         
     | 
| 
      
 71 
     | 
    
         
            +
                  | W0629 | 1    | 13     |
         
     | 
| 
      
 72 
     | 
    
         
            +
                  | W0628 | 1    | 13     |
         
     | 
| 
         @@ -25,3 +25,96 @@ Feature: W0583 
     | 
|
| 
       25 
25 
     | 
    
         
             
                  | W0104 | 7    | 20     |
         
     | 
| 
       26 
26 
     | 
    
         
             
                  | W0589 | 7    | 5      |
         
     | 
| 
       27 
27 
     | 
    
         
             
                  | W0591 | 7    | 5      |
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
              Scenario: call with matched arguments
         
     | 
| 
      
 30 
     | 
    
         
            +
                Given a target source named "fixture.c" with:
         
     | 
| 
      
 31 
     | 
    
         
            +
                  """
         
     | 
| 
      
 32 
     | 
    
         
            +
                  static void foo(int *p)
         
     | 
| 
      
 33 
     | 
    
         
            +
                  {
         
     | 
| 
      
 34 
     | 
    
         
            +
                      bar(NULL, *p); /* OK */
         
     | 
| 
      
 35 
     | 
    
         
            +
                  }
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                  static void bar(int *p, int i)
         
     | 
| 
      
 38 
     | 
    
         
            +
                  {
         
     | 
| 
      
 39 
     | 
    
         
            +
                  }
         
     | 
| 
      
 40 
     | 
    
         
            +
                  """
         
     | 
| 
      
 41 
     | 
    
         
            +
                When I successfully run `adlint fixture.c` on noarch
         
     | 
| 
      
 42 
     | 
    
         
            +
                Then the output should exactly match with:
         
     | 
| 
      
 43 
     | 
    
         
            +
                  | mesg  | line | column |
         
     | 
| 
      
 44 
     | 
    
         
            +
                  | W1076 | 1    | 13     |
         
     | 
| 
      
 45 
     | 
    
         
            +
                  | W0422 | 3    | 15     |
         
     | 
| 
      
 46 
     | 
    
         
            +
                  | W0109 | 3    | 8      |
         
     | 
| 
      
 47 
     | 
    
         
            +
                  | W0104 | 1    | 22     |
         
     | 
| 
      
 48 
     | 
    
         
            +
                  | W0105 | 1    | 22     |
         
     | 
| 
      
 49 
     | 
    
         
            +
                  | W1073 | 3    | 8      |
         
     | 
| 
      
 50 
     | 
    
         
            +
                  | W1076 | 6    | 13     |
         
     | 
| 
      
 51 
     | 
    
         
            +
                  | W0031 | 6    | 22     |
         
     | 
| 
      
 52 
     | 
    
         
            +
                  | W0031 | 6    | 29     |
         
     | 
| 
      
 53 
     | 
    
         
            +
                  | W0104 | 6    | 22     |
         
     | 
| 
      
 54 
     | 
    
         
            +
                  | W0104 | 6    | 29     |
         
     | 
| 
      
 55 
     | 
    
         
            +
                  | W0105 | 6    | 22     |
         
     | 
| 
      
 56 
     | 
    
         
            +
                  | W0629 | 1    | 13     |
         
     | 
| 
      
 57 
     | 
    
         
            +
                  | W0629 | 6    | 13     |
         
     | 
| 
      
 58 
     | 
    
         
            +
                  | W0628 | 1    | 13     |
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
              Scenario: call with unmatched arguments
         
     | 
| 
      
 61 
     | 
    
         
            +
                Given a target source named "fixture.c" with:
         
     | 
| 
      
 62 
     | 
    
         
            +
                  """
         
     | 
| 
      
 63 
     | 
    
         
            +
                  static void foo(int *p)
         
     | 
| 
      
 64 
     | 
    
         
            +
                  {
         
     | 
| 
      
 65 
     | 
    
         
            +
                      bar(NULL, p); /* W0583 */
         
     | 
| 
      
 66 
     | 
    
         
            +
                  }
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
                  static void bar(int *p, int i)
         
     | 
| 
      
 69 
     | 
    
         
            +
                  {
         
     | 
| 
      
 70 
     | 
    
         
            +
                  }
         
     | 
| 
      
 71 
     | 
    
         
            +
                  """
         
     | 
| 
      
 72 
     | 
    
         
            +
                When I successfully run `adlint fixture.c` on noarch
         
     | 
| 
      
 73 
     | 
    
         
            +
                Then the output should exactly match with:
         
     | 
| 
      
 74 
     | 
    
         
            +
                  | mesg  | line | column |
         
     | 
| 
      
 75 
     | 
    
         
            +
                  | W1076 | 1    | 13     |
         
     | 
| 
      
 76 
     | 
    
         
            +
                  | W0109 | 3    | 8      |
         
     | 
| 
      
 77 
     | 
    
         
            +
                  | W0104 | 1    | 22     |
         
     | 
| 
      
 78 
     | 
    
         
            +
                  | W0105 | 1    | 22     |
         
     | 
| 
      
 79 
     | 
    
         
            +
                  | W1073 | 3    | 8      |
         
     | 
| 
      
 80 
     | 
    
         
            +
                  | W0583 | 3    | 8      |
         
     | 
| 
      
 81 
     | 
    
         
            +
                  | W1076 | 6    | 13     |
         
     | 
| 
      
 82 
     | 
    
         
            +
                  | W0031 | 6    | 22     |
         
     | 
| 
      
 83 
     | 
    
         
            +
                  | W0031 | 6    | 29     |
         
     | 
| 
      
 84 
     | 
    
         
            +
                  | W0104 | 6    | 22     |
         
     | 
| 
      
 85 
     | 
    
         
            +
                  | W0104 | 6    | 29     |
         
     | 
| 
      
 86 
     | 
    
         
            +
                  | W0105 | 6    | 22     |
         
     | 
| 
      
 87 
     | 
    
         
            +
                  | W0629 | 1    | 13     |
         
     | 
| 
      
 88 
     | 
    
         
            +
                  | W0629 | 6    | 13     |
         
     | 
| 
      
 89 
     | 
    
         
            +
                  | W0628 | 1    | 13     |
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
              Scenario: call with unmatched constant pointer
         
     | 
| 
      
 92 
     | 
    
         
            +
                Given a target source named "fixture.c" with:
         
     | 
| 
      
 93 
     | 
    
         
            +
                  """
         
     | 
| 
      
 94 
     | 
    
         
            +
                  static void foo(int *p)
         
     | 
| 
      
 95 
     | 
    
         
            +
                  {
         
     | 
| 
      
 96 
     | 
    
         
            +
                      bar(3, p); /* W0583 */
         
     | 
| 
      
 97 
     | 
    
         
            +
                  }
         
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
                  static void bar(int *p, int i)
         
     | 
| 
      
 100 
     | 
    
         
            +
                  {
         
     | 
| 
      
 101 
     | 
    
         
            +
                  }
         
     | 
| 
      
 102 
     | 
    
         
            +
                  """
         
     | 
| 
      
 103 
     | 
    
         
            +
                When I successfully run `adlint fixture.c` on noarch
         
     | 
| 
      
 104 
     | 
    
         
            +
                Then the output should exactly match with:
         
     | 
| 
      
 105 
     | 
    
         
            +
                  | mesg  | line | column |
         
     | 
| 
      
 106 
     | 
    
         
            +
                  | W1076 | 1    | 13     |
         
     | 
| 
      
 107 
     | 
    
         
            +
                  | W0109 | 3    | 8      |
         
     | 
| 
      
 108 
     | 
    
         
            +
                  | W0104 | 1    | 22     |
         
     | 
| 
      
 109 
     | 
    
         
            +
                  | W0105 | 1    | 22     |
         
     | 
| 
      
 110 
     | 
    
         
            +
                  | W1073 | 3    | 8      |
         
     | 
| 
      
 111 
     | 
    
         
            +
                  | W0583 | 3    | 8      |
         
     | 
| 
      
 112 
     | 
    
         
            +
                  | W1076 | 6    | 13     |
         
     | 
| 
      
 113 
     | 
    
         
            +
                  | W0031 | 6    | 22     |
         
     | 
| 
      
 114 
     | 
    
         
            +
                  | W0031 | 6    | 29     |
         
     | 
| 
      
 115 
     | 
    
         
            +
                  | W0104 | 6    | 22     |
         
     | 
| 
      
 116 
     | 
    
         
            +
                  | W0104 | 6    | 29     |
         
     | 
| 
      
 117 
     | 
    
         
            +
                  | W0105 | 6    | 22     |
         
     | 
| 
      
 118 
     | 
    
         
            +
                  | W0629 | 1    | 13     |
         
     | 
| 
      
 119 
     | 
    
         
            +
                  | W0629 | 6    | 13     |
         
     | 
| 
      
 120 
     | 
    
         
            +
                  | W0628 | 1    | 13     |
         
     | 
| 
         @@ -0,0 +1,139 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Feature: W0584
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
              W0584 detects that type of the argument of a function call does not conform
         
     | 
| 
      
 4 
     | 
    
         
            +
              with one of the corresponding parameter of the old style function definition.
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
              Scenario: call with matched arguments
         
     | 
| 
      
 7 
     | 
    
         
            +
                Given a target source named "fixture.c" with:
         
     | 
| 
      
 8 
     | 
    
         
            +
                  """
         
     | 
| 
      
 9 
     | 
    
         
            +
                  int foo(p, i)
         
     | 
| 
      
 10 
     | 
    
         
            +
                  int *p;
         
     | 
| 
      
 11 
     | 
    
         
            +
                  int i;
         
     | 
| 
      
 12 
     | 
    
         
            +
                  {
         
     | 
| 
      
 13 
     | 
    
         
            +
                      return *p + i;
         
     | 
| 
      
 14 
     | 
    
         
            +
                  }
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                  int bar(p)
         
     | 
| 
      
 17 
     | 
    
         
            +
                  int *p;
         
     | 
| 
      
 18 
     | 
    
         
            +
                  {
         
     | 
| 
      
 19 
     | 
    
         
            +
                      return foo(NULL, *p); /* OK */
         
     | 
| 
      
 20 
     | 
    
         
            +
                  }
         
     | 
| 
      
 21 
     | 
    
         
            +
                  """
         
     | 
| 
      
 22 
     | 
    
         
            +
                When I successfully run `adlint fixture.c` on noarch
         
     | 
| 
      
 23 
     | 
    
         
            +
                Then the output should exactly match with:
         
     | 
| 
      
 24 
     | 
    
         
            +
                  | mesg  | line | column |
         
     | 
| 
      
 25 
     | 
    
         
            +
                  | W0117 | 1    | 5      |
         
     | 
| 
      
 26 
     | 
    
         
            +
                  | W0422 | 5    | 12     |
         
     | 
| 
      
 27 
     | 
    
         
            +
                  | W0723 | 5    | 15     |
         
     | 
| 
      
 28 
     | 
    
         
            +
                  | W0104 | 2    | 6      |
         
     | 
| 
      
 29 
     | 
    
         
            +
                  | W0104 | 3    | 5      |
         
     | 
| 
      
 30 
     | 
    
         
            +
                  | W0105 | 2    | 6      |
         
     | 
| 
      
 31 
     | 
    
         
            +
                  | W0117 | 8    | 5      |
         
     | 
| 
      
 32 
     | 
    
         
            +
                  | W0422 | 11   | 22     |
         
     | 
| 
      
 33 
     | 
    
         
            +
                  | W0104 | 9    | 6      |
         
     | 
| 
      
 34 
     | 
    
         
            +
                  | W0105 | 9    | 6      |
         
     | 
| 
      
 35 
     | 
    
         
            +
                  | W0002 | 1    | 5      |
         
     | 
| 
      
 36 
     | 
    
         
            +
                  | W0002 | 8    | 5      |
         
     | 
| 
      
 37 
     | 
    
         
            +
                  | W0589 | 1    | 5      |
         
     | 
| 
      
 38 
     | 
    
         
            +
                  | W0591 | 1    | 5      |
         
     | 
| 
      
 39 
     | 
    
         
            +
                  | W0628 | 8    | 5      |
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
              Scenario: call with unmatched arguments
         
     | 
| 
      
 42 
     | 
    
         
            +
                Given a target source named "fixture.c" with:
         
     | 
| 
      
 43 
     | 
    
         
            +
                  """
         
     | 
| 
      
 44 
     | 
    
         
            +
                  int foo(p, i)
         
     | 
| 
      
 45 
     | 
    
         
            +
                  int *p;
         
     | 
| 
      
 46 
     | 
    
         
            +
                  int i;
         
     | 
| 
      
 47 
     | 
    
         
            +
                  {
         
     | 
| 
      
 48 
     | 
    
         
            +
                      return *p + i;
         
     | 
| 
      
 49 
     | 
    
         
            +
                  }
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
                  int bar(p)
         
     | 
| 
      
 52 
     | 
    
         
            +
                  int *p;
         
     | 
| 
      
 53 
     | 
    
         
            +
                  {
         
     | 
| 
      
 54 
     | 
    
         
            +
                      return foo(NULL, p); /* W0584 */
         
     | 
| 
      
 55 
     | 
    
         
            +
                  }
         
     | 
| 
      
 56 
     | 
    
         
            +
                  """
         
     | 
| 
      
 57 
     | 
    
         
            +
                When I successfully run `adlint fixture.c` on noarch
         
     | 
| 
      
 58 
     | 
    
         
            +
                Then the output should exactly match with:
         
     | 
| 
      
 59 
     | 
    
         
            +
                  | mesg  | line | column |
         
     | 
| 
      
 60 
     | 
    
         
            +
                  | W0117 | 1    | 5      |
         
     | 
| 
      
 61 
     | 
    
         
            +
                  | W0422 | 5    | 12     |
         
     | 
| 
      
 62 
     | 
    
         
            +
                  | W0723 | 5    | 15     |
         
     | 
| 
      
 63 
     | 
    
         
            +
                  | W0104 | 2    | 6      |
         
     | 
| 
      
 64 
     | 
    
         
            +
                  | W0104 | 3    | 5      |
         
     | 
| 
      
 65 
     | 
    
         
            +
                  | W0105 | 2    | 6      |
         
     | 
| 
      
 66 
     | 
    
         
            +
                  | W0117 | 8    | 5      |
         
     | 
| 
      
 67 
     | 
    
         
            +
                  | W9003 | 11   | 22     |
         
     | 
| 
      
 68 
     | 
    
         
            +
                  | W0584 | 11   | 22     |
         
     | 
| 
      
 69 
     | 
    
         
            +
                  | W0104 | 9    | 6      |
         
     | 
| 
      
 70 
     | 
    
         
            +
                  | W0105 | 9    | 6      |
         
     | 
| 
      
 71 
     | 
    
         
            +
                  | W0002 | 1    | 5      |
         
     | 
| 
      
 72 
     | 
    
         
            +
                  | W0002 | 8    | 5      |
         
     | 
| 
      
 73 
     | 
    
         
            +
                  | W0589 | 1    | 5      |
         
     | 
| 
      
 74 
     | 
    
         
            +
                  | W0591 | 1    | 5      |
         
     | 
| 
      
 75 
     | 
    
         
            +
                  | W0628 | 8    | 5      |
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
              Scenario: call with unmatched constant pointer
         
     | 
| 
      
 78 
     | 
    
         
            +
                Given a target source named "fixture.c" with:
         
     | 
| 
      
 79 
     | 
    
         
            +
                  """
         
     | 
| 
      
 80 
     | 
    
         
            +
                  int foo(p, i)
         
     | 
| 
      
 81 
     | 
    
         
            +
                  int *p;
         
     | 
| 
      
 82 
     | 
    
         
            +
                  int i;
         
     | 
| 
      
 83 
     | 
    
         
            +
                  {
         
     | 
| 
      
 84 
     | 
    
         
            +
                      return *p + i;
         
     | 
| 
      
 85 
     | 
    
         
            +
                  }
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
                  int bar(p)
         
     | 
| 
      
 88 
     | 
    
         
            +
                  int *p;
         
     | 
| 
      
 89 
     | 
    
         
            +
                  {
         
     | 
| 
      
 90 
     | 
    
         
            +
                      return foo(3, *p); /* W0584 */
         
     | 
| 
      
 91 
     | 
    
         
            +
                  }
         
     | 
| 
      
 92 
     | 
    
         
            +
                  """
         
     | 
| 
      
 93 
     | 
    
         
            +
                When I successfully run `adlint fixture.c` on noarch
         
     | 
| 
      
 94 
     | 
    
         
            +
                Then the output should exactly match with:
         
     | 
| 
      
 95 
     | 
    
         
            +
                  | mesg  | line | column |
         
     | 
| 
      
 96 
     | 
    
         
            +
                  | W0117 | 1    | 5      |
         
     | 
| 
      
 97 
     | 
    
         
            +
                  | W0422 | 5    | 12     |
         
     | 
| 
      
 98 
     | 
    
         
            +
                  | W0723 | 5    | 15     |
         
     | 
| 
      
 99 
     | 
    
         
            +
                  | W0104 | 2    | 6      |
         
     | 
| 
      
 100 
     | 
    
         
            +
                  | W0104 | 3    | 5      |
         
     | 
| 
      
 101 
     | 
    
         
            +
                  | W0105 | 2    | 6      |
         
     | 
| 
      
 102 
     | 
    
         
            +
                  | W0117 | 8    | 5      |
         
     | 
| 
      
 103 
     | 
    
         
            +
                  | W0422 | 11   | 19     |
         
     | 
| 
      
 104 
     | 
    
         
            +
                  | W9003 | 11   | 16     |
         
     | 
| 
      
 105 
     | 
    
         
            +
                  | W0584 | 11   | 16     |
         
     | 
| 
      
 106 
     | 
    
         
            +
                  | W0104 | 9    | 6      |
         
     | 
| 
      
 107 
     | 
    
         
            +
                  | W0105 | 9    | 6      |
         
     | 
| 
      
 108 
     | 
    
         
            +
                  | W0002 | 1    | 5      |
         
     | 
| 
      
 109 
     | 
    
         
            +
                  | W0002 | 8    | 5      |
         
     | 
| 
      
 110 
     | 
    
         
            +
                  | W0589 | 1    | 5      |
         
     | 
| 
      
 111 
     | 
    
         
            +
                  | W0591 | 1    | 5      |
         
     | 
| 
      
 112 
     | 
    
         
            +
                  | W0628 | 8    | 5      |
         
     | 
| 
      
 113 
     | 
    
         
            +
             
     | 
| 
      
 114 
     | 
    
         
            +
              Scenario: call with convertible arguments
         
     | 
| 
      
 115 
     | 
    
         
            +
                Given a target source named "fixture.c" with:
         
     | 
| 
      
 116 
     | 
    
         
            +
                  """
         
     | 
| 
      
 117 
     | 
    
         
            +
                  void print(p)
         
     | 
| 
      
 118 
     | 
    
         
            +
                  const char *p;
         
     | 
| 
      
 119 
     | 
    
         
            +
                  {
         
     | 
| 
      
 120 
     | 
    
         
            +
                  }
         
     | 
| 
      
 121 
     | 
    
         
            +
             
     | 
| 
      
 122 
     | 
    
         
            +
                  void foo()
         
     | 
| 
      
 123 
     | 
    
         
            +
                  {
         
     | 
| 
      
 124 
     | 
    
         
            +
                      print("foo"); /* OK */
         
     | 
| 
      
 125 
     | 
    
         
            +
                  }
         
     | 
| 
      
 126 
     | 
    
         
            +
                  """
         
     | 
| 
      
 127 
     | 
    
         
            +
                When I successfully run `adlint fixture.c` on noarch
         
     | 
| 
      
 128 
     | 
    
         
            +
                Then the output should exactly match with:
         
     | 
| 
      
 129 
     | 
    
         
            +
                  | mesg  | line | column |
         
     | 
| 
      
 130 
     | 
    
         
            +
                  | W0117 | 1    | 6      |
         
     | 
| 
      
 131 
     | 
    
         
            +
                  | W0031 | 2    | 13     |
         
     | 
| 
      
 132 
     | 
    
         
            +
                  | W0104 | 2    | 13     |
         
     | 
| 
      
 133 
     | 
    
         
            +
                  | W0117 | 6    | 6      |
         
     | 
| 
      
 134 
     | 
    
         
            +
                  | W0002 | 1    | 6      |
         
     | 
| 
      
 135 
     | 
    
         
            +
                  | W0540 | 6    | 6      |
         
     | 
| 
      
 136 
     | 
    
         
            +
                  | W0947 | 8    | 11     |
         
     | 
| 
      
 137 
     | 
    
         
            +
                  | W0589 | 1    | 6      |
         
     | 
| 
      
 138 
     | 
    
         
            +
                  | W0591 | 1    | 6      |
         
     | 
| 
      
 139 
     | 
    
         
            +
                  | W0628 | 6    | 6      |
         
     | 
| 
         @@ -29,7 +29,6 @@ Feature: W0635 
     | 
|
| 
       29 
29 
     | 
    
         
             
                  | W0947 | 8    | 24     |
         
     | 
| 
       30 
30 
     | 
    
         
             
                  | W0947 | 10   | 19     |
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
32 
     | 
    
         
             
              Scenario: `%s' conversion-specifiers with bad arguments
         
     | 
| 
       34 
33 
     | 
    
         
             
                Given a target source named "fixture.c" with:
         
     | 
| 
       35 
34 
     | 
    
         
             
                  """
         
     | 
| 
         @@ -47,7 +46,6 @@ Feature: W0635 
     | 
|
| 
       47 
46 
     | 
    
         
             
                When I successfully run `adlint fixture.c` on noarch
         
     | 
| 
       48 
47 
     | 
    
         
             
                Then the output should exactly match with:
         
     | 
| 
       49 
48 
     | 
    
         
             
                  | mesg  | line | column |
         
     | 
| 
       50 
     | 
    
         
            -
                  | W9003 | 7    | 29     |
         
     | 
| 
       51 
49 
     | 
    
         
             
                  | W0635 | 9    | 19     |
         
     | 
| 
       52 
50 
     | 
    
         
             
                  | W0635 | 9    | 19     |
         
     | 
| 
       53 
51 
     | 
    
         
             
                  | W0635 | 9    | 19     |
         
     | 
| 
         @@ -0,0 +1,68 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Feature: W0722
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
              W0722 detects that signed arithmetic-expression must overflow.
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
              Scenario: additive-expression must not overflow
         
     | 
| 
      
 6 
     | 
    
         
            +
                Given a target source named "fixture.c" with:
         
     | 
| 
      
 7 
     | 
    
         
            +
                  """
         
     | 
| 
      
 8 
     | 
    
         
            +
                  static int foo(int i, int j)
         
     | 
| 
      
 9 
     | 
    
         
            +
                  {
         
     | 
| 
      
 10 
     | 
    
         
            +
                      if ((i > -10) && (i < 10) && (j > -20) && (j < 20)) {
         
     | 
| 
      
 11 
     | 
    
         
            +
                          return i + j; /* OK */
         
     | 
| 
      
 12 
     | 
    
         
            +
                      }
         
     | 
| 
      
 13 
     | 
    
         
            +
                      return 0;
         
     | 
| 
      
 14 
     | 
    
         
            +
                  }
         
     | 
| 
      
 15 
     | 
    
         
            +
                  """
         
     | 
| 
      
 16 
     | 
    
         
            +
                When I successfully run `adlint fixture.c` on noarch
         
     | 
| 
      
 17 
     | 
    
         
            +
                Then the output should exactly match with:
         
     | 
| 
      
 18 
     | 
    
         
            +
                  | mesg  | line | column |
         
     | 
| 
      
 19 
     | 
    
         
            +
                  | W1076 | 1    | 12     |
         
     | 
| 
      
 20 
     | 
    
         
            +
                  | W0104 | 1    | 20     |
         
     | 
| 
      
 21 
     | 
    
         
            +
                  | W0104 | 1    | 27     |
         
     | 
| 
      
 22 
     | 
    
         
            +
                  | W1071 | 1    | 12     |
         
     | 
| 
      
 23 
     | 
    
         
            +
                  | W0629 | 1    | 12     |
         
     | 
| 
      
 24 
     | 
    
         
            +
                  | W0628 | 1    | 12     |
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
              Scenario: additive-expression may overflow
         
     | 
| 
      
 27 
     | 
    
         
            +
                Given a target source named "fixture.c" with:
         
     | 
| 
      
 28 
     | 
    
         
            +
                  """
         
     | 
| 
      
 29 
     | 
    
         
            +
                  static int foo(int i, int j)
         
     | 
| 
      
 30 
     | 
    
         
            +
                  {
         
     | 
| 
      
 31 
     | 
    
         
            +
                      if ((i > -10) && (i < 10) && (j < 20)) {
         
     | 
| 
      
 32 
     | 
    
         
            +
                          return i + j; /* OK but W0723 */
         
     | 
| 
      
 33 
     | 
    
         
            +
                      }
         
     | 
| 
      
 34 
     | 
    
         
            +
                      return 0;
         
     | 
| 
      
 35 
     | 
    
         
            +
                  }
         
     | 
| 
      
 36 
     | 
    
         
            +
                  """
         
     | 
| 
      
 37 
     | 
    
         
            +
                When I successfully run `adlint fixture.c` on noarch
         
     | 
| 
      
 38 
     | 
    
         
            +
                Then the output should exactly match with:
         
     | 
| 
      
 39 
     | 
    
         
            +
                  | mesg  | line | column |
         
     | 
| 
      
 40 
     | 
    
         
            +
                  | W1076 | 1    | 12     |
         
     | 
| 
      
 41 
     | 
    
         
            +
                  | W0723 | 4    | 18     |
         
     | 
| 
      
 42 
     | 
    
         
            +
                  | W0104 | 1    | 20     |
         
     | 
| 
      
 43 
     | 
    
         
            +
                  | W0104 | 1    | 27     |
         
     | 
| 
      
 44 
     | 
    
         
            +
                  | W1071 | 1    | 12     |
         
     | 
| 
      
 45 
     | 
    
         
            +
                  | W0629 | 1    | 12     |
         
     | 
| 
      
 46 
     | 
    
         
            +
                  | W0628 | 1    | 12     |
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
              Scenario: additive-expression must overflow
         
     | 
| 
      
 49 
     | 
    
         
            +
                Given a target source named "fixture.c" with:
         
     | 
| 
      
 50 
     | 
    
         
            +
                  """
         
     | 
| 
      
 51 
     | 
    
         
            +
                  static int foo(int i, int j)
         
     | 
| 
      
 52 
     | 
    
         
            +
                  {
         
     | 
| 
      
 53 
     | 
    
         
            +
                      if ((i > 2000000000) && (j > 2000000000)) {
         
     | 
| 
      
 54 
     | 
    
         
            +
                          return i + j; /* W0722 */
         
     | 
| 
      
 55 
     | 
    
         
            +
                      }
         
     | 
| 
      
 56 
     | 
    
         
            +
                      return 0;
         
     | 
| 
      
 57 
     | 
    
         
            +
                  }
         
     | 
| 
      
 58 
     | 
    
         
            +
                  """
         
     | 
| 
      
 59 
     | 
    
         
            +
                When I successfully run `adlint fixture.c` on noarch
         
     | 
| 
      
 60 
     | 
    
         
            +
                Then the output should exactly match with:
         
     | 
| 
      
 61 
     | 
    
         
            +
                  | mesg  | line | column |
         
     | 
| 
      
 62 
     | 
    
         
            +
                  | W1076 | 1    | 12     |
         
     | 
| 
      
 63 
     | 
    
         
            +
                  | W0722 | 4    | 18     |
         
     | 
| 
      
 64 
     | 
    
         
            +
                  | W0104 | 1    | 20     |
         
     | 
| 
      
 65 
     | 
    
         
            +
                  | W0104 | 1    | 27     |
         
     | 
| 
      
 66 
     | 
    
         
            +
                  | W1071 | 1    | 12     |
         
     | 
| 
      
 67 
     | 
    
         
            +
                  | W0629 | 1    | 12     |
         
     | 
| 
      
 68 
     | 
    
         
            +
                  | W0628 | 1    | 12     |
         
     | 
| 
         @@ -1,6 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            Feature: W0723
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
              W0723 detects that  
     | 
| 
      
 3 
     | 
    
         
            +
              W0723 detects that signed arithmetic-expression may overflow.
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
              Scenario: an arithmetic operation in initializer of a global variable
         
     | 
| 
       6 
6 
     | 
    
         
             
                Given a target source named "fixture.c" with:
         
     | 
| 
         @@ -39,15 +39,10 @@ Feature: W0732 
     | 
|
| 
       39 
39 
     | 
    
         
             
                  | W0104 | 1    | 29     |
         
     | 
| 
       40 
40 
     | 
    
         
             
                  | W0104 | 1    | 43     |
         
     | 
| 
       41 
41 
     | 
    
         
             
                  | W0629 | 1    | 13     |
         
     | 
| 
       42 
     | 
    
         
            -
                  | W0088 | 5    | 17     |
         
     | 
| 
       43 
42 
     | 
    
         
             
                  | W0732 | 5    | 17     |
         
     | 
| 
       44 
     | 
    
         
            -
                  | W0088 | 6    | 17     |
         
     | 
| 
       45 
43 
     | 
    
         
             
                  | W0732 | 6    | 17     |
         
     | 
| 
       46 
     | 
    
         
            -
                  | W0088 | 7    | 17     |
         
     | 
| 
       47 
44 
     | 
    
         
             
                  | W0732 | 7    | 17     |
         
     | 
| 
       48 
     | 
    
         
            -
                  | W0088 | 8    | 17     |
         
     | 
| 
       49 
45 
     | 
    
         
             
                  | W0732 | 8    | 17     |
         
     | 
| 
       50 
     | 
    
         
            -
                  | W0088 | 9    | 17     |
         
     | 
| 
       51 
46 
     | 
    
         
             
                  | W0732 | 9    | 17     |
         
     | 
| 
       52 
47 
     | 
    
         
             
                  | W0508 | 11   | 18     |
         
     | 
| 
       53 
48 
     | 
    
         
             
                  | W0732 | 11   | 18     |
         
     | 
| 
         @@ -106,15 +101,10 @@ Feature: W0732 
     | 
|
| 
       106 
101 
     | 
    
         
             
                  | W0104 | 1    | 29     |
         
     | 
| 
       107 
102 
     | 
    
         
             
                  | W0104 | 1    | 43     |
         
     | 
| 
       108 
103 
     | 
    
         
             
                  | W0629 | 1    | 13     |
         
     | 
| 
       109 
     | 
    
         
            -
                  | W0088 | 5    | 18     |
         
     | 
| 
       110 
104 
     | 
    
         
             
                  | W0732 | 5    | 18     |
         
     | 
| 
       111 
     | 
    
         
            -
                  | W0088 | 6    | 18     |
         
     | 
| 
       112 
105 
     | 
    
         
             
                  | W0732 | 6    | 18     |
         
     | 
| 
       113 
     | 
    
         
            -
                  | W0088 | 7    | 17     |
         
     | 
| 
       114 
106 
     | 
    
         
             
                  | W0732 | 7    | 17     |
         
     | 
| 
       115 
     | 
    
         
            -
                  | W0088 | 8    | 17     |
         
     | 
| 
       116 
107 
     | 
    
         
             
                  | W0732 | 8    | 17     |
         
     | 
| 
       117 
     | 
    
         
            -
                  | W0088 | 9    | 17     |
         
     | 
| 
       118 
108 
     | 
    
         
             
                  | W0732 | 9    | 17     |
         
     | 
| 
       119 
109 
     | 
    
         
             
                  | W0508 | 11   | 18     |
         
     | 
| 
       120 
110 
     | 
    
         
             
                  | W0732 | 11   | 18     |
         
     | 
| 
         @@ -154,9 +144,4 @@ Feature: W0732 
     | 
|
| 
       154 
144 
     | 
    
         
             
                  | W0104 | 1    | 36     |
         
     | 
| 
       155 
145 
     | 
    
         
             
                  | W0104 | 1    | 43     |
         
     | 
| 
       156 
146 
     | 
    
         
             
                  | W0629 | 1    | 13     |
         
     | 
| 
       157 
     | 
    
         
            -
                  | W0088 | 6    | 18     |
         
     | 
| 
       158 
     | 
    
         
            -
                  | W0088 | 9    | 17     |
         
     | 
| 
       159 
     | 
    
         
            -
                  | W0088 | 10   | 18     |
         
     | 
| 
       160 
     | 
    
         
            -
                  | W0088 | 13   | 18     |
         
     | 
| 
       161 
     | 
    
         
            -
                  | W0088 | 14   | 18     |
         
     | 
| 
       162 
147 
     | 
    
         
             
                  | W0628 | 1    | 13     |
         
     | 
| 
         @@ -39,15 +39,10 @@ Feature: W0733 
     | 
|
| 
       39 
39 
     | 
    
         
             
                  | W0104 | 1    | 29     |
         
     | 
| 
       40 
40 
     | 
    
         
             
                  | W0104 | 1    | 43     |
         
     | 
| 
       41 
41 
     | 
    
         
             
                  | W0629 | 1    | 13     |
         
     | 
| 
       42 
     | 
    
         
            -
                  | W0088 | 5    | 17     |
         
     | 
| 
       43 
42 
     | 
    
         
             
                  | W0733 | 5    | 17     |
         
     | 
| 
       44 
     | 
    
         
            -
                  | W0088 | 6    | 17     |
         
     | 
| 
       45 
43 
     | 
    
         
             
                  | W0733 | 6    | 17     |
         
     | 
| 
       46 
     | 
    
         
            -
                  | W0088 | 7    | 17     |
         
     | 
| 
       47 
44 
     | 
    
         
             
                  | W0733 | 7    | 17     |
         
     | 
| 
       48 
     | 
    
         
            -
                  | W0088 | 8    | 17     |
         
     | 
| 
       49 
45 
     | 
    
         
             
                  | W0733 | 8    | 17     |
         
     | 
| 
       50 
     | 
    
         
            -
                  | W0088 | 9    | 17     |
         
     | 
| 
       51 
46 
     | 
    
         
             
                  | W0733 | 9    | 17     |
         
     | 
| 
       52 
47 
     | 
    
         
             
                  | W0508 | 11   | 18     |
         
     | 
| 
       53 
48 
     | 
    
         
             
                  | W0733 | 11   | 18     |
         
     | 
| 
         @@ -106,15 +101,10 @@ Feature: W0733 
     | 
|
| 
       106 
101 
     | 
    
         
             
                  | W0104 | 1    | 29     |
         
     | 
| 
       107 
102 
     | 
    
         
             
                  | W0104 | 1    | 43     |
         
     | 
| 
       108 
103 
     | 
    
         
             
                  | W0629 | 1    | 13     |
         
     | 
| 
       109 
     | 
    
         
            -
                  | W0088 | 5    | 18     |
         
     | 
| 
       110 
104 
     | 
    
         
             
                  | W0733 | 5    | 18     |
         
     | 
| 
       111 
     | 
    
         
            -
                  | W0088 | 6    | 18     |
         
     | 
| 
       112 
105 
     | 
    
         
             
                  | W0733 | 6    | 18     |
         
     | 
| 
       113 
     | 
    
         
            -
                  | W0088 | 7    | 17     |
         
     | 
| 
       114 
106 
     | 
    
         
             
                  | W0733 | 7    | 17     |
         
     | 
| 
       115 
     | 
    
         
            -
                  | W0088 | 8    | 17     |
         
     | 
| 
       116 
107 
     | 
    
         
             
                  | W0733 | 8    | 17     |
         
     | 
| 
       117 
     | 
    
         
            -
                  | W0088 | 9    | 17     |
         
     | 
| 
       118 
108 
     | 
    
         
             
                  | W0733 | 9    | 17     |
         
     | 
| 
       119 
109 
     | 
    
         
             
                  | W0508 | 11   | 18     |
         
     | 
| 
       120 
110 
     | 
    
         
             
                  | W0733 | 11   | 18     |
         
     | 
| 
         @@ -154,9 +144,4 @@ Feature: W0733 
     | 
|
| 
       154 
144 
     | 
    
         
             
                  | W0104 | 1    | 36     |
         
     | 
| 
       155 
145 
     | 
    
         
             
                  | W0104 | 1    | 43     |
         
     | 
| 
       156 
146 
     | 
    
         
             
                  | W0629 | 1    | 13     |
         
     | 
| 
       157 
     | 
    
         
            -
                  | W0088 | 6    | 18     |
         
     | 
| 
       158 
     | 
    
         
            -
                  | W0088 | 9    | 17     |
         
     | 
| 
       159 
     | 
    
         
            -
                  | W0088 | 10   | 18     |
         
     | 
| 
       160 
     | 
    
         
            -
                  | W0088 | 13   | 18     |
         
     | 
| 
       161 
     | 
    
         
            -
                  | W0088 | 14   | 18     |
         
     | 
| 
       162 
147 
     | 
    
         
             
                  | W0628 | 1    | 13     |
         
     |