-
Notifications
You must be signed in to change notification settings - Fork 277
RFC: handling of fatal errors #1280
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
Closed
peterschrammel
wants to merge
4
commits into
diffblue:develop
from
peterschrammel:feature/more-exception-types
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/*******************************************************************\ | ||
|
||
Module: Exception helper utilities | ||
|
||
Author: Peter Schrammel, peter.schrammel@diffblue.com | ||
|
||
\*******************************************************************/ | ||
|
||
#ifndef CPROVER_UTIL_EXCEPTION_UTILS_H | ||
#define CPROVER_UTIL_EXCEPTION_UTILS_H | ||
|
||
#include "invariant.h" | ||
|
||
/// A logic error to be used for OS-related errors (I/O etc) | ||
class system_exceptiont: public std::logic_error | ||
{ | ||
public: | ||
system_exceptiont( | ||
const std::string &_reason): | ||
std::logic_error(_reason) | ||
{ | ||
} | ||
}; | ||
|
||
/// A logic error to be used for user interface errors | ||
class ui_exceptiont: public std::logic_error | ||
{ | ||
public: | ||
ui_exceptiont( | ||
const std::string &_reason): | ||
std::logic_error(_reason) | ||
{ | ||
} | ||
}; | ||
|
||
/// A user interface exception with source locations | ||
class input_src_exceptiont: public ui_exceptiont | ||
{ | ||
public: | ||
input_src_exceptiont( | ||
const source_locationt &_source_location, | ||
const std::string &_reason): | ||
ui_exceptiont(_reason), | ||
source_location(_source_location) | ||
{ | ||
} | ||
|
||
source_locationt source_location; | ||
}; | ||
|
||
#endif // CPROVER_UTIL_EXCEPTION_UTILS_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ Author: Daniel Kroening, kroening@kroening.com | |
#include <string> | ||
|
||
#include "cmdline.h" | ||
#include "message.h" | ||
|
||
class parse_options_baset | ||
{ | ||
|
@@ -35,4 +36,23 @@ class parse_options_baset | |
bool parse_result; | ||
}; | ||
|
||
class parse_optionst: public parse_options_baset | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we could remove |
||
{ | ||
public: | ||
parse_optionst( | ||
const std::string &optstring, | ||
int argc, | ||
const char **argv, | ||
message_handlert &message_handler): | ||
parse_options_baset(optstring, argc, argv), | ||
message(message_handler) | ||
{ | ||
} | ||
|
||
int main() override; | ||
|
||
protected: | ||
messaget message; | ||
}; | ||
|
||
#endif // CPROVER_UTIL_PARSE_OPTIONS_H |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since all these exceptions are fatal and shouldn't be caught anywhere else, I wonder whether we should include the exit code in the exceptions. Then the different catch clauses would return via
return e.exit_code()
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that could make some sense.