Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Spot Spot
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 132
    • Issues 132
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 1
    • Merge requests 1
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • SpotSpot
  • SpotSpot
  • Issues
  • #184
Closed
Open
Issue created Jul 20, 2016 by Alexandre Duret-Lutz@adlOwner4 of 4 checklist items completed4/4 checklist items

assert in headers

Even if the installed library has been compiled with -DNDEBUG, some of the installed header have inline functions with assert() that are injected into any code using Spot, but compiled with -DNDEBUG.

Is this desirable?

One example is in graph.hh, where most very low-level functions like edge_storage() and state_storage() first do something like assert(s < edges_.size()); return edges_[s];. This is checked every time we access a transition, and unfortunately computation of edges_.size() involves a division by 20 (the size of an edge) on my system.

A loop like

    for (auto& e: aut->out(s))
         f(e.dst);

would have to recompute edges_.size() at each iteration (in case f() changed it).

I would suggest to drop those very frequent asserts, and just rely -D_GLIBCXX_DEBUG when we need to troubleshoot STL containers.

For other assert() that appear in public header, we should probably wrap them in a SPOT_ASSERT() macro that is disabled in releases. Plus relevant sanity checks to forbid assert() in headers.

  • add an --enable-glibcxx-debug configure option, and document it
  • configure one of the builds on teamcity to use that option
  • get rid of assert() that can be done by -D_GLIBCXX_DEBUG such as those in edge_storage() and state_storage()
  • introduce a SPOT_ASSERT() macro, use it, and add a sanity check to prevent the introduction of assert in headers
Edited Aug 02, 2017 by Alexandre Duret-Lutz
Assignee
Assign to
Time tracking