Skip to content

Reading/writing goto binaries: consistently use return values #7643

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

tautschnig
Copy link
Collaborator

Always use the return value to communicate errors, not a mix of return values and exceptions.

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

@codecov
Copy link

codecov bot commented Apr 3, 2023

Codecov Report

❌ Patch coverage is 31.57895% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.39%. Comparing base (2e6200a) to head (3b0409b).

Files with missing lines Patch % Lines
src/goto-programs/write_goto_binary.cpp 9.09% 10 Missing ⚠️
src/goto-harness/goto_harness_parse_options.cpp 25.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #7643      +/-   ##
===========================================
- Coverage    80.39%   80.39%   -0.01%     
===========================================
  Files         1688     1688              
  Lines       207403   207411       +8     
  Branches        73       73              
===========================================
+ Hits        166749   166751       +2     
- Misses       40654    40660       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

message.error() << "version " << version << " no longer supported; "
<< "supported version = " << GOTO_BINARY_VERSION
<< messaget::eom;
return true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this an improvement?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using return values rather than exceptions? I'd argue yes for two reasons:

  1. It is consistent across reading (which already did this) and writing (which now does this) goto binaries.
  2. Using return values to communicate errors makes it easier to build (cross-language) APIs.

@tautschnig tautschnig force-pushed the cleanup/rw-goto-binary-return-value branch from 8996b67 to d694622 Compare May 15, 2023 10:54
@tautschnig tautschnig force-pushed the cleanup/rw-goto-binary-return-value branch from d694622 to 140a0f0 Compare July 28, 2025 11:37
Always use the return value to communicate errors, not a mix of return
values and exceptions.
@tautschnig tautschnig force-pushed the cleanup/rw-goto-binary-return-value branch from 140a0f0 to 3b0409b Compare July 28, 2025 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants