Skip to content
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

Remove uses of char* in app CLI #2911

Merged
merged 13 commits into from
Aug 13, 2024
2 changes: 1 addition & 1 deletion cmd/connectome2tck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ using namespace MR::DWI;
using namespace MR::DWI::Tractography;
using namespace MR::DWI::Tractography::Connectome;

const char *file_outputs[] = {"per_edge", "per_node", "single", NULL};
const std::vector<std::string> file_outputs = {"per_edge", "per_node", "single"};
Lestropie marked this conversation as resolved.
Show resolved Hide resolved

// clang-format off
const OptionGroup TrackOutputOptions = OptionGroup ("Options for determining the content / format of output files")
Expand Down
5 changes: 3 additions & 2 deletions cmd/connectomeedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ using namespace MR::Connectome;
using namespace MR::Math;
using namespace App;

const char *operations[] = {"to_symmetric", "upper_triangular", "lower_triangular", "transpose", "zero_diagonal", NULL};
const std::vector<std::string> operations = {
"to_symmetric", "upper_triangular", "lower_triangular", "transpose", "zero_diagonal"};

// clang-format off
void usage() {
Expand Down Expand Up @@ -73,4 +74,4 @@ void run() {
}

File::Matrix::save_matrix(connectome, output_path);
}
}
2 changes: 1 addition & 1 deletion cmd/connectomestats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ using Math::Stats::matrix_type;
using Math::Stats::vector_type;
using Stats::PermTest::count_matrix_type;

const char *algorithms[] = {"nbs", "tfnbs", "none", nullptr};
const std::vector<std::string> algorithms = {"nbs", "tfnbs", "none"};

// TODO Eventually these will move to some kind of TFCE header
#define TFCE_DH_DEFAULT 0.1
Expand Down
2 changes: 1 addition & 1 deletion cmd/dwi2fod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
using namespace MR;
using namespace App;

const char *const algorithms[] = {"csd", "msmt_csd", NULL};
const std::vector<std::string> algorithms = {"csd", "msmt_csd"};

// clang-format off
const OptionGroup CommonOptions = OptionGroup ("Options common to more than one algorithm")
Expand Down
5 changes: 2 additions & 3 deletions cmd/dwidenoise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@
using namespace MR;
using namespace App;

const char *const dtypes[] = {"float32", "float64", NULL};

const char *const estimators[] = {"exp1", "exp2", NULL};
const std::vector<std::string> dtypes = {"float32", "float64"};
const std::vector<std::string> estimators = {"exp1", "exp2"};

// clang-format off
void usage() {
Expand Down
27 changes: 13 additions & 14 deletions cmd/fixel2voxel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,19 @@ using namespace App;

using Fixel::index_type;

const char *operations[] = {"mean",
"sum",
"product",
"min",
"max",
"absmax",
"magmax",
"count",
"complexity",
"sf",
"dec_unit",
"dec_scaled",
"none",
nullptr};
const std::vector<std::string> operations = {"mean",
"sum",
"product",
"min",
"max",
"absmax",
"magmax",
"count",
"complexity",
"sf",
"dec_unit",
"dec_scaled",
"none"};

// clang-format off

Expand Down
2 changes: 1 addition & 1 deletion cmd/fixelfilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ using namespace MR;
using namespace App;
using namespace MR::Fixel;

const char *const filters[] = {"connect", "smooth", nullptr};
const std::vector<std::string> filters = {"connect", "smooth"};

// clang-format off
void usage() {
Expand Down
2 changes: 1 addition & 1 deletion cmd/labelstats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
using namespace MR;
using namespace App;

const char *field_choices[] = {"mass", "centre", nullptr};
const std::vector<std::string> field_choices = {"mass", "centre"};

// clang-format off
void usage() {
Expand Down
2 changes: 1 addition & 1 deletion cmd/maskfilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ using namespace App;

#define DEFAULT_CLEAN_SCALE 2

const char *filters[] = {"clean", "connect", "dilate", "erode", "fill", "median", nullptr};
const std::vector<std::string> filters = {"clean", "connect", "dilate", "erode", "fill", "median"};

// clang-format off
const OptionGroup CleanOption =
Expand Down
2 changes: 1 addition & 1 deletion cmd/meshconvert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ using namespace MR;
using namespace App;
using namespace MR::Surface;

const char *transform_choices[] = {"first2real", "real2first", "voxel2real", "real2voxel", "fs2real", nullptr};
const std::vector<std::string> transform_choices = {"first2real", "real2first", "voxel2real", "real2voxel", "fs2real"};

// clang-format off
void usage() {
Expand Down
2 changes: 1 addition & 1 deletion cmd/meshfilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ using namespace MR;
using namespace App;
using namespace MR::Surface;

const char *filters[] = {"smooth", NULL};
const std::vector<std::string> filters = {"smooth"};

// clang-format off
const OptionGroup smooth_option = OptionGroup ("Options for mesh smoothing filter")
Expand Down
24 changes: 10 additions & 14 deletions cmd/mrcalc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,13 +480,12 @@ class LoadedImage {

class StackEntry {
public:
StackEntry(const char *entry) : arg(entry), rng_gaussian(false), image_is_complex(false) {}
StackEntry(std::string entry) : arg(std::move(entry)), rng_gaussian(false), image_is_complex(false) {}
Lestropie marked this conversation as resolved.
Show resolved Hide resolved

StackEntry(Evaluator *evaluator_p)
: arg(nullptr), evaluator(evaluator_p), rng_gaussian(false), image_is_complex(false) {}
StackEntry(Evaluator *evaluator_p) : evaluator(evaluator_p), rng_gaussian(false), image_is_complex(false) {}

void load() {
if (!arg)
if (arg.empty())
return;
auto search = image_list.find(arg);
if (search != image_list.end()) {
Expand Down Expand Up @@ -530,10 +529,9 @@ class StackEntry {
}
}
}
arg = nullptr;
}

const char *arg;
std::string arg;

Choose a reason for hiding this comment

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

warning: member variable 'arg' has public visibility [misc-non-private-member-variables-in-classes]

  std::string arg;
              ^

std::shared_ptr<Evaluator> evaluator;

Choose a reason for hiding this comment

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

warning: member variable 'arg' has public visibility [misc-non-private-member-variables-in-classes]

  std::string arg;
              ^

std::shared_ptr<Image<complex_type>> image;
copy_ptr<Math::RNG> rng;
Expand Down Expand Up @@ -898,7 +896,7 @@ void run_operations(const std::vector<StackEntry> &stack) {
if (stack.size() > 2)
throw Exception("too many operands left on stack!");

if (!stack[1].arg)
if (stack[1].arg.empty())
throw Exception("output image not specified");

if (stack[0].is_complex()) {
Expand Down Expand Up @@ -984,14 +982,12 @@ class OpTernary : public OpBase {
void run() {

Choose a reason for hiding this comment

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

warning: function 'run' has cognitive complexity of 62 (threshold 25) [readability-function-cognitive-complexity]

void run() {
     ^
Additional context

cmd/mrcalc.cpp:985: +1, including nesting penalty of 0, nesting level increased to 1

  for (const auto &argument : App::raw_arguments_list) {
  ^

cmd/mrcalc.cpp:987: +2, including nesting penalty of 1, nesting level increased to 2

    if (opt) {
    ^

cmd/mrcalc.cpp:989: +3, including nesting penalty of 2, nesting level increased to 3

      if (opt->is("datatype"))
      ^

cmd/mrcalc.cpp:991: +1, nesting level increased to 3

      else if (opt->is("nthreads"))
           ^

cmd/mrcalc.cpp:993: +1, nesting level increased to 3

      else if (opt->is("force") || opt->is("info") || opt->is("debug") || opt->is("quiet"))
           ^

cmd/mrcalc.cpp:993: +1

      else if (opt->is("force") || opt->is("info") || opt->is("debug") || opt->is("quiet"))
                                                                       ^

cmd/mrcalc.cpp:93: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:100: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:102: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:104: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:106: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:108: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:110: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:117: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:119: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:123: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:125: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:127: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:129: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:136: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:143: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:152: +1, nesting level increased to 3

TERNARY_OP(
^

cmd/mrcalc.cpp:78: expanded from macro 'TERNARY_OP'

  else if (opt->is(#OPTION)) ternary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:159: +1, nesting level increased to 3

TERNARY_OP(
^

cmd/mrcalc.cpp:78: expanded from macro 'TERNARY_OP'

  else if (opt->is(#OPTION)) ternary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:168: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:170: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:174: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:176: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:178: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:182: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:189: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:196: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:203: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:214: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:221: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:228: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:237: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:244: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:251: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:253: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:255: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:262: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:264: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:273: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:275: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:277: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:281: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:283: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:285: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:287: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:289: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:291: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:295: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:297: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:299: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:301: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:303: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:305: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:999: +1, nesting level increased to 3

      else
      ^

cmd/mrcalc.cpp:1002: +1, nesting level increased to 2

    } else {
      ^

Choose a reason for hiding this comment

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

warning: function 'run' has cognitive complexity of 62 (threshold 25) [readability-function-cognitive-complexity]

void run() {
     ^
Additional context

cmd/mrcalc.cpp:984: +1, including nesting penalty of 0, nesting level increased to 1

  for (const auto &argument : App::raw_arguments_list) {
  ^

cmd/mrcalc.cpp:986: +2, including nesting penalty of 1, nesting level increased to 2

    if (opt) {
    ^

cmd/mrcalc.cpp:988: +3, including nesting penalty of 2, nesting level increased to 3

      if (opt->is("datatype"))
      ^

cmd/mrcalc.cpp:990: +1, nesting level increased to 3

      else if (opt->is("nthreads"))
           ^

cmd/mrcalc.cpp:992: +1, nesting level increased to 3

      else if (opt->is("force") || opt->is("info") || opt->is("debug") || opt->is("quiet"))
           ^

cmd/mrcalc.cpp:992: +1

      else if (opt->is("force") || opt->is("info") || opt->is("debug") || opt->is("quiet"))
                                                                       ^

cmd/mrcalc.cpp:93: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:100: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:102: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:104: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:106: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:108: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:110: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:117: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:119: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:123: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:125: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:127: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:129: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:136: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:143: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:152: +1, nesting level increased to 3

TERNARY_OP(
^

cmd/mrcalc.cpp:78: expanded from macro 'TERNARY_OP'

  else if (opt->is(#OPTION)) ternary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:159: +1, nesting level increased to 3

TERNARY_OP(
^

cmd/mrcalc.cpp:78: expanded from macro 'TERNARY_OP'

  else if (opt->is(#OPTION)) ternary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:168: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:170: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:174: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:176: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:178: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:182: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:189: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:196: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:203: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:214: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:221: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:228: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:237: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:244: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:251: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:253: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:255: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:262: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:264: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:273: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:275: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:277: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:281: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:283: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:285: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:287: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:289: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:291: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:295: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:297: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:299: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:301: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:303: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:305: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:998: +1, nesting level increased to 3

      else
      ^

cmd/mrcalc.cpp:1001: +1, nesting level increased to 2

    } else {
      ^

daljit46 marked this conversation as resolved.
Show resolved Hide resolved
std::vector<StackEntry> stack;

Choose a reason for hiding this comment

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

warning: function 'run' has cognitive complexity of 62 (threshold 25) [readability-function-cognitive-complexity]

void run() {
     ^
Additional context

cmd/mrcalc.cpp:985: +1, including nesting penalty of 0, nesting level increased to 1

  for (const auto &argument : App::raw_arguments_list) {
  ^

cmd/mrcalc.cpp:987: +2, including nesting penalty of 1, nesting level increased to 2

    if (opt) {
    ^

cmd/mrcalc.cpp:989: +3, including nesting penalty of 2, nesting level increased to 3

      if (opt->is("datatype"))
      ^

cmd/mrcalc.cpp:991: +1, nesting level increased to 3

      else if (opt->is("nthreads"))
           ^

cmd/mrcalc.cpp:993: +1, nesting level increased to 3

      else if (opt->is("force") || opt->is("info") || opt->is("debug") || opt->is("quiet"))
           ^

cmd/mrcalc.cpp:993: +1

      else if (opt->is("force") || opt->is("info") || opt->is("debug") || opt->is("quiet"))
                                                                       ^

cmd/mrcalc.cpp:93: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:100: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:102: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:104: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:106: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:108: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:110: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:117: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:119: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:123: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:125: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:127: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:129: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:136: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:143: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:152: +1, nesting level increased to 3

TERNARY_OP(
^

cmd/mrcalc.cpp:78: expanded from macro 'TERNARY_OP'

  else if (opt->is(#OPTION)) ternary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:159: +1, nesting level increased to 3

TERNARY_OP(
^

cmd/mrcalc.cpp:78: expanded from macro 'TERNARY_OP'

  else if (opt->is(#OPTION)) ternary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:168: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:170: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:174: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:176: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:178: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:182: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:189: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:196: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:203: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:214: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:221: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:228: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:237: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:244: +1, nesting level increased to 3

BINARY_OP(
^

cmd/mrcalc.cpp:75: expanded from macro 'BINARY_OP'

  else if (opt->is(#OPTION)) binary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:251: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:253: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:255: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:262: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:264: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:273: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:275: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:277: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:281: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:283: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:285: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:287: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:289: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:291: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:295: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:297: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:299: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:301: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:303: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:305: +1, nesting level increased to 3

UNARY_OP(
^

cmd/mrcalc.cpp:72: expanded from macro 'UNARY_OP'

  else if (opt->is(#OPTION)) unary_operation(opt->id, stack, Op_##OPTION());
       ^

cmd/mrcalc.cpp:999: +1, nesting level increased to 3

      else
      ^

cmd/mrcalc.cpp:1002: +1, nesting level increased to 2

    } else {
      ^


for (int n = 1; n < App::argc; ++n) {

const Option *opt = match_option(App::argv[n]);
for (size_t n = 0; n < raw_arguments_list.size(); ++n) {
const auto &argument = raw_arguments_list[n];
const Option *opt = match_option(argument);
if (opt) {

if (opt->is("datatype"))
++n;
daljit46 marked this conversation as resolved.
Show resolved Hide resolved
else if (opt->is("nthreads"))
if (opt->is("datatype") || opt->is("nthreads"))
++n;
else if (opt->is("force") || opt->is("info") || opt->is("debug") || opt->is("quiet"))
continue;
Expand All @@ -1003,7 +999,7 @@ void run() {
throw Exception(std::string("operation \"") + opt->id + "\" not yet implemented!");

} else {
stack.push_back(App::argv[n]);
stack.push_back(argument);
}
}

Expand Down
21 changes: 8 additions & 13 deletions cmd/mrcolour.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,17 @@
using namespace MR;
using namespace App;

std::vector<std::string> colourmap_choices_std;
std::vector<const char *> colourmap_choices_cstr;
std::vector<std::string> colourmap_choices;
daljit46 marked this conversation as resolved.
Show resolved Hide resolved

// clang-format off
void usage() {

const ColourMap::Entry *entry = ColourMap::maps;
do {
if (strcmp(entry->name, "Complex"))
colourmap_choices_std.push_back(lowercase(entry->name));
++entry;
} while(entry->name != nullptr);
colourmap_choices_cstr.reserve(colourmap_choices_std.size() + 1);
for (const auto& s : colourmap_choices_std)
colourmap_choices_cstr.push_back(s.c_str());
colourmap_choices_cstr.push_back(nullptr);
for(const auto& entry : ColourMap::maps) {
const bool is_complex = strcmp(entry.name, "Complex") == 0;
if(!is_complex) {
colourmap_choices.push_back(lowercase(entry.name));
}
}

AUTHOR = "Robert E. Smith ([email protected])";

Expand All @@ -67,7 +62,7 @@ void usage() {
ARGUMENTS
+ Argument ("input", "the input image").type_image_in()
+ Argument ("map", "the colourmap to apply;"
" choices are: " + join(colourmap_choices_std, ",")).type_choice (colourmap_choices_cstr.data())
" choices are: " + join(colourmap_choices, ",")).type_choice (colourmap_choices)
+ Argument ("output", "the output image").type_image_out();

OPTIONS
Expand Down
2 changes: 1 addition & 1 deletion cmd/mrdegibbs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
using namespace MR;
using namespace App;

const char *modes[] = {"2d", "3d", nullptr};
const std::vector<std::string> modes = {"2d", "3d"};

// clang-format off
void usage() {
Expand Down
2 changes: 1 addition & 1 deletion cmd/mrfilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
using namespace MR;
using namespace App;

const char *filters[] = {"fft", "gradient", "median", "smooth", "normalise", "zclean", NULL};
const std::vector<std::string> filters = {"fft", "gradient", "median", "smooth", "normalise", "zclean"};

// clang-format off
const OptionGroup FFTOption = OptionGroup ("Options for FFT filter")
Expand Down
4 changes: 2 additions & 2 deletions cmd/mrgrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
using namespace MR;
using namespace App;

const char *interp_choices[] = {"nearest", "linear", "cubic", "sinc", NULL};
#define DEFAULT_INTERP 2 // cubic
const char *operation_choices[] = {"regrid", "crop", "pad", NULL};
const std::vector<std::string> interp_choices = {"nearest", "linear", "cubic", "sinc"};
const std::vector<std::string> operation_choices = {"regrid", "crop", "pad"};

// clang-format off
void usage() {
Expand Down
2 changes: 1 addition & 1 deletion cmd/mrhistmatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
using namespace MR;
using namespace App;

const char *choices[] = {"scale", "linear", "nonlinear", nullptr};
const std::vector<std::string> choices = {"scale", "linear", "nonlinear"};

// clang-format off
void usage() {
Expand Down
27 changes: 14 additions & 13 deletions cmd/mrmath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,20 @@
using namespace MR;
using namespace App;

const char *operations[] = {"mean",
"median",
"sum",
"product",
"rms",
"norm",
"var",
"std",
"min",
"max",
"absmax", // Maximum of absolute values
"magmax", // Value for which the magnitude is the maximum (i.e. preserves signed-ness)
NULL};
const std::vector<std::string> operations = {
"mean",
"median",
"sum",
"product",
"rms",
"norm",
"var",
"std",
"min",
"max",
"absmax", // Maximum of absolute values
"magmax" // Value for which the magnitude is the maximum (i.e. preserves signed-ness)
};

// clang-format off
void usage() {
Expand Down
8 changes: 4 additions & 4 deletions cmd/mrmetric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
using namespace MR;
using namespace App;

const char *interp_choices[] = {"nearest", "linear", "cubic", "sinc", NULL};
#define DEFAULT_INTERP 1 // linear
const char *space_choices[] = {"voxel", "image1", "image2", "average", NULL};
#define DEFAULT_SPACE 0 // voxel
#define DEFAULT_SPACE 0 // voxel
daljit46 marked this conversation as resolved.
Show resolved Hide resolved
const std::vector<std::string> interp_choices = {"nearest", "linear", "cubic", "sinc"};
const std::vector<std::string> space_choices = {"voxel", "image1", "image2", "average"};

template <class ValueType>
inline void
Expand Down Expand Up @@ -169,7 +169,7 @@ void evaluate_voxelwise_msq(InType1 &in1,
}

enum MetricType { MeanSquared, CrossCorrelation };
const char *metric_choices[] = {"diff", "cc", NULL};
const std::vector<std::string> metric_choices = {"diff", "cc"};

// clang-format off
void usage() {
Expand Down
10 changes: 2 additions & 8 deletions cmd/mrregister.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,9 @@
using namespace MR;
using namespace App;

const char *transformation_choices[] = {"rigid",
"affine",
"nonlinear",
"rigid_affine",
"rigid_nonlinear",
"affine_nonlinear",
"rigid_affine_nonlinear",
nullptr};
#define DEFAULT_TRANSFORMATION_TYPE 5 // affine_nonlinear
const std::vector<std::string> transformation_choices = {
"rigid", "affine", "nonlinear", "rigid_affine", "rigid_nonlinear", "affine_nonlinear", "rigid_affine_nonlinear"};

// clang-format off
const OptionGroup multiContrastOptions =
Expand Down
2 changes: 1 addition & 1 deletion cmd/mrthreshold.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ using namespace MR;
using namespace App;

enum class operator_type { LT, LE, GE, GT, UNDEFINED };
const char *const operator_list[] = {"lt", "le", "ge", "gt", nullptr};
const std::vector<std::string> operator_list = {"lt", "le", "ge", "gt"};

// clang-format off
void usage() {
Expand Down
4 changes: 2 additions & 2 deletions cmd/mrtransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
using namespace MR;
using namespace App;

const char *interp_choices[] = {"nearest", "linear", "cubic", "sinc", nullptr};
#define DEFAULT_INTERP 2 // cubic
const char *modulation_choices[] = {"fod", "jac", nullptr};
const std::vector<std::string> interp_choices = {"nearest", "linear", "cubic", "sinc"};
const std::vector<std::string> modulation_choices = {"fod", "jac"};

// clang-format off
void usage() {
Expand Down
2 changes: 1 addition & 1 deletion cmd/mtnormalise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ using namespace App;
#define DEFAULT_BALANCE_MAXITER_VALUE 7
#define DEFAULT_POLY_ORDER 3

const char *poly_order_choices[] = {"0", "1", "2", "3", nullptr};
const std::vector<std::string> poly_order_choices = {"0", "1", "2", "3"};

// clang-format off
void usage() {
Expand Down
2 changes: 1 addition & 1 deletion cmd/shbasis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
using namespace MR;
using namespace App;

const char *conversions[] = {"old", "new", "force_oldtonew", "force_newtoold", nullptr};
const std::vector<std::string> conversions = {"old", "new", "force_oldtonew", "force_newtoold"};
enum conv_t { NONE, OLD, NEW, FORCE_OLDTONEW, FORCE_NEWTOOLD };

// clang-format off
Expand Down
Loading
Loading