diff --git a/.github/workflows/clang.yml b/.github/workflows/clang.yml index eb3e9363eab..8428c44f6b9 100644 --- a/.github/workflows/clang.yml +++ b/.github/workflows/clang.yml @@ -34,6 +34,8 @@ jobs: export CCACHE_COMPRESS=1 export CCACHE_COMPRESSLEVEL=10 export CCACHE_MAXSIZE=125M + export CCACHE_EXTRAFILES=${{ github.workspace }}/.clang-tidy + export CCACHE_LOGFILE=${{ github.workspace }}/ccache.log.txt ccache -z mkdir build @@ -52,13 +54,16 @@ jobs: -DCMAKE_C_COMPILER=$(which clang-7) \ -DCMAKE_CXX_COMPILER=$(which clang++-7) \ -DCMAKE_Fortran_COMPILER=$(which gfortran) \ - -DAMReX_CLANG_TIDY=ON \ - -DAMReX_CLANG_TIDY_WERROR=ON \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache make -j 2 make install make test_install + ${{github.workspace}}/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt + make -j2 -f clang-tidy-ccache-misses.mak \ + CLANG_TIDY=clang-tidy-12 \ + CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*" + export PATH=/tmp/my-amrex/bin:$PATH which fcompare @@ -90,6 +95,8 @@ jobs: export CCACHE_COMPRESS=1 export CCACHE_COMPRESSLEVEL=10 export CCACHE_MAXSIZE=125M + export CCACHE_EXTRAFILES=${{ github.workspace }}/.clang-tidy + export CCACHE_LOGFILE=${{ github.workspace }}/ccache.log.txt ccache -z mkdir build @@ -107,11 +114,14 @@ jobs: -DCMAKE_C_COMPILER=$(which clang-14) \ -DCMAKE_CXX_COMPILER=$(which clang++-14) \ -DCMAKE_Fortran_COMPILER=$(which gfortran) \ - -DAMReX_CLANG_TIDY=ON \ - -DAMReX_CLANG_TIDY_WERROR=ON \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache make -j 2 + ${{github.workspace}}/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt + make -j2 -f clang-tidy-ccache-misses.mak \ + CLANG_TIDY=clang-tidy-14 \ + CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*" + ctest --output-on-failure -E GhostsAndVirtuals ccache -s @@ -139,12 +149,18 @@ jobs: export CCACHE_COMPRESS=1 export CCACHE_COMPRESSLEVEL=10 export CCACHE_MAXSIZE=125M + export CCACHE_EXTRAFILES=${{ github.workspace }}/.clang-tidy + export CCACHE_LOGFILE=${{ github.workspace }}/ccache.log.txt ccache -z ./configure --dim 2 --with-fortran no --comp llvm --with-mpi no make -j2 WARN_ALL=TRUE WARN_ERROR=TRUE XTRA_CXXFLAGS="-fno-operator-names" \ - USE_CLANG_TIDY=TRUE CLANG_TIDY=clang-tidy-14 CLANG_TIDY_WARN_ERROR=TRUE \ CCACHE=ccache make install + ${{github.workspace}}/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt + make -j2 -f clang-tidy-ccache-misses.mak \ + CLANG_TIDY=clang-tidy-14 \ + CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*" + ccache -s diff --git a/.github/workflows/gcc.yml b/.github/workflows/gcc.yml index 4b4a7cf98a0..a08450e7065 100644 --- a/.github/workflows/gcc.yml +++ b/.github/workflows/gcc.yml @@ -35,6 +35,8 @@ jobs: export CCACHE_COMPRESS=1 export CCACHE_COMPRESSLEVEL=10 export CCACHE_MAXSIZE=125M + export CCACHE_EXTRAFILES=${{ github.workspace }}/.clang-tidy + export CCACHE_LOGFILE=${{ github.workspace }}/ccache.log.txt ccache -z mkdir build @@ -47,13 +49,16 @@ jobs: -DCMAKE_C_COMPILER=$(which gcc-8) \ -DCMAKE_CXX_COMPILER=$(which g++-8) \ -DCMAKE_Fortran_COMPILER=$(which gfortran-8) \ - -DAMReX_CLANG_TIDY=ON \ - -DAMReX_CLANG_TIDY_WERROR=ON \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache make -j 2 make install make test_install + ${{github.workspace}}/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt + make -j2 -f clang-tidy-ccache-misses.mak \ + CLANG_TIDY=clang-tidy-12 \ + CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*" + export PATH=/tmp/my-amrex/bin:$PATH which fcompare @@ -86,6 +91,8 @@ jobs: export CCACHE_COMPRESS=1 export CCACHE_COMPRESSLEVEL=10 export CCACHE_MAXSIZE=500M + export CCACHE_EXTRAFILES=${{ github.workspace }}/.clang-tidy + export CCACHE_LOGFILE=${{ github.workspace }}/ccache.log.txt ccache -z cmake -S . -B build \ @@ -96,11 +103,14 @@ jobs: -DAMReX_FORTRAN=ON \ -DAMReX_PARTICLES=ON \ -DAMReX_SPACEDIM=3 \ - -DAMReX_CLANG_TIDY=ON \ - -DAMReX_CLANG_TIDY_WERROR=ON \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache cmake --build build -j 2 + ${{github.workspace}}/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt + make -j2 -f clang-tidy-ccache-misses.mak \ + CLANG_TIDY=clang-tidy-12 \ + CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*" + ctest --test-dir build --output-on-failure ccache -s @@ -129,6 +139,8 @@ jobs: export CCACHE_COMPRESS=1 export CCACHE_COMPRESSLEVEL=10 export CCACHE_MAXSIZE=500M + export CCACHE_EXTRAFILES=${{ github.workspace }}/.clang-tidy + export CCACHE_LOGFILE=${{ github.workspace }}/ccache.log.txt ccache -z cmake -S . -B build \ @@ -139,11 +151,14 @@ jobs: -DAMReX_FORTRAN=ON \ -DAMReX_PARTICLES=ON \ -DAMReX_SPACEDIM=2 \ - -DAMReX_CLANG_TIDY=ON \ - -DAMReX_CLANG_TIDY_WERROR=ON \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache cmake --build build -j 2 + ${{github.workspace}}/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt + make -j2 -f clang-tidy-ccache-misses.mak \ + CLANG_TIDY=clang-tidy-12 \ + CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*" + ctest --test-dir build --output-on-failure ccache -s @@ -173,21 +188,26 @@ jobs: export CCACHE_COMPRESS=1 export CCACHE_COMPRESSLEVEL=10 export CCACHE_MAXSIZE=250M + export CCACHE_EXTRAFILES=${{ github.workspace }}/.clang-tidy + export CCACHE_LOGFILE=${{ github.workspace }}/ccache.log.txt ccache -z cmake -S . -B build \ -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_VERBOSE_MAKEFILE=ON \ - -DAMReX_EB=ON \ + -DAMReX_EB=OFF \ -DAMReX_ENABLE_TESTS=ON \ -DAMReX_FORTRAN=ON \ -DAMReX_PARTICLES=ON \ -DAMReX_SPACEDIM=1 \ - -DAMReX_CLANG_TIDY=ON \ - -DAMReX_CLANG_TIDY_WERROR=ON \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache cmake --build build -j 2 + ${{github.workspace}}/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt + make -j2 -f clang-tidy-ccache-misses.mak \ + CLANG_TIDY=clang-tidy-12 \ + CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*" + ctest --test-dir build --output-on-failure ccache -s @@ -216,6 +236,8 @@ jobs: export CCACHE_COMPRESS=1 export CCACHE_COMPRESSLEVEL=10 export CCACHE_MAXSIZE=500M + export CCACHE_EXTRAFILES=${{ github.workspace }}/.clang-tidy + export CCACHE_LOGFILE=${{ github.workspace }}/ccache.log.txt ccache -z mkdir build @@ -236,11 +258,14 @@ jobs: -DCMAKE_C_COMPILER=$(which gcc-10) \ -DCMAKE_CXX_COMPILER=$(which g++-10) \ -DCMAKE_Fortran_COMPILER=$(which gfortran-10) \ - -DAMReX_CLANG_TIDY=ON \ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache # Cannot use C++20 yet -DAMReX_CLANG_TIDY_WERROR=ON make -j 2 + ${{github.workspace}}/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt + make -j2 -f clang-tidy-ccache-misses.mak \ + CLANG_TIDY=clang-tidy-12 \ + CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*" + ctest --output-on-failure ccache -s @@ -269,6 +294,8 @@ jobs: export CCACHE_COMPRESS=1 export CCACHE_COMPRESSLEVEL=10 export CCACHE_MAXSIZE=125M + export CCACHE_EXTRAFILES=${{ github.workspace }}/.clang-tidy + export CCACHE_LOGFILE=${{ github.workspace }}/ccache.log.txt ccache -z mkdir build @@ -288,11 +315,14 @@ jobs: -DCMAKE_C_COMPILER=$(which gcc-8) \ -DCMAKE_CXX_COMPILER=$(which g++-8) \ -DCMAKE_Fortran_COMPILER=$(which gfortran-8) \ - -DAMReX_CLANG_TIDY=ON \ - -DAMReX_CLANG_TIDY_WERROR=ON \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache make -j 2 + ${{github.workspace}}/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt + make -j2 -f clang-tidy-ccache-misses.mak \ + CLANG_TIDY=clang-tidy-12 \ + CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*" + ctest --output-on-failure ccache -s @@ -328,6 +358,8 @@ jobs: export CCACHE_COMPRESS=1 export CCACHE_COMPRESSLEVEL=10 export CCACHE_MAXSIZE=500M + export CCACHE_EXTRAFILES=${{ github.workspace }}/.clang-tidy + export CCACHE_LOGFILE=${{ github.workspace }}/ccache.log.txt ccache -z mkdir build @@ -347,11 +379,14 @@ jobs: -DCMAKE_C_COMPILER=$(which gcc-12) \ -DCMAKE_CXX_COMPILER=$(which g++-12) \ -DCMAKE_CXX_STANDARD=17 \ - -DAMReX_CLANG_TIDY=ON \ - -DAMReX_CLANG_TIDY_WERROR=ON \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache make -j 2 + ${{github.workspace}}/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt + make -j2 -f clang-tidy-ccache-misses.mak \ + CLANG_TIDY=clang-tidy-14 \ + CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*" + ctest --output-on-failure ccache -s @@ -379,14 +414,20 @@ jobs: export CCACHE_COMPRESS=1 export CCACHE_COMPRESSLEVEL=10 export CCACHE_MAXSIZE=250M + export CCACHE_EXTRAFILES=${{ github.workspace }}/.clang-tidy + export CCACHE_LOGFILE=${{ github.workspace }}/ccache.log.txt ccache -z ./configure --dim 1 make -j2 XTRA_CXXFLAGS=-fno-operator-names \ - USE_CLANG_TIDY=TRUE CLANG_TIDY=clang-tidy-12 CLANG_TIDY_WARN_ERROR=TRUE \ CCACHE=ccache make install + ${{github.workspace}}/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt + make -j2 -f clang-tidy-ccache-misses.mak \ + CLANG_TIDY=clang-tidy-12 \ + CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*" + ccache -s # Build 3D libamrex with configure @@ -412,14 +453,20 @@ jobs: export CCACHE_COMPRESS=1 export CCACHE_COMPRESSLEVEL=10 export CCACHE_MAXSIZE=250M + export CCACHE_EXTRAFILES=${{ github.workspace }}/.clang-tidy + export CCACHE_LOGFILE=${{ github.workspace }}/ccache.log.txt ccache -z ./configure --dim 3 --enable-eb yes --enable-xsdk-defaults yes make -j2 WARN_ALL=TRUE WARN_ERROR=TRUE XTRA_CXXFLAGS=-fno-operator-names \ - USE_CLANG_TIDY=TRUE CLANG_TIDY=clang-tidy-12 CLANG_TIDY_WARN_ERROR=TRUE \ CCACHE=ccache make install + ${{github.workspace}}/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt + make -j2 -f clang-tidy-ccache-misses.mak \ + CLANG_TIDY=clang-tidy-12 \ + CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*" + ccache -s # Build 3D libamrex with single precision and tiny profiler @@ -445,14 +492,20 @@ jobs: export CCACHE_COMPRESS=1 export CCACHE_COMPRESSLEVEL=10 export CCACHE_MAXSIZE=250M + export CCACHE_EXTRAFILES=${{ github.workspace }}/.clang-tidy + export CCACHE_LOGFILE=${{ github.workspace }}/ccache.log.txt ccache -z ./configure --dim 3 --enable-eb no --enable-xsdk-defaults no --single-precision yes --single-precision-particles yes --enable-tiny-profile yes make -j2 WARN_ALL=TRUE WARN_ERROR=TRUE XTRA_CXXFLAGS=-fno-operator-names \ - USE_CLANG_TIDY=TRUE CLANG_TIDY=clang-tidy-12 CLANG_TIDY_WARN_ERROR=TRUE \ CCACHE=ccache make install + ${{github.workspace}}/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt + make -j2 -f clang-tidy-ccache-misses.mak \ + CLANG_TIDY=clang-tidy-12 \ + CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*" + ccache -s # Build 3D libamrex debug omp build with configure @@ -478,14 +531,20 @@ jobs: export CCACHE_COMPRESS=1 export CCACHE_COMPRESSLEVEL=10 export CCACHE_MAXSIZE=250M + export CCACHE_EXTRAFILES=${{ github.workspace }}/.clang-tidy + export CCACHE_LOGFILE=${{ github.workspace }}/ccache.log.txt ccache -z ./configure --dim 3 --enable-eb yes --enable-xsdk-defaults yes --with-omp yes --debug yes make -j2 WARN_ALL=TRUE WARN_ERROR=TRUE XTRA_CXXFLAGS=-fno-operator-names \ - USE_CLANG_TIDY=TRUE CLANG_TIDY=clang-tidy-12 CLANG_TIDY_WARN_ERROR=TRUE \ CCACHE=ccache make install + ${{github.workspace}}/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt + make -j2 -f clang-tidy-ccache-misses.mak \ + CLANG_TIDY=clang-tidy-12 \ + CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*" + ccache -s # Build Tools/Plotfile @@ -511,13 +570,19 @@ jobs: export CCACHE_COMPRESS=1 export CCACHE_COMPRESSLEVEL=10 export CCACHE_MAXSIZE=125M + export CCACHE_EXTRAFILES=${{ github.workspace }}/.clang-tidy + export CCACHE_LOGFILE=${{ github.workspace }}/ccache.log.txt ccache -z cd Tools/Plotfile make -j2 USE_MPI=FALSE USE_OMP=FALSE WARN_ALL=TRUE WARN_ERROR=TRUE XTRA_CXXFLAGS=-fno-operator-names \ - USE_CLANG_TIDY=TRUE CLANG_TIDY=clang-tidy-12 CLANG_TIDY_WARN_ERROR=TRUE \ CCACHE=ccache + ${{github.workspace}}/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt + make -j2 -f clang-tidy-ccache-misses.mak \ + CLANG_TIDY=clang-tidy-12 \ + CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*" + ccache -s # Build libamrex and run all tests @@ -544,6 +609,8 @@ jobs: export CCACHE_COMPRESS=1 export CCACHE_COMPRESSLEVEL=10 export CCACHE_MAXSIZE=125M + export CCACHE_EXTRAFILES=${{ github.workspace }}/.clang-tidy + export CCACHE_LOGFILE=${{ github.workspace }}/ccache.log.txt ccache -z mkdir build @@ -553,11 +620,14 @@ jobs: -DCMAKE_VERBOSE_MAKEFILE=ON \ -DAMReX_ENABLE_TESTS=ON \ -DAMReX_PARTICLES=ON \ - -DAMReX_CLANG_TIDY=ON \ - -DAMReX_CLANG_TIDY_WERROR=ON \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache make -j 2 + ${{github.workspace}}/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt + make -j2 -f clang-tidy-ccache-misses.mak \ + CLANG_TIDY=clang-tidy-12 \ + CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*" + ccache -s - name: Run tests diff --git a/.github/workflows/hypre.yml b/.github/workflows/hypre.yml index 4b963930af8..f02a883718c 100644 --- a/.github/workflows/hypre.yml +++ b/.github/workflows/hypre.yml @@ -81,13 +81,19 @@ jobs: export CCACHE_COMPRESS=1 export CCACHE_COMPRESSLEVEL=10 export CCACHE_MAXSIZE=125M + export CCACHE_EXTRAFILES=${{ github.workspace }}/.clang-tidy + export CCACHE_LOGFILE=${{ github.workspace }}/ccache.log.txt ccache -z export AMREX_HYPRE_HOME=${PWD}/hypre-2.21.0/src/hypre cd Tests/LinearSolvers/ABecLaplacian_C make -j2 USE_MPI=TRUE USE_HYPRE=TRUE DIM=3 \ - USE_CLANG_TIDY=TRUE CLANG_TIDY=clang-tidy-14 CLANG_TIDY_WARN_ERROR=TRUE \ CCACHE=ccache mpiexec -n 2 ./main3d.gnu.MPI.ex inputs.hypre + ${{github.workspace}}/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt + make -j2 -f clang-tidy-ccache-misses.mak \ + CLANG_TIDY=clang-tidy-14 \ + CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*" + ccache -s diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index c9376febc98..de44929d9fb 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -66,7 +66,7 @@ jobs: ccache-${{ github.workflow }}-${{ github.job }}-git- - name: Build & Install env: - CXXFLAGS: "-fno-operator-names -Werror -Wall -Wextra -Wpedantic -Wnull-dereference -Wfloat-conversion -Wshadow -Woverloaded-virtual -Wextra-semi -Wunreachable-code -Wnon-virtual-dtor -Wno-c++17-extensions -Wno-range-loop-analysis" + CXXFLAGS: "-fno-operator-names -Werror -Wall -Wextra -Wpedantic -Wnull-dereference -Wfloat-conversion -Wshadow -Woverloaded-virtual -Wextra-semi -Wunreachable-code -Wnon-virtual-dtor -Wno-c++17-extensions -Wno-range-loop-analysis -O1" # -Wno-range-loop-analysis: Apple clang has a bug in range-loop-analysis run: | export CCACHE_COMPRESS=1 diff --git a/.github/workflows/petsc.yml b/.github/workflows/petsc.yml index dbb59e608fb..b35c7558b3d 100644 --- a/.github/workflows/petsc.yml +++ b/.github/workflows/petsc.yml @@ -39,13 +39,19 @@ jobs: export CCACHE_COMPRESS=1 export CCACHE_COMPRESSLEVEL=10 export CCACHE_MAXSIZE=250M + export CCACHE_EXTRAFILES=${{ github.workspace }}/.clang-tidy + export CCACHE_LOGFILE=${{ github.workspace }}/ccache.log.txt ccache -z export AMREX_PETSC_HOME=${PWD}/petsc-3.18.1/petsc cd Tests/LinearSolvers/CellEB make -j2 USE_MPI=TRUE USE_PETSC=TRUE DIM=2 TEST=TRUE \ - USE_CLANG_TIDY=TRUE CLANG_TIDY=clang-tidy-14 CLANG_TIDY_WARN_ERROR=TRUE \ CCACHE=ccache mpiexec -n 2 ./main2d.gnu.TEST.MPI.ex inputs.rt.2d.petsc + ${{github.workspace}}/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt + make -j2 -f clang-tidy-ccache-misses.mak \ + CLANG_TIDY=clang-tidy-14 \ + CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*" + ccache -s diff --git a/.github/workflows/sundials.yml b/.github/workflows/sundials.yml index 3f56a9c010c..096f397219e 100644 --- a/.github/workflows/sundials.yml +++ b/.github/workflows/sundials.yml @@ -50,15 +50,22 @@ jobs: export CCACHE_COMPRESS=1 export CCACHE_COMPRESSLEVEL=10 export CCACHE_MAXSIZE=125M + export CCACHE_EXTRAFILES=${{ github.workspace }}/.clang-tidy + export CCACHE_LOGFILE=${{ github.workspace }}/ccache.log.txt cmake -S . -B build \ -DCMAKE_VERBOSE_MAKEFILE=ON \ -DUSE_XSDK_DEFAULTS=ON \ -DAMReX_SUNDIALS=ON \ -DSUNDIALS_ROOT=${PWD}/sundials-6.5.0/instdir \ -DCMAKE_CXX_STANDARD=17 \ - -DAMReX_CLANG_TIDY=ON \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache cmake --build build -j 2 + + ${{github.workspace}}/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt + make -j2 -f clang-tidy-ccache-misses.mak \ + CLANG_TIDY=clang-tidy-14 \ + CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*" + ccache -s sundials-cuda: diff --git a/Src/AmrCore/AMReX_AmrParticles.H b/Src/AmrCore/AMReX_AmrParticles.H index 1aca0d824d3..6a5dfd51687 100644 --- a/Src/AmrCore/AMReX_AmrParticles.H +++ b/Src/AmrCore/AMReX_AmrParticles.H @@ -251,7 +251,7 @@ ParticleToMesh (PC const& pc, const Vector& mf, template class Allocator=DefaultAllocator> -class AmrParticleContainer +class AmrParticleContainer // NOLINT : public ParticleContainer { diff --git a/Src/Base/AMReX_Any.H b/Src/Base/AMReX_Any.H index a930135d8a0..d0cc463aa04 100644 --- a/Src/Base/AMReX_Any.H +++ b/Src/Base/AMReX_Any.H @@ -33,8 +33,9 @@ public: //! Assigns by moving the given object. template - void operator= (MF && mf) { + Any& operator= (MF && mf) { m_ptr = std::make_unique >(std::forward(mf)); + return *this; } //! Returns the contained type. diff --git a/Src/Base/AMReX_BaseFab.H b/Src/Base/AMReX_BaseFab.H index 6c466c7d378..444f2964769 100644 --- a/Src/Base/AMReX_BaseFab.H +++ b/Src/Base/AMReX_BaseFab.H @@ -371,7 +371,7 @@ public: [[nodiscard]] const T* dataPtr (const IntVect& p, int n = 0) const noexcept; - void setPtr (T* p, Long sz) noexcept { AMREX_ASSERT(this->dptr == 0 && this->truesize == 0); this->dptr = p; this->truesize = sz; } + void setPtr (T* p, Long sz) noexcept { AMREX_ASSERT(this->dptr == nullptr && this->truesize == 0); this->dptr = p; this->truesize = sz; } void prefetchToHost () const noexcept; void prefetchToDevice () const noexcept; @@ -1640,7 +1640,7 @@ BaseFab::dataPtr (const IntVect& p, int n) noexcept { AMREX_ASSERT(n >= 0); AMREX_ASSERT(n < this->nvar); - AMREX_ASSERT(!(this->dptr == 0)); + AMREX_ASSERT(!(this->dptr == nullptr)); AMREX_ASSERT(this->domain.contains(p)); return this->dptr + (this->domain.index(p)+n*this->domain.numPts()); @@ -1653,7 +1653,7 @@ BaseFab::dataPtr (const IntVect& p, int n) const noexcept { AMREX_ASSERT(n >= 0); AMREX_ASSERT(n < this->nvar); - AMREX_ASSERT(!(this->dptr == 0)); + AMREX_ASSERT(!(this->dptr == nullptr)); AMREX_ASSERT(this->domain.contains(p)); return this->dptr + (this->domain.index(p)+n*this->domain.numPts()); @@ -1726,7 +1726,7 @@ AMREX_FORCE_INLINE T& BaseFab::operator() (const IntVect& p) noexcept { - AMREX_ASSERT(!(this->dptr == 0)); + AMREX_ASSERT(!(this->dptr == nullptr)); AMREX_ASSERT(this->domain.contains(p)); return this->dptr[this->domain.index(p)]; @@ -1750,7 +1750,7 @@ AMREX_FORCE_INLINE const T& BaseFab::operator() (const IntVect& p) const noexcept { - AMREX_ASSERT(!(this->dptr == 0)); + AMREX_ASSERT(!(this->dptr == nullptr)); AMREX_ASSERT(this->domain.contains(p)); return this->dptr[this->domain.index(p)]; @@ -1766,7 +1766,7 @@ BaseFab::getVal (T* data, const int loc = this->domain.index(pos); const Long sz = this->domain.numPts(); - AMREX_ASSERT(!(this->dptr == 0)); + AMREX_ASSERT(!(this->dptr == nullptr)); AMREX_ASSERT(n >= 0 && n + numcomp <= this->nvar); for (int k = 0; k < numcomp; k++) diff --git a/Src/Base/AMReX_GpuMemory.H b/Src/Base/AMReX_GpuMemory.H index e08e0df78e4..88005b82596 100644 --- a/Src/Base/AMReX_GpuMemory.H +++ b/Src/Base/AMReX_GpuMemory.H @@ -15,7 +15,7 @@ struct Managed { #ifdef AMREX_USE_GPU - void *operator new (std::size_t len) + [[nodiscard]] void *operator new (std::size_t len) { return The_Managed_Arena()->alloc(len); } @@ -32,7 +32,7 @@ struct Pinned { #ifdef AMREX_USE_GPU - void *operator new (std::size_t len) + [[nodiscard]] void *operator new (std::size_t len) { return The_Pinned_Arena()->alloc(len); } @@ -87,9 +87,9 @@ struct DeviceScalar } } - T* dataPtr () { return dp; } - T const* dataPtr () const { return dp; } - T dataValue () const { + [[nodiscard]] T* dataPtr () { return dp; } + [[nodiscard]] T const* dataPtr () const { return dp; } + [[nodiscard]] T dataValue () const { if (Gpu::inLaunchRegion()) { T r; Gpu::dtoh_memcpy(&r, dp, sizeof(T)); @@ -108,9 +108,9 @@ private: DeviceScalar () = default; ~DeviceScalar () = default; - T* dataPtr () { return &d; } - T const* dataPtr () const { return &d; } - T dataValue () const { return d; } + [[nodiscard]] T* dataPtr () { return &d; } + [[nodiscard]] T const* dataPtr () const { return &d; } + [[nodiscard]] T dataValue () const { return d; } private: T d; @@ -123,7 +123,7 @@ private: template struct SharedMemory { - AMREX_GPU_DEVICE T* dataPtr () noexcept { + [[nodiscard]] AMREX_GPU_DEVICE T* dataPtr () noexcept { static_assert(sizeof(T) < 0, "We must specialize struct SharedMemory"); return nullptr; } @@ -135,7 +135,7 @@ struct SharedMemory template <> struct SharedMemory { - AMREX_GPU_DEVICE double* dataPtr () noexcept { + [[nodiscard]] AMREX_GPU_DEVICE double* dataPtr () noexcept { AMREX_HIP_OR_CUDA(HIP_DYNAMIC_SHARED(double,amrex_sm_double);, extern __shared__ double amrex_sm_double[];) return amrex_sm_double; @@ -145,7 +145,7 @@ struct SharedMemory template <> struct SharedMemory { - AMREX_GPU_DEVICE float* dataPtr () noexcept { + [[nodiscard]] AMREX_GPU_DEVICE float* dataPtr () noexcept { AMREX_HIP_OR_CUDA(HIP_DYNAMIC_SHARED(float,amrex_sm_float);, extern __shared__ float amrex_sm_float[];) return amrex_sm_float; @@ -155,7 +155,7 @@ struct SharedMemory template <> struct SharedMemory { - AMREX_GPU_DEVICE long* dataPtr () noexcept { + [[nodiscard]] AMREX_GPU_DEVICE long* dataPtr () noexcept { AMREX_HIP_OR_CUDA(HIP_DYNAMIC_SHARED(long,amrex_sm_long);, extern __shared__ long amrex_sm_long[];) return amrex_sm_long; @@ -165,7 +165,7 @@ struct SharedMemory template <> struct SharedMemory { - AMREX_GPU_DEVICE long long* dataPtr () noexcept { + [[nodiscard]] AMREX_GPU_DEVICE long long* dataPtr () noexcept { AMREX_HIP_OR_CUDA(HIP_DYNAMIC_SHARED(long long,amrex_sm_long_long);, extern __shared__ long long amrex_sm_long_long[];) return amrex_sm_long_long; @@ -175,7 +175,7 @@ struct SharedMemory template <> struct SharedMemory { - AMREX_GPU_DEVICE int* dataPtr () noexcept { + [[nodiscard]] AMREX_GPU_DEVICE int* dataPtr () noexcept { AMREX_HIP_OR_CUDA(HIP_DYNAMIC_SHARED(int,amrex_sm_int);, extern __shared__ int amrex_sm_int[];) return amrex_sm_int; @@ -185,7 +185,7 @@ struct SharedMemory template <> struct SharedMemory { - AMREX_GPU_DEVICE short* dataPtr () noexcept { + [[nodiscard]] AMREX_GPU_DEVICE short* dataPtr () noexcept { AMREX_HIP_OR_CUDA(HIP_DYNAMIC_SHARED(short,amrex_sm_short);, extern __shared__ short amrex_sm_short[];) return amrex_sm_short; @@ -195,7 +195,7 @@ struct SharedMemory template <> struct SharedMemory { - AMREX_GPU_DEVICE char* dataPtr () noexcept { + [[nodiscard]] AMREX_GPU_DEVICE char* dataPtr () noexcept { AMREX_HIP_OR_CUDA(HIP_DYNAMIC_SHARED(char,amrex_sm_char);, extern __shared__ char amrex_sm_char[];) return amrex_sm_char; @@ -205,7 +205,7 @@ struct SharedMemory template <> struct SharedMemory { - AMREX_GPU_DEVICE unsigned long* dataPtr () noexcept { + [[nodiscard]] AMREX_GPU_DEVICE unsigned long* dataPtr () noexcept { AMREX_HIP_OR_CUDA(HIP_DYNAMIC_SHARED(unsigned long,amrex_sm_ulong);, extern __shared__ unsigned long amrex_sm_ulong[];) return amrex_sm_ulong; @@ -215,7 +215,7 @@ struct SharedMemory template <> struct SharedMemory { - AMREX_GPU_DEVICE unsigned long long* dataPtr () noexcept { + [[nodiscard]] AMREX_GPU_DEVICE unsigned long long* dataPtr () noexcept { AMREX_HIP_OR_CUDA(HIP_DYNAMIC_SHARED(unsigned long long,amrex_sm_ulonglong);, extern __shared__ unsigned long long amrex_sm_ulonglong[];) return amrex_sm_ulonglong; @@ -225,7 +225,7 @@ struct SharedMemory template <> struct SharedMemory { - AMREX_GPU_DEVICE unsigned int* dataPtr () noexcept { + [[nodiscard]] AMREX_GPU_DEVICE unsigned int* dataPtr () noexcept { AMREX_HIP_OR_CUDA(HIP_DYNAMIC_SHARED(unsigned int,amrex_sm_uint);, extern __shared__ unsigned int amrex_sm_uint[];) return amrex_sm_uint; @@ -235,7 +235,7 @@ struct SharedMemory template <> struct SharedMemory { - AMREX_GPU_DEVICE unsigned short* dataPtr () noexcept { + [[nodiscard]] AMREX_GPU_DEVICE unsigned short* dataPtr () noexcept { AMREX_HIP_OR_CUDA(HIP_DYNAMIC_SHARED(unsigned short,amrex_sm_ushort);, extern __shared__ unsigned short amrex_sm_ushort[];) return amrex_sm_ushort; @@ -245,7 +245,7 @@ struct SharedMemory template <> struct SharedMemory { - AMREX_GPU_DEVICE unsigned char* dataPtr () noexcept { + [[nodiscard]] AMREX_GPU_DEVICE unsigned char* dataPtr () noexcept { AMREX_HIP_OR_CUDA(HIP_DYNAMIC_SHARED(unsigned char,amrex_sm_uchar);, extern __shared__ unsigned char amrex_sm_uchar[];) return amrex_sm_uchar; @@ -255,7 +255,7 @@ struct SharedMemory template <> struct SharedMemory { - AMREX_GPU_DEVICE bool* dataPtr () noexcept { + [[nodiscard]] AMREX_GPU_DEVICE bool* dataPtr () noexcept { AMREX_HIP_OR_CUDA(HIP_DYNAMIC_SHARED(bool,amrex_sm_bool);, extern __shared__ bool amrex_sm_bool[];) return amrex_sm_bool; diff --git a/Src/Base/AMReX_Lazy.cpp b/Src/Base/AMReX_Lazy.cpp index 3e3b3ced8c5..7e4d6e5bd7a 100644 --- a/Src/Base/AMReX_Lazy.cpp +++ b/Src/Base/AMReX_Lazy.cpp @@ -1,12 +1,10 @@ #include -namespace amrex { - -namespace Lazy +namespace amrex::Lazy { FuncQue reduction_queue; - void QueueReduction (Func f) + void QueueReduction (Func f) // NOLINT { #ifdef BL_USE_MPI reduction_queue.push_back(f); @@ -37,5 +35,3 @@ namespace Lazy EvalReduction(); } } - -} diff --git a/Src/Base/AMReX_NonLocalBC.H b/Src/Base/AMReX_NonLocalBC.H index a8555578af6..189a0164437 100644 --- a/Src/Base/AMReX_NonLocalBC.H +++ b/Src/Base/AMReX_NonLocalBC.H @@ -196,7 +196,7 @@ InverseImage(DTOS dtos, const Box& box) } //! \brief This is the index mapping based on the DTOS MultiBlockDestToSrc. -static_assert(IsIndexMapping(), +static_assert(IsIndexMapping(), // NOLINT(bugprone-throw-keyword-missing) "MultiBlockIndexMapping is expected to satisfy IndexMapping"); //////////////////////////////////////////////////////////////////////////////////// @@ -299,8 +299,8 @@ static_assert(sizeof(Identity) == 1 ); static_assert(std::is_trivially_default_constructible::value ); static_assert(std::is_trivially_copy_assignable::value ); static_assert(std::is_trivially_copy_constructible::value ); -static_assert(IsIndexMapping() ); -static_assert(IsFabProjection() ); +static_assert(IsIndexMapping() ); // NOLINT(bugprone-throw-keyword-missing) +static_assert(IsFabProjection() ); // NOLINT(bugprone-throw-keyword-missing) //////////////////////////////////////////////////////////////////////////////////// // [FabProjection.MapComponents] @@ -330,9 +330,9 @@ template struct MapComponents { } }; -static_assert(std::is_trivially_copy_assignable>() ); -static_assert(std::is_trivially_copy_constructible>() ); -static_assert(IsFabProjection, FArrayBox>() ); +static_assert(std::is_trivially_copy_assignable>() ); // NOLINT(bugprone-throw-keyword-missing) +static_assert(std::is_trivially_copy_constructible>() ); // NOLINT(bugprone-throw-keyword-missing) +static_assert(IsFabProjection, FArrayBox>() ); // NOLINT(bugprone-throw-keyword-missing) //////////////////////////////////////////////////////////////////////////////////// // [FabProjection.MapComponents.SwapComponents] @@ -391,10 +391,10 @@ static_assert(sizeof(SwapComponents<0, 1>) == 1 ); static_assert(sizeof(DynamicSwapComponents) == 2 * sizeof(int) ); static_assert(sizeof(SwapComponents<0, -1>) == sizeof(int) ); static_assert(sizeof(SwapComponents<-1, 1>) == sizeof(int) ); -static_assert(std::is_trivially_default_constructible>>() ); -static_assert(std::is_trivially_copy_assignable>>() ); -static_assert(std::is_trivially_copy_constructible>>() ); -static_assert(IsFabProjection>, FArrayBox>() ); +static_assert(std::is_trivially_default_constructible>>() ); // NOLINT(bugprone-throw-keyword-missing) +static_assert(std::is_trivially_copy_assignable>>() ); // NOLINT(bugprone-throw-keyword-missing) +static_assert(std::is_trivially_copy_constructible>>() ); // NOLINT(bugprone-throw-keyword-missing) +static_assert(IsFabProjection>, FArrayBox>() ); // NOLINT(bugprone-throw-keyword-missing) static_assert(swap_indices<0, 1>(0) == 1 ); static_assert(swap_indices<0, 1>(1) == 0 ); @@ -602,7 +602,7 @@ UnpackRecvBuffers (const PackComponents& components, FabArray& dest, const } #endif // AMREX_USE_MPI -static_assert(IsDataPacking(), +static_assert(IsDataPacking(), // NOLINT(bugprone-throw-keyword-missing) "PackComponents is expected to satisfy the concept DataPacking."); //////////////////////////////////////////////////////////////////////////////////// @@ -663,7 +663,7 @@ UnpackRecvBuffers (const ApplyDtosAndProjectionOnReciever& packin } #endif // AMREX_USE_MPI -static_assert(IsDataPacking, FArrayBox>(), +static_assert(IsDataPacking, FArrayBox>(), // NOLINT(bugprone-throw-keyword-missing) "ApplyDtosAndProjectionOnReciever<> is expected to satisfy the DataPacking concept."); //////////////////////////////////////////////////////////////////////////////////// diff --git a/Src/Base/Parser/AMReX_Parser_Exe.H b/Src/Base/Parser/AMReX_Parser_Exe.H index e03c635321d..e824adb79cd 100644 --- a/Src/Base/Parser/AMReX_Parser_Exe.H +++ b/Src/Base/Parser/AMReX_Parser_Exe.H @@ -227,7 +227,7 @@ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE double parser_exe_eval (const char* p, double const* x) { ParserStack pstack; - while (*((parser_exe_t*)p) != PARSER_EXE_NULL) { + while (*((parser_exe_t*)p) != PARSER_EXE_NULL) { // NOLINT switch (*((parser_exe_t*)p)) { case PARSER_EXE_NUMBER: @@ -246,69 +246,69 @@ double parser_exe_eval (const char* p, double const* x) } case PARSER_EXE_ADD: { - double b = pstack.top(); + double b = pstack.top(); // NOLINT pstack.pop(); - pstack.top() += b; + pstack.top() += b; // NOLINT p += sizeof(ParserExeADD); break; } case PARSER_EXE_SUB: { - double b = pstack.top(); + double b = pstack.top(); // NOLINT pstack.pop(); - pstack.top() = (pstack.top() - b) * (((ParserExeSUB*)p)->sign); + pstack.top() = (pstack.top() - b) * (((ParserExeSUB*)p)->sign); // NOLINT p += sizeof(ParserExeSUB); break; } case PARSER_EXE_MUL: { - double b = pstack.top(); + double b = pstack.top(); // NOLINT pstack.pop(); - pstack.top() *= b; + pstack.top() *= b; // NOLINT p += sizeof(ParserExeMUL); break; } case PARSER_EXE_DIV_F: { - double v = pstack.top(); + double v = pstack.top(); // NOLINT pstack.pop(); - pstack.top() /= v; + pstack.top() /= v; // NOLINT p += sizeof(ParserExeDIV_F); break; } case PARSER_EXE_DIV_B: { - double v = pstack.top(); + double v = pstack.top(); // NOLINT pstack.pop(); - pstack.top() = v / pstack.top(); + pstack.top() = v / pstack.top(); // NOLINT p += sizeof(ParserExeDIV_B); break; } case PARSER_EXE_NEG: { - pstack.top() = -pstack.top(); + pstack.top() = -pstack.top(); // NOLINT p += sizeof(ParserExeNEG); break; } case PARSER_EXE_F1: { - pstack.top() = parser_call_f1(((ParserExeF1*)p)->ftype, pstack.top()); + pstack.top() = parser_call_f1(((ParserExeF1*)p)->ftype, pstack.top()); // NOLINT p += sizeof(ParserExeF1); break; } case PARSER_EXE_F2_F: { - double v = pstack.top(); + double v = pstack.top(); // NOLINT pstack.pop(); - pstack.top() = parser_call_f2(((ParserExeF2_F*)p)->ftype, pstack.top(), v); + pstack.top() = parser_call_f2(((ParserExeF2_F*)p)->ftype, pstack.top(), v); // NOLINT p += sizeof(ParserExeF2_F); break; } case PARSER_EXE_F2_B: { - double v = pstack.top(); + double v = pstack.top(); // NOLINT pstack.pop(); - pstack.top() = parser_call_f2(((ParserExeF2_B*)p)->ftype, v, pstack.top()); + pstack.top() = parser_call_f2(((ParserExeF2_B*)p)->ftype, v, pstack.top()); // NOLINT p += sizeof(ParserExeF2_B); break; } @@ -394,25 +394,25 @@ double parser_exe_eval (const char* p, double const* x) } case PARSER_EXE_ADD_VN: { - pstack.top() += ((ParserExeADD_VN*)p)->v; + pstack.top() += ((ParserExeADD_VN*)p)->v; // NOLINT p += sizeof(ParserExeADD_VN); break; } case PARSER_EXE_SUB_VN: { - pstack.top() = ((ParserExeSUB_VN*)p)->v - pstack.top(); + pstack.top() = ((ParserExeSUB_VN*)p)->v - pstack.top(); // NOLINT p += sizeof(ParserExeSUB_VN); break; } case PARSER_EXE_MUL_VN: { - pstack.top() *= ((ParserExeMUL_VN*)p)->v; + pstack.top() *= ((ParserExeMUL_VN*)p)->v; // NOLINT p += sizeof(ParserExeMUL_VN); break; } case PARSER_EXE_DIV_VN: { - pstack.top() = ((ParserExeDIV_VN*)p)->v / pstack.top(); + pstack.top() = ((ParserExeDIV_VN*)p)->v / pstack.top(); // NOLINT p += sizeof(ParserExeDIV_VN); break; } @@ -420,7 +420,7 @@ double parser_exe_eval (const char* p, double const* x) { int i = ((ParserExeADD_PN*)p)->i; double d = AMREX_PARSER_GET_DATA(i); - pstack.top() += d; + pstack.top() += d; // NOLINT p += sizeof(ParserExeADD_PN); break; } @@ -428,7 +428,7 @@ double parser_exe_eval (const char* p, double const* x) { int i = ((ParserExeSUB_PN*)p)->i; double d = AMREX_PARSER_GET_DATA(i); - pstack.top() = (d - pstack.top()) * (((ParserExeSUB_PN*)p)->sign); + pstack.top() = (d - pstack.top()) * (((ParserExeSUB_PN*)p)->sign); // NOLINT p += sizeof(ParserExeSUB_PN); break; } @@ -436,7 +436,7 @@ double parser_exe_eval (const char* p, double const* x) { int i = ((ParserExeMUL_PN*)p)->i; double d = AMREX_PARSER_GET_DATA(i); - pstack.top() *= d; + pstack.top() *= d; // NOLINT p += sizeof(ParserExeMUL_PN); break; } @@ -445,16 +445,16 @@ double parser_exe_eval (const char* p, double const* x) int i = ((ParserExeDIV_PN*)p)->i; double d = AMREX_PARSER_GET_DATA(i); if (((ParserExeDIV_PN*)p)->reverse) { - pstack.top() /= d; + pstack.top() /= d; // NOLINT } else { - pstack.top() = d / pstack.top(); + pstack.top() = d / pstack.top(); // NOLINT } p += sizeof(ParserExeDIV_PN); break; } case PARSER_EXE_IF: { - double cond = pstack.top(); + double cond = pstack.top(); // NOLINT pstack.pop(); if (cond == 0.0) { // false branch p += ((ParserExeIF*)p)->offset; @@ -472,7 +472,7 @@ double parser_exe_eval (const char* p, double const* x) AMREX_ALWAYS_ASSERT_WITH_MESSAGE(false,"parser_exe_eval: unknown node type"); } } - return pstack.top(); + return pstack.top(); // NOLINT } void parser_compile_exe_size (struct parser_node* node, char*& p, std::size_t& exe_size, diff --git a/Src/EB/AMReX_EB2_GeometryShop.H b/Src/EB/AMReX_EB2_GeometryShop.H index e0069506524..6b5e255286e 100644 --- a/Src/EB/AMReX_EB2_GeometryShop.H +++ b/Src/EB/AMReX_EB2_GeometryShop.H @@ -188,19 +188,11 @@ public: using FunctionType = F; - explicit GeometryShop (F const& f) - : m_f(f), m_resource() - {} - - explicit GeometryShop (F && f) + explicit GeometryShop (F f) : m_f(std::move(f)), m_resource() {} - GeometryShop (F const& f, R r) - : m_f(f), m_resource(std::move(r)) - {} - - GeometryShop (F && f, R r) + GeometryShop (F f, R r) : m_f(std::move(f)), m_resource(std::move(r)) {} diff --git a/Src/EB/AMReX_EB2_IF_Complement.H b/Src/EB/AMReX_EB2_IF_Complement.H index 1464f0060f9..d8b3853d14d 100644 --- a/Src/EB/AMReX_EB2_IF_Complement.H +++ b/Src/EB/AMReX_EB2_IF_Complement.H @@ -16,13 +16,7 @@ class ComplementIF { public: - ComplementIF (F&& a_f) : m_f(std::move(a_f)) {} - ComplementIF (F const& a_f) : m_f(a_f) {} - - ComplementIF (const ComplementIF& rhs) = default; - ComplementIF (ComplementIF&& rhs) = default; - ComplementIF& operator= (const ComplementIF& rhs) = delete; - ComplementIF& operator= (ComplementIF&& rhs) = delete; + ComplementIF (F a_f) : m_f(std::move(a_f)) {} inline Real operator() (const RealArray& p) const noexcept { diff --git a/Src/EB/AMReX_EB2_IF_Difference.H b/Src/EB/AMReX_EB2_IF_Difference.H index bb71b964483..30330d4077b 100644 --- a/Src/EB/AMReX_EB2_IF_Difference.H +++ b/Src/EB/AMReX_EB2_IF_Difference.H @@ -18,14 +18,10 @@ class DifferenceIF { public: - DifferenceIF (F&& a_f, G&& a_g) + DifferenceIF (F a_f, G a_g) : m_f(std::move(a_f)), m_g(std::move(a_g)) {} - DifferenceIF (F const& a_f, G const& a_g) - : m_f(a_f), - m_g(a_g) - {} inline Real operator() (const RealArray& p) const noexcept { diff --git a/Src/EB/AMReX_EB2_IF_Extrusion.H b/Src/EB/AMReX_EB2_IF_Extrusion.H index d2e3bf545aa..f8ba6ae7daa 100644 --- a/Src/EB/AMReX_EB2_IF_Extrusion.H +++ b/Src/EB/AMReX_EB2_IF_Extrusion.H @@ -16,19 +16,10 @@ class ExtrusionIF { public: - ExtrusionIF (F&& a_f, int direction) + ExtrusionIF (F a_f, int direction) : m_f(std::move(a_f)), m_direction(direction) {} - ExtrusionIF (F const& a_f, int direction) - : m_f(a_f), - m_direction(direction) - {} - - ExtrusionIF (const ExtrusionIF& rhs) = default; - ExtrusionIF (ExtrusionIF&& rhs) = default; - ExtrusionIF& operator= (const ExtrusionIF& rhs) = delete; - ExtrusionIF& operator= (ExtrusionIF&& rhs) = delete; inline Real operator() (const RealArray& p) const { diff --git a/Src/EB/AMReX_EB2_IF_Lathe.H b/Src/EB/AMReX_EB2_IF_Lathe.H index 3eaddaa9aab..06e051991d5 100644 --- a/Src/EB/AMReX_EB2_IF_Lathe.H +++ b/Src/EB/AMReX_EB2_IF_Lathe.H @@ -17,8 +17,7 @@ class LatheIF { public: - LatheIF (F&& a_f) : m_f(std::move(a_f)) {} - LatheIF (F const& a_f) : m_f(a_f) {} + LatheIF (F a_f) : m_f(std::move(a_f)) {} inline Real operator() (const RealArray& p) const noexcept { diff --git a/Src/EB/AMReX_EB2_IF_Plane.H b/Src/EB/AMReX_EB2_IF_Plane.H index 0accc76a6c1..36e5ae68f17 100644 --- a/Src/EB/AMReX_EB2_IF_Plane.H +++ b/Src/EB/AMReX_EB2_IF_Plane.H @@ -20,11 +20,6 @@ public: m_sign( a_inside ? 1.0 : -1.0 ) {} - PlaneIF (const PlaneIF& rhs) noexcept = default; - PlaneIF (PlaneIF&& rhs) noexcept = default; - PlaneIF& operator= (const PlaneIF& rhs) = delete; - PlaneIF& operator= (PlaneIF&& rhs) = delete; - AMREX_GPU_HOST_DEVICE inline Real operator() (AMREX_D_DECL(Real x, Real y, Real z)) const noexcept { diff --git a/Src/EB/AMReX_EB2_IF_Polynomial.H b/Src/EB/AMReX_EB2_IF_Polynomial.H index ffeae49390f..67ba37e3dd7 100644 --- a/Src/EB/AMReX_EB2_IF_Polynomial.H +++ b/Src/EB/AMReX_EB2_IF_Polynomial.H @@ -41,11 +41,6 @@ public: m_sign( a_inside ? 1.0_rt : -1.0_rt ) {} - PolyIF (const PolyIF& rhs) = default; - PolyIF (PolyIF&& rhs) = default; - PolyIF& operator= (const PolyIF& rhs) = delete; - PolyIF& operator= (PolyIF&& rhs) = delete; - AMREX_GPU_HOST_DEVICE inline Real operator() (AMREX_D_DECL(Real x, Real y, Real z)) const noexcept { diff --git a/Src/EB/AMReX_EB2_IF_Rotation.H b/Src/EB/AMReX_EB2_IF_Rotation.H index c2256d0f311..538e2429fe5 100644 --- a/Src/EB/AMReX_EB2_IF_Rotation.H +++ b/Src/EB/AMReX_EB2_IF_Rotation.H @@ -16,23 +16,12 @@ class RotationIF { public: - RotationIF (F&& a_f, Real angle, int dir) + RotationIF (F a_f, Real angle, int dir) : m_f(std::move(a_f)), m_cos_angle(std::cos(angle)), m_sin_angle(std::sin(angle)), m_dir(dir) {} - RotationIF (F const& a_f, Real angle, int dir) - : m_f(a_f), - m_cos_angle(std::cos(angle)), - m_sin_angle(std::sin(angle)), - m_dir(dir) - {} - - RotationIF (const RotationIF& rhs) = default; - RotationIF (RotationIF&& rhs) = default; - RotationIF& operator= (const RotationIF& rhs) = delete; - RotationIF& operator= (RotationIF&& rhs) = delete; // Note that angle is measured in radians #if (AMREX_SPACEDIM==2) diff --git a/Src/EB/AMReX_EB2_IF_Scale.H b/Src/EB/AMReX_EB2_IF_Scale.H index 60e8dcac1bf..33fb39a8fe1 100644 --- a/Src/EB/AMReX_EB2_IF_Scale.H +++ b/Src/EB/AMReX_EB2_IF_Scale.H @@ -16,20 +16,12 @@ class ScaleIF { public: - ScaleIF (F&& a_f, const RealArray& a_scalefactor) + ScaleIF (F a_f, const RealArray& a_scalefactor) : m_f(std::move(a_f)), #if (AMREX_SPACEDIM == 3) m_sfinv{1.0_rt/a_scalefactor[0], 1.0_rt/a_scalefactor[1], 1.0_rt/a_scalefactor[2]} #else m_sfinv{1.0_rt/a_scalefactor[0], 1.0_rt/a_scalefactor[1], 0.0_rt} -#endif - {} - ScaleIF (F const& a_f, const RealArray& a_scalefactor) - : m_f(a_f), -#if (AMREX_SPACEDIM == 3) - m_sfinv{1.0_rt/a_scalefactor[0], 1.0_rt/a_scalefactor[1], 1.0_rt/a_scalefactor[2]} -#else - m_sfinv{1.0_rt/a_scalefactor[0], 1.0_rt/a_scalefactor[1], 0.0_rt} #endif {} diff --git a/Src/EB/AMReX_EB2_IF_Translation.H b/Src/EB/AMReX_EB2_IF_Translation.H index 9c77f8c11e5..a58f4e37985 100644 --- a/Src/EB/AMReX_EB2_IF_Translation.H +++ b/Src/EB/AMReX_EB2_IF_Translation.H @@ -16,20 +16,10 @@ class TranslationIF { public: - TranslationIF (F&& a_f, const RealArray& a_offset) + TranslationIF (F a_f, const RealArray& a_offset) : m_f(std::move(a_f)), m_offset(makeXDim3(a_offset)) {} - TranslationIF (F const& a_f, const RealArray& a_offset) - : m_f(a_f), - m_offset(makeXDim3(a_offset)) - {} - - TranslationIF (const TranslationIF& rhs) = default; - TranslationIF (TranslationIF&& rhs) = default; - - TranslationIF& operator= (const TranslationIF& rhs) = delete; - TranslationIF& operator= (TranslationIF&& rhs) = delete; inline Real operator() (const RealArray& p) const noexcept { diff --git a/Src/Particle/AMReX_BinIterator.H b/Src/Particle/AMReX_BinIterator.H index 05bf2eb5064..7f8004114ee 100644 --- a/Src/Particle/AMReX_BinIterator.H +++ b/Src/Particle/AMReX_BinIterator.H @@ -24,10 +24,10 @@ struct BinIterator AMREX_GPU_HOST_DEVICE void operator++ () { ++m_index;; } - AMREX_GPU_HOST_DEVICE + [[nodiscard]] AMREX_GPU_HOST_DEVICE bool operator!= (iterator const& /*rhs*/) const { return m_index < m_stop; } - AMREX_GPU_HOST_DEVICE + [[nodiscard]] AMREX_GPU_HOST_DEVICE std::pair operator* () const { return std::make_pair(m_perm[m_index], m_items[m_perm[m_index]]); @@ -40,7 +40,7 @@ struct BinIterator index_type m_stop; }; - AMREX_GPU_HOST_DEVICE + [[nodiscard]] AMREX_GPU_HOST_DEVICE iterator begin () const { if (m_i == m_not_found) { @@ -49,7 +49,7 @@ struct BinIterator return iterator(m_offsets_ptr[m_i], m_offsets_ptr[m_i+1], m_permutation_ptr, m_items); } - AMREX_GPU_HOST_DEVICE + [[nodiscard]] AMREX_GPU_HOST_DEVICE iterator end () const { if (m_i == m_not_found) { return iterator(0, 0, m_permutation_ptr, m_items); diff --git a/Src/Particle/AMReX_NeighborParticles.H b/Src/Particle/AMReX_NeighborParticles.H index bf4136d408e..685bc3e794b 100644 --- a/Src/Particle/AMReX_NeighborParticles.H +++ b/Src/Particle/AMReX_NeighborParticles.H @@ -30,7 +30,7 @@ namespace amrex { /// levels during a fine level time step. /// template -class NeighborParticleContainer +class NeighborParticleContainer // NOLINT(cppcoreguidelines-virtual-class-destructor) // clang-tidy seems wrong. : public ParticleContainer { public: @@ -79,18 +79,17 @@ private: }; struct NeighborCopyTag { - int level; - int grid; - int tile; - int src_index; - int dst_index; - IntVect periodic_shift; + int level = -1; + int grid = -1; + int tile = -1; + int src_index = 0; + int dst_index = 0; + IntVect periodic_shift = IntVect(0); - NeighborCopyTag () {} + NeighborCopyTag () = default; NeighborCopyTag (int a_level, int a_grid, int a_tile) : - level(a_level), grid(a_grid), tile(a_tile), src_index(0), dst_index(0), - periodic_shift(IntVect(AMREX_D_DECL(0, 0, 0))) + level(a_level), grid(a_grid), tile(a_tile) {} bool operator< (const NeighborCopyTag& other) const { @@ -211,17 +210,19 @@ public: const Vector & rr, int nneighbor); + ~NeighborParticleContainer () override = default; + NeighborParticleContainer ( const NeighborParticleContainer &) = delete; NeighborParticleContainer& operator= ( const NeighborParticleContainer & ) = delete; - NeighborParticleContainer ( NeighborParticleContainer && ) = default; - NeighborParticleContainer& operator= ( NeighborParticleContainer && ) = default; + NeighborParticleContainer ( NeighborParticleContainer && ) = default; // NOLINT(performance-noexcept-move-constructor) + NeighborParticleContainer& operator= ( NeighborParticleContainer && ) = default; // NOLINT(performance-noexcept-move-constructor) /// /// Regrid functions /// void Regrid (const DistributionMapping& dmap, const BoxArray& ba); - void Regrid (const DistributionMapping& dmap, const BoxArray& ba, const int lev); + void Regrid (const DistributionMapping& dmap, const BoxArray& ba, int lev); void Regrid (const Vector& dmap, const Vector& ba); /// @@ -264,7 +265,7 @@ public: /// Build a Neighbor List for each tile /// template - void buildNeighborList (CheckPair&& check_pair, int typeInd, int* RefRatio, + void buildNeighborList (CheckPair&& check_pair, int type_ind, int* ref_ratio, int num_bin_types=1, bool sort=false); template @@ -362,9 +363,9 @@ protected: void GetNeighborCommTags (); - void GetCommTagsBox (Vector& tags, const int lev, const Box& in_box); + void GetCommTagsBox (Vector& tags, int lev, const Box& in_box); - void resizeContainers (const int lev); + void resizeContainers (int num_levels); void initializeCommComps (); @@ -384,17 +385,15 @@ protected: /// void getRcvCountsMPI (); - void GetNeighborCommTags (Vector& tags, const int lev, Box box); - void getNeighborTags (Vector& tags, const ParticleType& p, - const int nGrow, const NeighborCopyTag& src_tag, const MyParIter& pti); + int nGrow, const NeighborCopyTag& src_tag, const MyParIter& pti); void getNeighborTags (Vector& tags, const ParticleType& p, const IntVect& nGrow, const NeighborCopyTag& src_tag, const MyParIter& pti); - IntVect computeRefFac (const int src_lev, const int lev); + IntVect computeRefFac (int src_lev, int lev); Vector > > inverse_tags; Vector > neighbors; @@ -475,7 +474,7 @@ protected: Vector, amrex::Gpu::DeviceVector > > m_boundary_particle_ids; - bool hasNeighbors() const { return m_has_neighbors; } + [[nodiscard]] bool hasNeighbors() const { return m_has_neighbors; } bool m_has_neighbors = false; }; diff --git a/Src/Particle/AMReX_NeighborParticlesCPUImpl.H b/Src/Particle/AMReX_NeighborParticlesCPUImpl.H index 4d5ecb4fcc8..6be73c64a5a 100644 --- a/Src/Particle/AMReX_NeighborParticlesCPUImpl.H +++ b/Src/Particle/AMReX_NeighborParticlesCPUImpl.H @@ -177,7 +177,7 @@ sumNeighborsMPI (std::map >& not_ours, } } - const int nrcvs = RcvProc.size(); + const auto nrcvs = int(RcvProc.size()); Vector stats(nrcvs); Vector rreqs(nrcvs); @@ -229,7 +229,7 @@ sumNeighborsMPI (std::map >& not_ours, amrex::Abort("NeighborParticles::sumNeighbors: How did this happen?"); } - int npart = recvdata.size() / data_size; + auto npart = int(recvdata.size() / data_size); char* buffer = recvdata.data(); for (int j = 0; j < npart; ++j) @@ -522,7 +522,7 @@ fillNeighborsMPI (bool reuse_rcv_counts) { } } - const int nrcvs = RcvProc.size(); + const auto nrcvs = int(RcvProc.size()); Vector stats(nrcvs); Vector rreqs(nrcvs); @@ -561,7 +561,7 @@ fillNeighborsMPI (bool reuse_rcv_counts) { if (nrcvs > 0) { ParallelDescriptor::Waitall(rreqs, stats); for (int i = 0; i < nrcvs; ++i) { - const int offset = rOffset[i]; + const auto offset = int(rOffset[i]); char* buffer = &recvdata[offset]; int num_tiles, lev, gid, tid, size, np; std::memcpy(&num_tiles, buffer, sizeof(int)); buffer += sizeof(int); diff --git a/Src/Particle/AMReX_NeighborParticlesGPUImpl.H b/Src/Particle/AMReX_NeighborParticlesGPUImpl.H index 81bef1302e2..864a2b467ca 100644 --- a/Src/Particle/AMReX_NeighborParticlesGPUImpl.H +++ b/Src/Particle/AMReX_NeighborParticlesGPUImpl.H @@ -4,7 +4,7 @@ namespace detail { - inline Vector getBoundaryBoxes(const Box& box, const int ncells) + inline Vector getBoundaryBoxes(const Box& box, int ncells) { AMREX_ASSERT_WITH_MESSAGE(box.size() > 2*IntVect(AMREX_D_DECL(ncells, ncells, ncells)), "Too many cells requested in getBoundaryBoxes"); diff --git a/Src/Particle/AMReX_NeighborParticlesI.H b/Src/Particle/AMReX_NeighborParticlesI.H index ed2e1844725..cacf041b439 100644 --- a/Src/Particle/AMReX_NeighborParticlesI.H +++ b/Src/Particle/AMReX_NeighborParticlesI.H @@ -19,9 +19,9 @@ NeighborParticleContainer ::NeighborParticleContainer (const Geometry & geom, const DistributionMapping & dmap, const BoxArray & ba, - int ncells) + int nneighbor) : ParticleContainer (geom, dmap, ba), - m_num_neighbor_cells(ncells) + m_num_neighbor_cells(nneighbor) { initializeCommComps(); } @@ -32,9 +32,9 @@ NeighborParticleContainer const Vector & dmap, const Vector & ba, const Vector & rr, - int ncells) + int nneighbor) : ParticleContainer (geom, dmap, ba, rr), - m_num_neighbor_cells(ncells) + m_num_neighbor_cells(nneighbor) { initializeCommComps(); } @@ -99,7 +99,7 @@ NeighborParticleContainer template void NeighborParticleContainer -::Regrid (const DistributionMapping &dmap, const BoxArray &ba, const int lev) { +::Regrid (const DistributionMapping &dmap, const BoxArray &ba, int lev) { AMREX_ASSERT(lev <= this->finestLevel()); this->SetParticleBoxArray(lev, ba); this->SetParticleDistributionMap(lev, dmap); @@ -239,7 +239,7 @@ NeighborParticleContainer template IntVect NeighborParticleContainer -::computeRefFac (const int src_lev, const int lev) +::computeRefFac (int src_lev, int lev) { IntVect ref_fac = IntVect(AMREX_D_DECL(1,1,1)); if (src_lev < lev) { @@ -258,7 +258,7 @@ NeighborParticleContainer template void NeighborParticleContainer -::GetCommTagsBox (Vector& tags, const int src_lev, const Box& in_box) +::GetCommTagsBox (Vector& tags, int src_lev, const Box& in_box) { std::vector< std::pair > isects; Box tbx; @@ -529,7 +529,7 @@ template void NeighborParticleContainer:: getNeighborTags (Vector& tags, const ParticleType& p, - const int nGrow, const NeighborCopyTag& src_tag, const MyParIter& pti) + int nGrow, const NeighborCopyTag& src_tag, const MyParIter& pti) { getNeighborTags(tags, p, IntVect(AMREX_D_DECL(nGrow, nGrow, nGrow)), src_tag, pti); } @@ -1104,7 +1104,7 @@ printNeighborList () template void NeighborParticleContainer:: -resizeContainers (const int num_levels) +resizeContainers (int num_levels) { this->reserveData(); this->resizeData(); diff --git a/Src/Particle/AMReX_ParticleArray.H b/Src/Particle/AMReX_ParticleArray.H index c0f967b32c5..e4aceee140b 100644 --- a/Src/Particle/AMReX_ParticleArray.H +++ b/Src/Particle/AMReX_ParticleArray.H @@ -47,16 +47,21 @@ public: AMREX_GPU_HOST_DEVICE ref_wrapper(T& ref) noexcept : _ptr(&ref) {} ref_wrapper(T&&) = delete; - ref_wrapper(const ref_wrapper&) noexcept = default; - AMREX_GPU_HOST_DEVICE - void operator= (T&& a_other) {this->get()=a_other;} - ref_wrapper& operator=(const ref_wrapper& x) noexcept = default; + ~ref_wrapper () = default; + ref_wrapper (const ref_wrapper&) noexcept = default; + ref_wrapper (ref_wrapper&&) noexcept = default; AMREX_GPU_HOST_DEVICE + ref_wrapper& operator= (T&& a_other) { this->get()=a_other; return *this; } + + ref_wrapper& operator= (const ref_wrapper&) noexcept = default; + ref_wrapper& operator= (ref_wrapper&&) noexcept = default; + + [[nodiscard]] AMREX_GPU_HOST_DEVICE operator T& () const noexcept { return *_ptr; } - AMREX_GPU_HOST_DEVICE + [[nodiscard]] AMREX_GPU_HOST_DEVICE T& get() const noexcept { return *_ptr; } private: @@ -125,7 +130,7 @@ template