Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Submit feedback
  • Sign in
S
src
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 75
    • Issues 75
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 7
    • Merge Requests 7
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • OPAL
  • src
  • Issues
  • #62

Closed
Open
Opened Mar 16, 2017 by snuverink_j@snuverink_j
  • Report abuse
  • New issue
Report abuse New issue

Static code analysis of OPAL

I have run the OPAL source code through the static analysis tool cppcheck (http://cppcheck.sourceforge.net/). The log is attached (cppcheck v2.0 - updated 12-05-2020, commit 25478b1e).

I started using it after I lost access to Coverity, which I had access to at CERN and which I found quite useful. Cppcheck is also quite good, but not so extensive and has no GUI.

Just as an example, memory leaks are flagged sometimes since there is a leak in one of the logical branches:

[src/Classic/AbsBeamline/Cyclotron.cpp:931]: (error) Resource leak: f

The line reads:

931: CHECK_CYC_FSCANF_EOF(fscanf(f, "%lf", &BP.rmin));

Since CHECK_CYC_FSCANF_EOF can throw, f is leaked in that case. But I would say this is (close to) a false positive, and doesn't need fixing. Other things that are flagged are somewhat personal style. But often these can also indicate bugs or typos. In general there are few false positives.

The log file contains certainly some things I think should be fixed like the usual uninitialised members, unused variables, etc. And others that I would leave. There are different categories. I fixed most of the few errors it found in src/src (see 4359206a).

Over time, I plan to go through, fix some of the simpler and more serious ones, make separate issues for the more complicated ones and rerun.

Please have a look if there are any issues in the code parts that you are maintaining.

Edited May 12, 2020 by snuverink_j
To upload designs, you'll need to enable LFS. More information

Linked issues

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
1
Labels
Enhancement
Assign labels
  • View project labels
Reference: OPAL/src#62