-
Notifications
You must be signed in to change notification settings - Fork 105
Get BOUT++ ready for C++20 (master) #3267
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
base: master
Are you sure you want to change the base?
Changes from all commits
83befec
510d2e6
0932af4
683f6fe
4b9d679
ecb03f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,7 +76,7 @@ public: | |
|
|
||
| template <class S, class... Args> | ||
| int push(const S& format, const Args&... args) { | ||
| return push(fmt::format(format, args...)); | ||
| return push(fmt::format(fmt::runtime(format), args...)); | ||
|
Contributor
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. warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay] return push(fmt::format(fmt::runtime(format), args...));
^
Contributor
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. warning: no header providing "fmt::runtime" is directly included [misc-include-cleaner] include/bout/msg_stack.hxx:26: - class MsgStack;
+ #include "fmt/base.h"
+ class MsgStack; |
||
| } | ||
|
|
||
| void pop(); ///< Remove the last message | ||
|
|
@@ -145,8 +145,8 @@ public: | |
|
|
||
| template <class S, class... Args> | ||
| MsgStackItem(const std::string& file, int line, const S& msg, const Args&... args) | ||
| : point(msg_stack.push("{:s} on line {:d} of '{:s}'", fmt::format(msg, args...), | ||
| line, file)) {} | ||
| : point(msg_stack.push("{:s} on line {:d} of '{:s}'", | ||
| fmt::format(fmt::runtime(msg), args...), line, file)) {} | ||
| ~MsgStackItem() { | ||
| // If an exception has occurred, don't pop the message | ||
| if (exception_count == std::uncaught_exceptions()) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,7 +71,7 @@ public: | |
|
|
||
| template <class S, class... Args> | ||
| void read(Options* options, const S& format, const Args&... args) { | ||
| return read(options, fmt::format(format, args...)); | ||
| return read(options, fmt::format(fmt::runtime(format), args...)); | ||
|
Contributor
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. warning: no header providing "fmt::runtime" is directly included [misc-include-cleaner] include/bout/optionsreader.hxx:31: - class OptionsReader;
+ #include "fmt/base.h"
+ class OptionsReader; |
||
| } | ||
|
|
||
| /// Write options to file | ||
|
|
@@ -82,7 +82,7 @@ public: | |
|
|
||
| template <class S, class... Args> | ||
| void write(Options* options, const S& format, const Args&... args) { | ||
| return write(options, fmt::format(format, args...)); | ||
| return write(options, fmt::format(fmt::runtime(format), args...)); | ||
| } | ||
|
|
||
| /// Parse options from the command line | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,7 +76,8 @@ public: | |
| } | ||
|
|
||
| template <class S, class... Args> | ||
| Output(const S& format, const Args&... args) : Output(fmt::format(format, args...)) {} | ||
| Output(const S& format, const Args&... args) | ||
|
Contributor
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. warning: no header providing "fmt::runtime" is directly included [misc-include-cleaner] include/bout/output.hxx:25: - class Output;
+ #include "fmt/base.h"
+ class Output; |
||
| : Output(fmt::format(fmt::runtime(format), args...)) {} | ||
|
|
||
| ~Output() override { close(); } | ||
|
|
||
|
|
@@ -88,7 +89,7 @@ public: | |
|
|
||
| template <class S, class... Args> | ||
| int open(const S& format, const Args&... args) { | ||
| return open(fmt::format(format, args...)); | ||
| return open(fmt::format(fmt::runtime(format), args...)); | ||
| } | ||
|
|
||
| /// Close the log file | ||
|
|
@@ -99,14 +100,14 @@ public: | |
|
|
||
| template <class S, class... Args> | ||
| void write(const S& format, const Args&... args) { | ||
| write(fmt::format(format, args...)); | ||
| write(fmt::format(fmt::runtime(format), args...)); | ||
| } | ||
| /// Same as write, but only to screen | ||
| virtual void print(const std::string& message); | ||
|
|
||
| template <class S, class... Args> | ||
| void print(const S& format, const Args&... args) { | ||
| print(fmt::format(format, args...)); | ||
| print(fmt::format(fmt::runtime(format), args...)); | ||
| } | ||
|
|
||
| /// Add an output stream. All output will be sent to all streams | ||
|
|
@@ -173,7 +174,8 @@ public: | |
| void write(const S& format, const Args&... args) { | ||
| if (enabled) { | ||
| ASSERT1(base != nullptr); | ||
| base->write(fmt::format(format, args...)); | ||
| base->write( | ||
| fmt::format(fmt::runtime(format), std::forward<decltype(args)>(args)...)); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -185,7 +187,8 @@ public: | |
| void print(const S& format, const Args&... args) { | ||
| if (enabled) { | ||
| ASSERT1(base != nullptr); | ||
| base->print(fmt::format(format, args...)); | ||
| base->print( | ||
| fmt::format(fmt::runtime(format), std::forward<decltype(args)>(args)...)); | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -249,7 +249,7 @@ public: | |
|
|
||
| template <class S, class... Args> | ||
| ParseException(const S& format, const Args&... args) | ||
| : message(fmt::format(format, args...)) {} | ||
| : message(fmt::format(fmt::runtime(format), args...)) {} | ||
|
Contributor
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. warning: no header providing "fmt::runtime" is directly included [misc-include-cleaner] include/bout/sys/expressionparser.hxx:31: - #include "fmt/core.h"
+ #include "fmt/base.h"
+ #include "fmt/core.h" |
||
|
|
||
| ~ParseException() override = default; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -337,7 +337,7 @@ template <class Factory> | |
| // type. Note that this does require all the options are used in the | ||
| // constructor, and not in a `init` method or similar | ||
| std::cout << fmt::format("Input options for {} '{}':\n\n", Factory::type_name, type); | ||
| std::cout << fmt::format("{:id}\n", help_options); | ||
| std::cout << fmt::format(fmt::runtime("{:id}\n"), help_options); | ||
|
Contributor
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. warning: no header providing "fmt::runtime" is directly included [misc-include-cleaner] src/bout++.cxx:27: - #include "bout/build_config.hxx"
+ #include "fmt/base.h"
+ #include "bout/build_config.hxx" |
||
| std::exit(EXIT_SUCCESS); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -163,14 +163,16 @@ CheckMeshResult checkBoutMeshYDecomposition(int num_y_processors, int ny, | |
| // Check size of Y mesh if we've got multiple processors in Y | ||
| if (num_local_y_points < num_y_guards and num_y_processors != 1) { | ||
| return {false, | ||
| fmt::format(_("\t -> ny/NYPE ({:d}/{:d} = {:d}) must be >= MYG ({:d})\n"), ny, | ||
| num_y_processors, num_local_y_points, num_y_guards)}; | ||
| fmt::format(fmt::runtime(_( | ||
|
Contributor
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. warning: no header providing "_" is directly included [misc-include-cleaner] src/mesh/impls/bout/boutmesh.cxx:28: - #include <bout/boundary_region.hxx>
+ #include "bout/sys/gettext.hxx"
+ #include <bout/boundary_region.hxx>
Contributor
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. warning: no header providing "fmt::format" is directly included [misc-include-cleaner] src/mesh/impls/bout/boutmesh.cxx:27: + #include "fmt/format.h"
Contributor
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. warning: no header providing "fmt::runtime" is directly included [misc-include-cleaner] src/mesh/impls/bout/boutmesh.cxx:27: + #include "fmt/base.h" |
||
| "\t -> ny/NYPE ({:d}/{:d} = {:d}) must be >= MYG ({:d})\n")), | ||
| ny, num_y_processors, num_local_y_points, num_y_guards)}; | ||
| } | ||
| // Check branch cuts | ||
| if ((jyseps1_1 + 1) % num_local_y_points != 0) { | ||
| return {false, fmt::format(_("\t -> Leg region jyseps1_1+1 ({:d}) must be a " | ||
| "multiple of MYSUB ({:d})\n"), | ||
| jyseps1_1 + 1, num_local_y_points)}; | ||
| return {false, | ||
| fmt::format(fmt::runtime(_("\t -> Leg region jyseps1_1+1 ({:d}) must be a " | ||
|
Contributor
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. warning: no header providing "fmt::format" is directly included [misc-include-cleaner] fmt::format(fmt::runtime(_("\t -> Leg region jyseps1_1+1 ({:d}) must be a "
^ |
||
| "multiple of MYSUB ({:d})\n")), | ||
| jyseps1_1 + 1, num_local_y_points)}; | ||
| } | ||
|
|
||
| if (jyseps2_1 != jyseps1_2) { | ||
|
|
@@ -179,50 +181,57 @@ CheckMeshResult checkBoutMeshYDecomposition(int num_y_processors, int ny, | |
| if ((jyseps2_1 - jyseps1_1) % num_local_y_points != 0) { | ||
| return { | ||
| false, | ||
| fmt::format(_("\t -> Core region jyseps2_1-jyseps1_1 ({:d}-{:d} = {:d}) must " | ||
| "be a multiple of MYSUB ({:d})\n"), | ||
| fmt::format(fmt::runtime(_( | ||
|
Contributor
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. warning: no header providing "fmt::format" is directly included [misc-include-cleaner] fmt::format(fmt::runtime(_(
^ |
||
| "\t -> Core region jyseps2_1-jyseps1_1 ({:d}-{:d} = {:d}) must " | ||
| "be a multiple of MYSUB ({:d})\n")), | ||
| jyseps2_1, jyseps1_1, jyseps2_1 - jyseps1_1, num_local_y_points)}; | ||
| } | ||
|
|
||
| if ((jyseps2_2 - jyseps1_2) % num_local_y_points != 0) { | ||
| return { | ||
| false, | ||
| fmt::format(_("\t -> Core region jyseps2_2-jyseps1_2 ({:d}-{:d} = {:d}) must " | ||
| "be a multiple of MYSUB ({:d})\n"), | ||
| fmt::format(fmt::runtime(_( | ||
| "\t -> Core region jyseps2_2-jyseps1_2 ({:d}-{:d} = {:d}) must " | ||
| "be a multiple of MYSUB ({:d})\n")), | ||
| jyseps2_2, jyseps1_2, jyseps2_2 - jyseps1_2, num_local_y_points)}; | ||
| } | ||
|
|
||
| // Check upper legs | ||
| if ((ny_inner - jyseps2_1 - 1) % num_local_y_points != 0) { | ||
| return { | ||
| false, | ||
| fmt::format(_("\t -> leg region ny_inner-jyseps2_1-1 ({:d}-{:d}-1 = {:d}) must " | ||
| "be a multiple of MYSUB ({:d})\n"), | ||
| ny_inner, jyseps2_1, ny_inner - jyseps2_1 - 1, num_local_y_points)}; | ||
| return {false, | ||
| fmt::format( | ||
| fmt::runtime( | ||
| _("\t -> leg region ny_inner-jyseps2_1-1 ({:d}-{:d}-1 = {:d}) must " | ||
| "be a multiple of MYSUB ({:d})\n")), | ||
| ny_inner, jyseps2_1, ny_inner - jyseps2_1 - 1, num_local_y_points)}; | ||
| } | ||
| if ((jyseps1_2 - ny_inner + 1) % num_local_y_points != 0) { | ||
| return { | ||
| false, | ||
| fmt::format(_("\t -> leg region jyseps1_2-ny_inner+1 ({:d}-{:d}+1 = {:d}) must " | ||
| "be a multiple of MYSUB ({:d})\n"), | ||
| jyseps1_2, ny_inner, jyseps1_2 - ny_inner + 1, num_local_y_points)}; | ||
| return {false, | ||
| fmt::format( | ||
| fmt::runtime( | ||
| _("\t -> leg region jyseps1_2-ny_inner+1 ({:d}-{:d}+1 = {:d}) must " | ||
| "be a multiple of MYSUB ({:d})\n")), | ||
| jyseps1_2, ny_inner, jyseps1_2 - ny_inner + 1, num_local_y_points)}; | ||
| } | ||
| } else { | ||
| // Single Null | ||
| if ((jyseps2_2 - jyseps1_1) % num_local_y_points != 0) { | ||
| return { | ||
| false, | ||
| fmt::format(_("\t -> Core region jyseps2_2-jyseps1_1 ({:d}-{:d} = {:d}) must " | ||
| "be a multiple of MYSUB ({:d})\n"), | ||
| fmt::format(fmt::runtime(_( | ||
| "\t -> Core region jyseps2_2-jyseps1_1 ({:d}-{:d} = {:d}) must " | ||
| "be a multiple of MYSUB ({:d})\n")), | ||
| jyseps2_2, jyseps1_1, jyseps2_2 - jyseps1_1, num_local_y_points)}; | ||
| } | ||
| } | ||
|
|
||
| if ((ny - jyseps2_2 - 1) % num_local_y_points != 0) { | ||
| return {false, fmt::format( | ||
| _("\t -> leg region ny-jyseps2_2-1 ({:d}-{:d}-1 = {:d}) must be a " | ||
| "multiple of MYSUB ({:d})\n"), | ||
| ny, jyseps2_2, ny - jyseps2_2 - 1, num_local_y_points)}; | ||
| return { | ||
| false, | ||
| fmt::format(fmt::runtime(_( | ||
| "\t -> leg region ny-jyseps2_2-1 ({:d}-{:d}-1 = {:d}) must be a " | ||
| "multiple of MYSUB ({:d})\n")), | ||
| ny, jyseps2_2, ny - jyseps2_2 - 1, num_local_y_points)}; | ||
| } | ||
|
|
||
| return {true, ""}; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -333,13 +333,15 @@ may need to change your input file. | |
|
|
||
| // No matches, just point out the error | ||
| if (possible_matches.empty()) { | ||
| return fmt::format(message_template, name, problem_bit); | ||
| return fmt::format(fmt::runtime(message_template), name, problem_bit); | ||
|
Contributor
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. warning: no header providing "fmt::format" is directly included [misc-include-cleaner] return fmt::format(fmt::runtime(message_template), name, problem_bit);
^
Contributor
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. warning: no header providing "fmt::runtime" is directly included [misc-include-cleaner] src/sys/expressionparser.cxx:24: - #include <bout/sys/expressionparser.hxx>
+ #include "fmt/base.h"
+ #include <bout/sys/expressionparser.hxx> |
||
| } | ||
|
|
||
| // Give the first suggestion as a possible alternative | ||
| std::string error_message = fmt::format(message_template, name, problem_bit); | ||
| error_message += fmt::format(_("\n {1: ^{2}}{0}\n Did you mean '{0}'?"), | ||
| possible_matches.begin()->name, "", start); | ||
| std::string error_message = | ||
| fmt::format(fmt::runtime(message_template), name, problem_bit); | ||
| error_message += | ||
| fmt::format(fmt::runtime(_("\n {1: ^{2}}{0}\n Did you mean '{0}'?")), | ||
|
Contributor
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. warning: no header providing "fmt::format" is directly included [misc-include-cleaner] fmt::format(fmt::runtime(_("\n {1: ^{2}}{0}\n Did you mean '{0}'?")),
^ |
||
| possible_matches.begin()->name, "", start); | ||
| return error_message; | ||
| }; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -748,7 +748,8 @@ Array<BoutReal> Options::as<Array<BoutReal>>(const Array<BoutReal>& similar_to) | |
| Array<BoutReal> result = bout::utils::visit( | ||
| ConvertContainer<Array<BoutReal>>{ | ||
| fmt::format( | ||
| _("Value for option {:s} cannot be converted to an Array<BoutReal>"), | ||
| fmt::runtime( | ||
| _("Value for option {:s} cannot be converted to an Array<BoutReal>")), | ||
| full_name), | ||
| similar_to}, | ||
| value); | ||
|
|
@@ -770,7 +771,8 @@ Matrix<BoutReal> Options::as<Matrix<BoutReal>>(const Matrix<BoutReal>& similar_t | |
| auto result = bout::utils::visit( | ||
| ConvertContainer<Matrix<BoutReal>>{ | ||
| fmt::format( | ||
| _("Value for option {:s} cannot be converted to an Matrix<BoutReal>"), | ||
| fmt::runtime( | ||
| _("Value for option {:s} cannot be converted to an Matrix<BoutReal>")), | ||
| full_name), | ||
| similar_to}, | ||
| value); | ||
|
|
@@ -792,7 +794,8 @@ Tensor<BoutReal> Options::as<Tensor<BoutReal>>(const Tensor<BoutReal>& similar_t | |
| auto result = bout::utils::visit( | ||
| ConvertContainer<Tensor<BoutReal>>{ | ||
| fmt::format( | ||
| _("Value for option {:s} cannot be converted to an Tensor<BoutReal>"), | ||
| fmt::runtime( | ||
| _("Value for option {:s} cannot be converted to an Tensor<BoutReal>")), | ||
| full_name), | ||
| similar_to}, | ||
| value); | ||
|
|
@@ -1083,20 +1086,22 @@ bout::details::OptionsFormatterBase::format(const Options& options, | |
| // Get all the child values first | ||
| for (const auto& child : children) { | ||
| if (child.second.isValue()) { | ||
| fmt::format_to(ctx.out(), format_string, child.second); | ||
| fmt::format_to(ctx.out(), fmt::runtime(format_string), child.second); | ||
|
Contributor
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. warning: no header providing "fmt::format_to" is directly included [misc-include-cleaner] fmt::format_to(ctx.out(), fmt::runtime(format_string), child.second);
^ |
||
| fmt::format_to(ctx.out(), "\n"); | ||
| } | ||
| } | ||
|
|
||
| // Now descend the tree, accumulating subsections | ||
| for (const auto& subsection : options.subsections()) { | ||
| fmt::format_to(ctx.out(), format_string, *subsection.second); | ||
| fmt::format_to(ctx.out(), fmt::runtime(format_string), *subsection.second); | ||
| } | ||
|
|
||
| return ctx.out(); | ||
| } | ||
|
|
||
| std::string toString(const Options& value) { return fmt::format("{}", value); } | ||
| std::string toString(const Options& value) { | ||
| return fmt::format(fmt::runtime("{}"), value); | ||
| } | ||
|
|
||
| namespace bout { | ||
| void checkForUnusedOptions() { | ||
|
|
@@ -1142,7 +1147,7 @@ void checkForUnusedOptions(const Options& options, const std::string& data_dir, | |
| } | ||
| possible_misspellings += fmt::format("\nUnused option '{}', did you mean:\n", key); | ||
| for (const auto& match : fuzzy_matches) { | ||
| possible_misspellings += fmt::format("\t{:idk}\n", match.match); | ||
| possible_misspellings += fmt::format(fmt::runtime("\t{:idk}\n"), match.match); | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -161,7 +161,7 @@ void OptionINI::write(Options* options, const std::string& filename) { | |
| } | ||
|
|
||
| // Call recursive function to write to file | ||
| fout << fmt::format("{:uds}", *options); | ||
| fout << fmt::format(fmt::runtime("{:uds}"), *options); | ||
|
Contributor
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. warning: no header providing "fmt::format" is directly included [misc-include-cleaner] src/sys/options/options_ini.cxx:52: - #include <bout/boutexception.hxx>
+ #include "fmt/format.h"
+ #include <bout/boutexception.hxx>
Contributor
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. warning: no header providing "fmt::runtime" is directly included [misc-include-cleaner] src/sys/options/options_ini.cxx:52: - #include <bout/boutexception.hxx>
+ #include "fmt/base.h"
+ #include <bout/boutexception.hxx> |
||
|
|
||
| fout.close(); | ||
| } | ||
|
|
||
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.
warning: no header providing "fmt::runtime" is directly included [misc-include-cleaner]
include/bout/boutexception.hxx:10: