Skip to content

Cleanup of throws and asserts of goto_convert.cpp #2905

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

Merged
merged 5 commits into from
Sep 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions regression/ansi-c/goto_convert_break/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
int main()
{
break;
return 0;
}
8 changes: 8 additions & 0 deletions regression/ansi-c/goto_convert_break/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c

^EXIT=1$
^SIGNAL=0$
^CONVERSION ERROR$
--
^warning: ignoring
5 changes: 5 additions & 0 deletions regression/ansi-c/goto_convert_continue/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
int main()
{
continue;
return 0;
}
8 changes: 8 additions & 0 deletions regression/ansi-c/goto_convert_continue/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c

^EXIT=1$
^SIGNAL=0$
^CONVERSION ERROR$
--
^warning: ignoring
8 changes: 8 additions & 0 deletions regression/ansi-c/goto_convert_invalid_goto_label/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
int main()
{
goto x;

// x:

return 0;
}
8 changes: 8 additions & 0 deletions regression/ansi-c/goto_convert_invalid_goto_label/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c

^CONVERSION ERROR$
^EXIT=1$
^SIGNAL=0$
--
^warning: ignoring
13 changes: 13 additions & 0 deletions regression/ansi-c/goto_convert_switch_range_bounds/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
int main()
{
int x;
int n = 5;
switch(x)
{
case 0 ... n:
break;
default:
break;
}
return 0;
}
8 changes: 8 additions & 0 deletions regression/ansi-c/goto_convert_switch_range_bounds/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c

^CONVERSION ERROR$
^EXIT=1$
^SIGNAL=0$
--
^warning: ignoring
16 changes: 16 additions & 0 deletions regression/ansi-c/goto_convert_switch_range_case_valid/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <assert.h>

#define false 0

int main(void)
{
int x = 5;
switch (x)
{
case 0 ... 10:
break;
default:
assert(false);
break;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c

^EXIT=0$
^SIGNAL=0$
--
^warning: ignoring
^Invariant check failed
12 changes: 12 additions & 0 deletions regression/ansi-c/goto_convert_switch_range_empty/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
int main()
{
int x;
switch(x)
{
case 10 ... 0:
break;
default:
break;
}
return 0;
}
8 changes: 8 additions & 0 deletions regression/ansi-c/goto_convert_switch_range_empty/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
KNOWNBUG
main.c

^EXIT=0$
^SIGNAL=0$
--
^warning: ignoring
^Invariant check failed
12 changes: 12 additions & 0 deletions regression/ansi-c/goto_convert_switch_range_operands_count/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
int main()
{
int x;
switch(x)
{
case 0 ... 10 20:
break;
default:
break;
}
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c

^EXIT=1$
^SIGNAL=0$
^PARSING ERROR$
--
^warning: ignoring
7 changes: 7 additions & 0 deletions src/cbmc/cbmc_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Author: Daniel Kroening, [email protected]
#include <memory>

#include <util/config.h>
#include <util/exception_utils.h>
#include <util/exit_codes.h>
#include <util/invariant.h>
#include <util/unicode.h>
Expand Down Expand Up @@ -611,6 +612,12 @@ int cbmc_parse_optionst::get_goto_program(
log.status() << config.object_bits_info() << log.eom;
}

catch(incorrect_goto_program_exceptiont &e)
{
log.error() << e.what() << log.eom;
return CPROVER_EXIT_EXCEPTION;
}

catch(const char *e)
{
log.error() << e << log.eom;
Expand Down
Loading