Skip to content

Commit b5b1f64

Browse files
author
Sonny Martin
committed
Address review comments - Kroening
Removed previously disabled checks: Not every instruction has a code member - so removed checks that both instruction sourcelocation and code sourcelocation are set and identical Remove also remaining check that every instruction have a non-nil sourcelocation as this would have to be optional (if enabled fails many regression tests). This also simplifies considerably the overall validation pass (removes much passing around of the options structure). Removes check on function return type - this will be preserved (diffblue#4266) goto_model::validate now has default parameters. Minor fixes.
1 parent 971c788 commit b5b1f64

6 files changed

+10
-21
lines changed

src/goto-programs/goto_function.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@ void get_local_identifiers(
3333
///
3434
/// The validation mode indicates whether well-formedness check failures are
3535
/// reported via DATA_INVARIANT violations or exceptions.
36-
void goto_functiont::validate(
37-
const namespacet &ns,
38-
const validation_modet vm) const
36+
void goto_functiont::validate(const namespacet &ns, const validation_modet vm)
37+
const
3938
{
4039
// function body must end with an END_FUNCTION instruction
4140
if(body_available())

src/goto-programs/goto_function.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,7 @@ class goto_functiont
119119
///
120120
/// The validation mode indicates whether well-formedness check failures are
121121
/// reported via DATA_INVARIANT violations or exceptions.
122-
void validate(
123-
const namespacet &ns,
124-
const validation_modet vm) const;
122+
void validate(const namespacet &ns, const validation_modet vm) const;
125123
};
126124

127125
void get_local_identifiers(const goto_functiont &, std::set<irep_idt> &dest);

src/goto-programs/goto_functions.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,7 @@ class goto_functionst
111111
///
112112
/// The validation mode indicates whether well-formedness check failures are
113113
/// reported via DATA_INVARIANT violations or exceptions.
114-
void validate(
115-
const namespacet &ns,
116-
const validation_modet vm) const
114+
void validate(const namespacet &ns, const validation_modet vm) const
117115
{
118116
for(const auto &entry : function_map)
119117
{

unit/goto-programs/goto_program_symbol_type_table_consistency.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ SCENARIO(
5151

5252
THEN("The consistency check succeeds")
5353
{
54-
goto_function.validate(
55-
ns, validation_modet::INVARIANT);
54+
goto_function.validate(ns, validation_modet::INVARIANT);
5655

5756
REQUIRE(true);
5857
}
@@ -67,8 +66,7 @@ SCENARIO(
6766
THEN("The consistency check fails")
6867
{
6968
REQUIRE_THROWS_AS(
70-
goto_function.validate(
71-
ns, validation_modet::EXCEPTION),
69+
goto_function.validate(ns, validation_modet::EXCEPTION),
7270
incorrect_goto_program_exceptiont);
7371
}
7472
}

unit/goto-programs/goto_program_table_consistency.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ SCENARIO(
4949
const namespacet ns(symbol_table);
5050
THEN("The consistency check succeeds")
5151
{
52-
goto_function.validate(
53-
ns, validation_modet::INVARIANT);
52+
goto_function.validate(ns, validation_modet::INVARIANT);
5453
REQUIRE(true);
5554
}
5655
}
@@ -60,8 +59,7 @@ SCENARIO(
6059
THEN("The consistency check fails")
6160
{
6261
REQUIRE_THROWS_AS(
63-
goto_function.validate(
64-
ns, validation_modet::EXCEPTION),
62+
goto_function.validate(ns, validation_modet::EXCEPTION),
6563
incorrect_goto_program_exceptiont);
6664
}
6765
}

unit/goto-programs/goto_program_validate.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,7 @@ SCENARIO("Validation of a goto program", "[core][goto-programs][validate]")
357357
namespacet ns(goto_model.symbol_table);
358358

359359
REQUIRE_THROWS_AS(
360-
function_f.validate(
361-
ns, validation_modet::EXCEPTION),
360+
function_f.validate(ns, validation_modet::EXCEPTION),
362361
incorrect_goto_program_exceptiont);
363362
}
364363
}
@@ -372,8 +371,7 @@ SCENARIO("Validation of a goto program", "[core][goto-programs][validate]")
372371

373372
namespacet ns(goto_model.symbol_table);
374373

375-
REQUIRE_NOTHROW(function_f.validate(
376-
ns, validation_modet::EXCEPTION));
374+
REQUIRE_NOTHROW(function_f.validate(ns, validation_modet::EXCEPTION));
377375
}
378376
}
379377
}

0 commit comments

Comments
 (0)