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 394
    • Issues 394
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 17
    • Merge requests 17
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • sac-group
  • sac2csac2c
  • Merge requests
  • !372

Add source code print out to error messages

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Quinten Cabo requested to merge Quinten/sac2c:print-source-code-in-errors into develop Mar 31, 2025
  • Overview 18
  • Commits 3
  • Changes 7

Add source code print out with line numbers and an arrow pointing to the column where the error happened. These source code print outs can be disabled using the -cti-no-source flag.

The -cti-single-line flag implies -cti-no-source.

Example

int main () {
    a = fooo('3');
    return 137;
}

Will give:

**  1: Loading SAC program ...
**  2: Preprocessing type patterns ...
**  3: Preprocessing SAC program ...
**  4: Running module system ...
**  5: Simplifying source code ...
**  6: Converting to static single assignment form ...
./Simple.sac:2:9: abort:
  1. int main () {
  2.     a = fooo('3');
              ↑
  3.     return 137;
  4. }
  
  No definition found for a function "_MAIN::fooo" that expects 1 argument(s) and yields 1 return value(s)
Compilation failed while Converting to static single assignment form.
Edited Mar 31, 2025 by Quinten Cabo
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: print-source-code-in-errors