Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-64612

clang-tidy warnigns are reported as gcc warnings

XMLWordPrintable

      From a quick look it looks like recent gcc warnings are formatted as: 

      <file>:<line>:<column>: warning: <message> [-W<warning_command>]

      while clang-tidy warnings are formatted as:

      <file>:<line>:<column>: warning: <message> [<clang-tidy check>]

      So gcc warnings can be differentiated by the "-W".

      My understanding of https://github.com/jenkinsci/analysis-model/blob/master/src/main/java/edu/hm/hafner/analysis/parser/Gcc4CompilerParser.java#L23 is that it accepts lines with anything after "warning: ". Looking in https://godbolt.org/ it looks like the "[-W<warning_command>]" was not added until gcc 4.6, which would explain this.

      So maybe there is a need for a new "gcc46+" "tool" in Warnings NG / parser in analysis-model?

      Additionally, looking in godbolt, I see clang has used the exact same 

      <file>:<line>:<column>: warning: <message> [-W<warning_command>]

      format since at least clang 3.0.0 (the oldest available version in godbolt). But

      • The clang tool also includes clang-tdy warnings
      • In my codebase (building for multiple toolchains, mostly gcc-based but also for Android/clang) the clang tool reports 58 warnings while the gcc4 tool reports 119 warnings
      • The parsers in analysis model are very different (one based on RegexpLineParser and the other on LookaheadParser) 

      Since I mix clang and gcc builds in my Jenkins jobs, and given that the gcc and clang formats seem to have been identical at least since 2011 (gcc 4.6.0 and clang 3.0 releases) it would be nice if I could use a single "modern gcc/clang" tool to detect the warnings of both.

            Unassigned Unassigned
            reddwarf94 Cristian
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: