Skip to content

GitLab

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

Closed
Open
Created Mar 16, 2017 by snuverink_j@snuverink_jDeveloper

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.4.1 - updated 18-06-2021, commit 052a732c).

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 Jun 18, 2021 by snuverink_j
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking