Skip to content

build: move to C++17 - #226

Merged
filippi merged 4 commits into
devfrom
build/cxx17
Oct 29, 2026
Merged

filippi merged 4 commits into
devfrom
build/cxx17

Conversation

@antonio-leblanc

Copy link
Copy Markdown
Collaborator
  • Hugo proposed this in Move to C++17 #164 and Filippi agreed.
  • Sets the C++ standard to 17 (plain c++17, without the GNU extensions).
  • Removes the custom make_unique from ANN.h, since C++17 already has std::make_unique.
  • Only the standard changes, no C++17 features in the code yet.

Tests (Ubuntu 24.04, NetCDF and MPI on), building dev and this branch from scratch:

dev this branch
GCC 13.3 / Clang 18.1 builds builds, same warnings
ctest 9/9 9/9
runff + runANN outputs — same as dev, bit by bit
pip install . + tests/python — pass
Coupled Meso-NH 6.0.1 — same as dev, bit by bit

For the coupled test I ran tests/mnh_real_nested (MPI, 4 processes) four times: dev, branch, dev, branch, changing only the libForeFire.so that Meso-NH loads. The only differences are the ones that also show up between two dev runs: air_density and a few bytes of timestamp in the .nc files.

antonio-leblanc and others added 4 commits October 27, 2026 18:59
CMAKE_CXX_STANDARD 11 -> 17, ISO (CMAKE_CXX_EXTENSIONS OFF) so GCC, Clang
and Emscripten all compile the same language instead of gnu++17.

With C++17, std::make_unique sits in namespace std and ANN.h's own
make_unique shim (needed back in 2011) became ambiguous with it; the shim
is removed and the single call site now uses std::make_unique.

The comments that described the core as C++11 and the WASM translation unit
as the one exception are updated: the whole project is on 17 now.

Verified NetCDF OFF release build: 0 errors with GCC 16.2 and Clang 22.1,
warning count identical to the C++11 baseline (334, same 57 unique
messages), 8/8 ctest on C++17 and on C++11, and -std=c++17 confirmed in the
compile flags.
@filippi
filippi merged commit 485b6fa into dev Oct 29, 2026
6 checks passed
@antonio-leblanc
antonio-leblanc deleted the build/cxx17 branch October 29, 2026 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants