Skip to content

Commit b9fd0af

Browse files
committed
Harness option parser is a namespace
not a class: its methods are not static and we do not inherit from it.
1 parent 72285b3 commit b9fd0af

6 files changed

+37
-29
lines changed

src/goto-harness/function_call_harness_generator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void function_call_harness_generatort::handle_option(
9191
const std::list<std::string> &values)
9292
{
9393
auto &require_exactly_one_value =
94-
harness_options_parsert::require_exactly_one_value;
94+
harness_options_parser::require_exactly_one_value;
9595

9696
if(p_impl->recursive_initialization_config.handle_option(option, values))
9797
{

src/goto-harness/goto_harness_generator.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ Author: Diffblue Ltd.
1515
#include <util/invariant.h>
1616
#include <util/string2int.h>
1717

18-
std::string harness_options_parsert::require_exactly_one_value(
18+
// NOLINTNEXTLINE(readability/namespace)
19+
namespace harness_options_parser
20+
{
21+
std::string require_exactly_one_value(
1922
const std::string &option,
2023
const std::list<std::string> &values)
2124
{
@@ -28,14 +31,14 @@ std::string harness_options_parsert::require_exactly_one_value(
2831
return values.front();
2932
}
3033

31-
void harness_options_parsert::assert_no_values(
34+
void assert_no_values(
3235
const std::string &option,
3336
const std::list<std::string> &values)
3437
{
3538
PRECONDITION_WITH_DIAGNOSTICS(values.empty(), option);
3639
}
3740

38-
std::size_t harness_options_parsert::require_one_size_value(
41+
std::size_t require_one_size_value(
3942
const std::string &option,
4043
const std::list<std::string> &values)
4144
{
@@ -51,3 +54,5 @@ std::size_t harness_options_parsert::require_one_size_value(
5154
"failed to parse `" + string_value + "' as integer", "--" + option};
5255
}
5356
}
57+
// NOLINTNEXTLINE(readability/namespace)
58+
} // namespace harness_options_parser

src/goto-harness/goto_harness_generator.h

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,27 @@ Author: Diffblue Ltd.
1616

1717
class goto_modelt;
1818

19-
class harness_options_parsert
19+
// NOLINTNEXTLINE(readability/namespace)
20+
namespace harness_options_parser
2021
{
21-
public:
22-
/// Returns the only value of a single element list,
23-
/// throws an exception if not passed a single element list
24-
static std::string require_exactly_one_value(
25-
const std::string &option,
26-
const std::list<std::string> &values);
27-
28-
/// Asserts that the list of values to an option passed is empty
29-
static void assert_no_values(
30-
const std::string &option,
31-
const std::list<std::string> &values);
32-
33-
/// Returns the only Nat value of a single element list,
34-
/// throws an exception if not passed a single element list (or not Nat)
35-
static std::size_t require_one_size_value(
36-
const std::string &option,
37-
const std::list<std::string> &values);
38-
};
22+
/// Returns the only value of a single element list,
23+
/// throws an exception if not passed a single element list
24+
std::string require_exactly_one_value(
25+
const std::string &option,
26+
const std::list<std::string> &values);
27+
28+
/// Asserts that the list of values to an option passed is empty
29+
void assert_no_values(
30+
const std::string &option,
31+
const std::list<std::string> &values);
32+
33+
/// Returns the only Nat value of a single element list,
34+
/// throws an exception if not passed a single element list (or not Nat)
35+
std::size_t require_one_size_value(
36+
const std::string &option,
37+
const std::list<std::string> &values);
38+
// NOLINTNEXTLINE(readability/namespace)
39+
} // namespace harness_options_parser
3940

4041
class goto_harness_generatort
4142
{

src/goto-harness/memory_snapshot_harness_generator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void memory_snapshot_harness_generatort::handle_option(
3333
const std::list<std::string> &values)
3434
{
3535
auto &require_exactly_one_value =
36-
harness_options_parsert::require_exactly_one_value;
36+
harness_options_parser::require_exactly_one_value;
3737
if(recursive_initialization_config.handle_option(option, values))
3838
{
3939
// the option belongs to recursive initialization

src/goto-harness/recursive_initialization.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ bool recursive_initialization_configt::handle_option(
2626
{
2727
if(option == COMMON_HARNESS_GENERATOR_MIN_NULL_TREE_DEPTH_OPT)
2828
{
29-
auto const value = require_exactly_one_value(option, values);
29+
auto const value =
30+
harness_options_parser::require_exactly_one_value(option, values);
3031
auto const user_min_null_tree_depth =
3132
string2optional<std::size_t>(value, 10);
3233
if(user_min_null_tree_depth.has_value())
@@ -43,7 +44,8 @@ bool recursive_initialization_configt::handle_option(
4344
}
4445
else if(option == COMMON_HARNESS_GENERATOR_MAX_NONDET_TREE_DEPTH_OPT)
4546
{
46-
auto const value = require_exactly_one_value(option, values);
47+
auto const value =
48+
harness_options_parser::require_exactly_one_value(option, values);
4749
auto const user_max_nondet_tree_depth =
4850
string2optional<std::size_t>(value, 10);
4951
if(user_max_nondet_tree_depth.has_value())
@@ -60,13 +62,13 @@ bool recursive_initialization_configt::handle_option(
6062
}
6163
else if(option == COMMON_HARNESS_GENERATOR_MAX_ARRAY_SIZE_OPT)
6264
{
63-
max_dynamic_array_size = require_one_size_value(
65+
max_dynamic_array_size = harness_options_parser::require_one_size_value(
6466
COMMON_HARNESS_GENERATOR_MAX_ARRAY_SIZE_OPT, values);
6567
return true;
6668
}
6769
else if(option == COMMON_HARNESS_GENERATOR_MIN_ARRAY_SIZE_OPT)
6870
{
69-
min_dynamic_array_size = require_one_size_value(
71+
min_dynamic_array_size = harness_options_parser::require_one_size_value(
7072
COMMON_HARNESS_GENERATOR_MIN_ARRAY_SIZE_OPT, values);
7173
return true;
7274
}

src/goto-harness/recursive_initialization.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Author: Diffblue Ltd.
2121
#include "function_harness_generator_options.h"
2222
#include "goto_harness_generator.h"
2323

24-
struct recursive_initialization_configt : harness_options_parsert
24+
struct recursive_initialization_configt
2525
{
2626
std::size_t min_null_tree_depth = 1;
2727
std::size_t max_nondet_tree_depth = 2;

0 commit comments

Comments
 (0)