• Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • None
    • HUDSON 1.360 with latest warning plugin

      Hi,

      I created a very basic hudson project which is checking out 1 single file and compiling it with the following option:

      gcc -Wall test.c

      with test.c

      1 #include <stdio.h>
      2 
      3 int main()
      4 {
      5     unsigned int i; 
      6     return 0; 
      7 } 
      

      => when using warning pluging / gcc parser, it gives me 1 warning which is fine:
      File: test.c, Line: 5, Type: gcc, Priority: Normal
      unused variable 'i'

      Then I add 1 empty line at line 2 and 1 function with 1 new warning at the end of the file (I would be expecting 1 new warning, 2 warnings in total)

      01 #include <stdio.h>
      02 
      03 
      04 int main()
      05 {
      06     unsigned int i;
      07     return 0;
      08 }
      09 
      10 int tmp()
      11 {
      12     unsigned int i;
      13     return 0;
      14 }
      

      it now gives me:

      All Warnings New Warnings Fixed Warnings
      2 2 1

      With:

      Details:

      • File: test.c, Line: 6, Type: gcc, Priority: Normal
        unused variable 'i'
      • File: test.c, Line: 12, Type: gcc, Priority: Normal
        unused variable 'i'

      New:

      • File: test.c, Line: 12, Type: gcc, Priority: Normal
        unused variable 'i'
      • File: test.c, Line: 6, Type: gcc, Priority: Normal
        unused variable 'i'

      Fixed:
      File Warning Type
      test.c gcc

      We only have 1 new warning, and no fixed warning.
      So the total is OK, but not the new/fixed count

        1. test.c.2
          0.1 kB
        2. test.c.1
          0.1 kB

          [JENKINS-6675] Invalid number of new warnings detected

          xavierhanin created issue -
          xavierhanin made changes -
          Attachment New: test.c.1 [ 19474 ]
          Attachment New: test.c.2 [ 19475 ]
          xavierhanin made changes -
          Description Original: Hi,

          I created a very basic hudson project which is checking out 1 single file and compiling it with the following option:

          gcc -Wall test.c

          with test.c

          1 #include <stdio.h>
          2
          3 int main()
          4 {
          5 unsigned int i;
          6 return 0;
          7 }

          => when using warning pluging / gcc parser, it gives me 1 warning which is fine:
          - File: test.c, Line: 5, Type: gcc, Priority: Normal
            unused variable 'i'

          Then I add 1 empty line at line 2 and 1 function with 1 new warning at the end of the file (I would be expecting 1 new warning, 2 warnings in total)

          01 #include <stdio.h>
          02
          03
          04 int main()
          05 {
          06 unsigned int i;
          07 return 0;
          08 }
          09
          10 int tmp()
          11 {
          12 unsigned int i;
          13 return 0;
          14 }

          it now gives me:

          All Warnings New Warnings Fixed Warnings
          2 2 1

          With:

          Details:
          - File: test.c, Line: 6, Type: gcc, Priority: Normal
          unused variable 'i'
          - File: test.c, Line: 12, Type: gcc, Priority: Normal
          unused variable 'i'

          New:
          - File: test.c, Line: 12, Type: gcc, Priority: Normal
          unused variable 'i'
          - File: test.c, Line: 6, Type: gcc, Priority: Normal
          unused variable 'i'

          Fixed:
          File Warning Type
          test.c gcc

          We only have 1 new warning, and no fixed warning.
          So the total is OK, but not the new/fixed count
          New: Hi,

          I created a very basic hudson project which is checking out 1 single file and compiling it with the following option:

          gcc -Wall test.c

          with test.c

          1 #include <stdio.h>
          2
          3 int main()
          4 {
          5 unsigned int i;
          6 return 0;
          7 }

          => when using warning pluging / gcc parser, it gives me 1 warning which is fine:
          - File: test.c, Line: 5, Type: gcc, Priority: Normal
            unused variable 'i'

          Then I add 1 empty line at line 2 and 1 function with 1 new warning at the end of the file (I would be expecting 1 new warning, 2 warnings in total)

          01 #include <stdio.h>
          02
          03
          04 int main()
          05 {
          06 unsigned int i;
          07 return 0;
          08 }
          09
          10 int tmp()
          11 {
          12 unsigned int i;
          13 return 0;
          14 }

          it now gives me:

          All Warnings New Warnings Fixed Warnings
          2 2 1

          With:

          Details:
          - File: test.c, Line: 6, Type: gcc, Priority: Normal
          unused variable 'i'
          - File: test.c, Line: 12, Type: gcc, Priority: Normal
          unused variable 'i'

          New:
          - File: test.c, Line: 12, Type: gcc, Priority: Normal
          unused variable 'i'
          - File: test.c, Line: 6, Type: gcc, Priority: Normal
          unused variable 'i'

          Fixed:
          File Warning Type
          test.c gcc

          We only have 1 new warning, and no fixed warning.
          So the total is OK, but not the new/fixed count

          xavierhanin added a comment -

          trying to have code displayed properly

          xavierhanin added a comment - trying to have code displayed properly
          xavierhanin made changes -
          Description Original: Hi,

          I created a very basic hudson project which is checking out 1 single file and compiling it with the following option:

          gcc -Wall test.c

          with test.c

          1 #include <stdio.h>
          2
          3 int main()
          4 {
          5 unsigned int i;
          6 return 0;
          7 }

          => when using warning pluging / gcc parser, it gives me 1 warning which is fine:
          - File: test.c, Line: 5, Type: gcc, Priority: Normal
            unused variable 'i'

          Then I add 1 empty line at line 2 and 1 function with 1 new warning at the end of the file (I would be expecting 1 new warning, 2 warnings in total)

          01 #include <stdio.h>
          02
          03
          04 int main()
          05 {
          06 unsigned int i;
          07 return 0;
          08 }
          09
          10 int tmp()
          11 {
          12 unsigned int i;
          13 return 0;
          14 }

          it now gives me:

          All Warnings New Warnings Fixed Warnings
          2 2 1

          With:

          Details:
          - File: test.c, Line: 6, Type: gcc, Priority: Normal
          unused variable 'i'
          - File: test.c, Line: 12, Type: gcc, Priority: Normal
          unused variable 'i'

          New:
          - File: test.c, Line: 12, Type: gcc, Priority: Normal
          unused variable 'i'
          - File: test.c, Line: 6, Type: gcc, Priority: Normal
          unused variable 'i'

          Fixed:
          File Warning Type
          test.c gcc

          We only have 1 new warning, and no fixed warning.
          So the total is OK, but not the new/fixed count
          New: Hi,

          I created a very basic hudson project which is checking out 1 single file and compiling it with the following option:

          gcc -Wall test.c

          with test.c

          1 #include <stdio.h>
          2
          3 int main()
          4 {
          5 unsigned int i;
          6 return 0;
          7 }

          => when using warning pluging / gcc parser, it gives me 1 warning which is fine:
          - File: test.c, Line: 5, Type: gcc, Priority: Normal
            unused variable 'i'

          Then I add 1 empty line at line 2 and 1 function with 1 new warning at the end of the file (I would be expecting 1 new warning, 2 warnings in total)

          01 #include <stdio.h>
          02
          03
          04 int main()
          05 {
          06 unsigned int i;
          07 return 0;
          08 }
          09
          10 int tmp()
          11 {
          12 unsigned int i;
          13 return 0;
          14 }

          it now gives me:

          All Warnings New Warnings Fixed Warnings
          2 2 1

          With:

          Details:
          - File: test.c, Line: 6, Type: gcc, Priority: Normal
          unused variable 'i'
          - File: test.c, Line: 12, Type: gcc, Priority: Normal
          unused variable 'i'

          New:
          - File: test.c, Line: 12, Type: gcc, Priority: Normal
          unused variable 'i'
          - File: test.c, Line: 6, Type: gcc, Priority: Normal
          unused variable 'i'

          Fixed:
          File Warning Type
          test.c gcc

          We only have 1 new warning, and no fixed warning.
          So the total is OK, but not the new/fixed count
          Ulli Hafner made changes -
          Description Original: Hi,

          I created a very basic hudson project which is checking out 1 single file and compiling it with the following option:

          gcc -Wall test.c

          with test.c

          1 #include <stdio.h>
          2
          3 int main()
          4 {
          5 unsigned int i;
          6 return 0;
          7 }

          => when using warning pluging / gcc parser, it gives me 1 warning which is fine:
          - File: test.c, Line: 5, Type: gcc, Priority: Normal
            unused variable 'i'

          Then I add 1 empty line at line 2 and 1 function with 1 new warning at the end of the file (I would be expecting 1 new warning, 2 warnings in total)

          01 #include <stdio.h>
          02
          03
          04 int main()
          05 {
          06 unsigned int i;
          07 return 0;
          08 }
          09
          10 int tmp()
          11 {
          12 unsigned int i;
          13 return 0;
          14 }

          it now gives me:

          All Warnings New Warnings Fixed Warnings
          2 2 1

          With:

          Details:
          - File: test.c, Line: 6, Type: gcc, Priority: Normal
          unused variable 'i'
          - File: test.c, Line: 12, Type: gcc, Priority: Normal
          unused variable 'i'

          New:
          - File: test.c, Line: 12, Type: gcc, Priority: Normal
          unused variable 'i'
          - File: test.c, Line: 6, Type: gcc, Priority: Normal
          unused variable 'i'

          Fixed:
          File Warning Type
          test.c gcc

          We only have 1 new warning, and no fixed warning.
          So the total is OK, but not the new/fixed count
          New: Hi,

          I created a very basic hudson project which is checking out 1 single file and compiling it with the following option:

          gcc -Wall test.c

          with test.c

          {code}
          1 #include <stdio.h>
          2
          3 int main()
          4 {
          5 unsigned int i;
          6 return 0;
          7 }
          {code}

          => when using warning pluging / gcc parser, it gives me 1 warning which is fine:
          File: test.c, Line: 5, Type: gcc, Priority: Normal
          unused variable 'i'

          Then I add 1 empty line at line 2 and 1 function with 1 new warning at the end of the file (I would be expecting 1 new warning, 2 warnings in total)

          {code}
          01 #include <stdio.h>
          02
          03
          04 int main()
          05 {
          06 unsigned int i;
          07 return 0;
          08 }
          09
          10 int tmp()
          11 {
          12 unsigned int i;
          13 return 0;
          14 }
          {code}
          it now gives me:

          All Warnings New Warnings Fixed Warnings
          2 2 1

          With:

          Details:
          - File: test.c, Line: 6, Type: gcc, Priority: Normal
          unused variable 'i'
          - File: test.c, Line: 12, Type: gcc, Priority: Normal
          unused variable 'i'

          New:
          - File: test.c, Line: 12, Type: gcc, Priority: Normal
          unused variable 'i'
          - File: test.c, Line: 6, Type: gcc, Priority: Normal
          unused variable 'i'

          Fixed:
          File Warning Type
          test.c gcc

          We only have 1 new warning, and no fixed warning.
          So the total is OK, but not the new/fixed count

          Ulli Hafner added a comment -

          A warning is considered only the same if the source code above and below (3 lines) does not change.

          Ulli Hafner added a comment - A warning is considered only the same if the source code above and below (3 lines) does not change.

          xavierhanin added a comment -

          Therefore I believe there's not much to do if the target is to keep this rule simple.

          Maybe removing the emtpy lines/spaces/tabs from the hash calculation or whatever mean is used to check for the delta between versions could help in reducing this false positives.

          Anyway, thanks for the info Drulli.

          I guess if a file is modified, all warnings should be fixed to avoid such reports.

          Best Regards,

          Xavier.

          xavierhanin added a comment - Therefore I believe there's not much to do if the target is to keep this rule simple. Maybe removing the emtpy lines/spaces/tabs from the hash calculation or whatever mean is used to check for the delta between versions could help in reducing this false positives. Anyway, thanks for the info Drulli. I guess if a file is modified, all warnings should be fixed to avoid such reports. Best Regards, Xavier.
          Ulli Hafner made changes -
          Priority Original: Major [ 3 ] New: Trivial [ 5 ]
          Ulli Hafner made changes -
          Link New: This issue is related to JENKINS-24873 [ JENKINS-24873 ]

            drulli Ulli Hafner
            xavierhanin xavierhanin
            Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: