Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • sac2c sac2c
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 393
    • Issues 393
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 15
    • Merge requests 15
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • sac-group
  • sac2csac2c
  • Issues
  • #2286
Closed
Open
Created Jan 30, 2022 by Sven-Bodo Scholz@sbsOwner

C compiler issues warnings on wrapper functions

My latest compiler (clang 12) complains about our wrapper codes.

As a frequent pattern, they generate code like this

int res;

if (cond) {
   res = fun();
} else {
   SAC_RuntimeError ( "type error.....");
}

return res;

The compiler complains about res potentially not being initialised.

We have two options ere: either initialise res with some dummy value, or declare SAC_RuntimeError to be non-returning. I would prefer the latter, but I am not sure how to do this in a platform (C compiler) - independent way. My clang compiler allows for:

_Noreturn void SAC_RuntimeError( ...);

This seems to be C++11 standard as well..... but I guess we may have to go through cmake to make this happen.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking