Skip to content

Switch to C++20#3265

Merged
dschwoerer merged 11 commits intonextfrom
c++20
Mar 11, 2026
Merged

Switch to C++20#3265
dschwoerer merged 11 commits intonextfrom
c++20

Conversation

@dschwoerer
Copy link
Copy Markdown
Contributor

Includes #3264

Mostly for testing and discussion.

@dschwoerer dschwoerer added discussion build-system issues with make/configure/... labels Feb 3, 2026
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

dschwoerer and others added 7 commits February 27, 2026 09:45
Otherwise fmt tries to do compile-time checks, but fails as it cannot be
checked at compile time.
fmtlib/fmt#4179
With C++ std::accumulate uses std::move, which fails with the reference.
isatty is provided by both cpptrace and unistd.h, so we should only
include one.
Mostly involves using `fmt::vformat` with `fmt::make_format_args` in
functions/ctors that act like `fmt::format`.

Note that `fmt::make_format_args` requires lvalues, so although we take `Args&&`
we _must not_ call `std::forward`.

We also have to introduce a new gettext macro `_f` to allow compile-time format
arg checking _and_ runtime i18n substitution.
ZedThree
ZedThree previously approved these changes Feb 27, 2026
Copy link
Copy Markdown
Member

@ZedThree ZedThree left a comment

Choose a reason for hiding this comment

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

In a few years we can move to C++23 :)

Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

template <class... Args>
// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward)
MsgStackItem(const std::string& file, int line, fmt::format_string<Args...> msg,
Args&&... args)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: forwarding reference parameter 'args' is never forwarded inside the function body [cppcoreguidelines-missing-std-forward]

               Args&&... args)
                         ^

mpi->MPI_Irecv(buffer, size, PVEC_REAL_MPI_TYPE, proc, tag,
BoutComm::get(), ch->request);
mpi->MPI_Irecv(buffer, size, PVEC_REAL_MPI_TYPE, proc, tag, BoutComm::get(),
ch->request);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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]

                 ch->request);
                 ^

mpi->MPI_Irecv(buffer, size, PVEC_REAL_MPI_TYPE, proc, tag,
BoutComm::get(), ch->request);
mpi->MPI_Irecv(buffer, size, PVEC_REAL_MPI_TYPE, proc, tag, BoutComm::get(),
ch->request);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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]

                 ch->request);
                 ^

* next: (89 commits)
  Remove v prefix from version for wheels
  Try `sor` preconditioner for 3D metrics in test-petsc-laplace
  Apply clang-tidy fixes
  Prepare `LaplacePetsc` for Z guards
  Set member variables in `LaplacePetsc` initialiser
  Use `std::vector` instead of `PetscMalloc`
  Reduce some duplicated loops in `LaplacePetsc` ctor
  tests: Refactor petsc-laplace test
  Get PETSc Laplacian test working with 3D metrics
  Mark unavailable Laplacian solvers that don't work with 3D metrics
  CI: rename build to be more accurate
  CI: remove (mostly) redundant test
  Disable LaplaceXYHypre and test if using 3D metrics
  [bot] Add last format changes commit to ignore file
  [bot] Apply format changes
  Pull out common classes for FFT/DST transforms in some Laplacians
  Add some very basic FieldPerp Laplacian solver tests
  [bot] Add last format changes commit to ignore file
  [bot] Apply format changes
  Switch to [[maybe_unused]]
  ...
@ZedThree
Copy link
Copy Markdown
Member

I've temporarily removed the CUDA build, just while we get it sorted separately

@dschwoerer dschwoerer merged commit 31df873 into next Mar 11, 2026
23 checks passed
@dschwoerer dschwoerer deleted the c++20 branch March 11, 2026 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build-system issues with make/configure/... discussion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants