Skip to content

Commit

Permalink
Use version 17 in all clang-tidy CIs
Browse files Browse the repository at this point in the history
  • Loading branch information
WeiqunZhang committed Apr 2, 2024
1 parent d78e241 commit 02f866d
Show file tree
Hide file tree
Showing 16 changed files with 43 additions and 55 deletions.
16 changes: 2 additions & 14 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,5 @@ Checks: >
# Files not ending with nolint.H will be filtered in.
HeaderFilterRegex: '([^n].....|[^o]....|[^l]...|[^i]..|[^n].|[^t])\.H$'

CheckOptions:
- key: bugprone-dynamic-static-initializers.HeaderFileExtensions
value: ';H;h;hh;hpp;hxx'
- key: bugprone-suspicious-include.HeaderFileExtensions
value: ';H;h;hh;hpp;hxx'
- key: google-global-names-in-headers.HeaderFileExtensions
value: ';H;h;hh;hpp;hxx'
- key: google-build-namespaces.HeaderFileExtensions
value: ';H;h;hh;hpp;hxx'
- key: misc-definitions-in-headers.HeaderFileExtensions
value: ';H;h;hh;hpp;hxx'
- key: misc-use-anonymous-namespace.HeaderFileExtensions
value: ';H;h;hh;hpp;hxx'

# Only available in clang-tidy >= 17
HeaderFileExtensions: ['', "H", 'h', 'hh', 'hpp', 'hxx']
8 changes: 4 additions & 4 deletions .github/workflows/bittree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Dependencies
run: |
.github/workflows/dependencies/dependencies.sh
.github/workflows/dependencies/dependencies_clang-tidy.sh 15
.github/workflows/dependencies/dependencies_clang-tidy-apt-llvm.sh 17
.github/workflows/dependencies/dependencies_ccache.sh
- name: Set Up Cache
uses: actions/cache@v4
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
${{github.workspace}}/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt
make -j4 -k -f clang-tidy-ccache-misses.mak \
CLANG_TIDY=clang-tidy-15 \
CLANG_TIDY=clang-tidy-17 \
CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*"
ccache -s
Expand All @@ -67,7 +67,7 @@ jobs:
- name: Dependencies
run: |
.github/workflows/dependencies/dependencies.sh
.github/workflows/dependencies/dependencies_clang-tidy.sh 15
.github/workflows/dependencies/dependencies_clang-tidy-apt-llvm.sh 17
.github/workflows/dependencies/dependencies_ccache.sh
- name: Set Up Cache
uses: actions/cache@v4
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
${{github.workspace}}/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt
make -j4 -k -f clang-tidy-ccache-misses.mak \
CLANG_TIDY=clang-tidy-15 \
CLANG_TIDY=clang-tidy-17 \
CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*"
ccache -s
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/clang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Dependencies
run: |
.github/workflows/dependencies/dependencies_clang.sh 7
.github/workflows/dependencies/dependencies_clang-tidy.sh 12
.github/workflows/dependencies/dependencies_clang-tidy-apt-llvm.sh 17
.github/workflows/dependencies/dependencies_ccache.sh
- name: Set Up Cache
uses: actions/cache@v4
Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:
${{github.workspace}}/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt
make -j4 -k -f clang-tidy-ccache-misses.mak \
CLANG_TIDY=clang-tidy-12 \
CLANG_TIDY=clang-tidy-17 \
CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*"
export PATH=/tmp/my-amrex/bin:$PATH
Expand All @@ -79,7 +79,7 @@ jobs:
- name: Dependencies
run: |
.github/workflows/dependencies/dependencies_clang.sh 14
.github/workflows/dependencies/dependencies_clang-tidy.sh 14
.github/workflows/dependencies/dependencies_clang-tidy-apt-llvm.sh 17
.github/workflows/dependencies/dependencies_ccache.sh
- name: Set Up Cache
uses: actions/cache@v4
Expand Down Expand Up @@ -118,7 +118,7 @@ jobs:
${{github.workspace}}/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt
make -j4 -k -f clang-tidy-ccache-misses.mak \
CLANG_TIDY=clang-tidy-14 \
CLANG_TIDY=clang-tidy-17 \
CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*"
ctest --output-on-failure
Expand All @@ -135,7 +135,7 @@ jobs:
- name: Dependencies
run: |
.github/workflows/dependencies/dependencies_clang.sh 14
.github/workflows/dependencies/dependencies_clang-tidy.sh 14
.github/workflows/dependencies/dependencies_clang-tidy-apt-llvm.sh 17
.github/workflows/dependencies/dependencies_ccache.sh
- name: Set Up Cache
uses: actions/cache@v4
Expand All @@ -160,7 +160,7 @@ jobs:
${{github.workspace}}/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt
make -j4 -k -f clang-tidy-ccache-misses.mak \
CLANG_TIDY=clang-tidy-14 \
CLANG_TIDY=clang-tidy-17 \
CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*"
ccache -s
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/hypre.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
- name: Dependencies
run: |
.github/workflows/dependencies/dependencies.sh
.github/workflows/dependencies/dependencies_clang-tidy.sh 14
.github/workflows/dependencies/dependencies_clang-tidy-apt-llvm.sh 17
.github/workflows/dependencies/dependencies_ccache.sh
- name: Set Up Cache
uses: actions/cache@v4
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
${{github.workspace}}/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt
make -j4 -k -f clang-tidy-ccache-misses.mak \
CLANG_TIDY=clang-tidy-14 \
CLANG_TIDY=clang-tidy-17 \
CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*"
ccache -s
Expand All @@ -115,7 +115,7 @@ jobs:
- name: Dependencies
run: |
.github/workflows/dependencies/dependencies.sh
.github/workflows/dependencies/dependencies_clang-tidy.sh 14
.github/workflows/dependencies/dependencies_clang-tidy-apt-llvm.sh 17
.github/workflows/dependencies/dependencies_ccache.sh
- name: Set Up Cache
uses: actions/cache@v4
Expand Down Expand Up @@ -149,7 +149,7 @@ jobs:
${{github.workspace}}/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt
make -j4 -k -f clang-tidy-ccache-misses.mak \
CLANG_TIDY=clang-tidy-14 \
CLANG_TIDY=clang-tidy-17 \
CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*"
ccache -s
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/petsc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Dependencies
run: |
.github/workflows/dependencies/dependencies.sh
.github/workflows/dependencies/dependencies_clang-tidy.sh 14
.github/workflows/dependencies/dependencies_clang-tidy-apt-llvm.sh 17
.github/workflows/dependencies/dependencies_ccache.sh
- name: Set Up Cache
uses: actions/cache@v4
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
${{github.workspace}}/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt
make -j4 -k -f clang-tidy-ccache-misses.mak \
CLANG_TIDY=clang-tidy-14 \
CLANG_TIDY=clang-tidy-17 \
CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*"
ccache -s
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Dependencies
run: |
.github/workflows/dependencies/dependencies.sh
.github/workflows/dependencies/dependencies_clang-tidy.sh 15
.github/workflows/dependencies/dependencies_clang-tidy-apt-llvm.sh 17
.github/workflows/dependencies/dependencies_ccache.sh
- name: Set Up Cache
uses: actions/cache@v4
Expand Down Expand Up @@ -48,7 +48,7 @@ jobs:
${{github.workspace}}/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt
make -j4 -k -f clang-tidy-ccache-misses.mak \
CLANG_TIDY=clang-tidy-15 \
CLANG_TIDY=clang-tidy-17 \
CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*"
mkdir ../Tests/SpackSmokeTest/build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sundials.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
cd ../..
- name: Compile Test
run: |
.github/workflows/dependencies/dependencies_clang-tidy.sh 14
.github/workflows/dependencies/dependencies_clang-tidy-apt-llvm.sh 17
export CXXFLAGS="-fno-operator-names -Werror -Wall -Wextra -Wpedantic -Wnull-dereference -Wfloat-conversion -Wshadow -Woverloaded-virtual -Wnon-virtual-dtor -Wlogical-op -Wmisleading-indentation -Wduplicated-cond -Wduplicated-branches -Wmissing-include-dirs"
export CCACHE_EXTRAFILES=${{ github.workspace }}/.clang-tidy
export CCACHE_LOGFILE=${{ github.workspace }}/ccache.log.txt
Expand All @@ -61,7 +61,7 @@ jobs:
${{github.workspace}}/Tools/C_scripts/mmclt.py --input ${{github.workspace}}/ccache.log.txt
make -j4 -k -f clang-tidy-ccache-misses.mak \
CLANG_TIDY=clang-tidy-14 \
CLANG_TIDY=clang-tidy-17 \
CLANG_TIDY_ARGS="--config-file=${{github.workspace}}/.clang-tidy --warnings-as-errors=*"
ccache -s
Expand Down
6 changes: 3 additions & 3 deletions Src/Extern/HYPRE/AMReX_Hypre.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ Hypre::Hypre (const BoxArray& grids, const DistributionMapping& dmap,
static_assert(AMREX_SPACEDIM > 1, "Hypre: 1D not supported");

// This is not static_assert because HypreSolver class does not require this.
if (!std::is_same<Real, HYPRE_Real>::value) {
if (!std::is_same_v<Real, HYPRE_Real>) {
amrex::Abort("amrex::Real != HYPRE_Real");
}

#ifdef HYPRE_BIGINT
static_assert(std::is_same<long long int, HYPRE_Int>::value, "long long int != HYPRE_Int");
static_assert(std::is_same_v<long long int, HYPRE_Int>, "long long int != HYPRE_Int");
#else
static_assert(std::is_same<int, HYPRE_Int>::value, "int != HYPRE_Int");
static_assert(std::is_same_v<int, HYPRE_Int>, "int != HYPRE_Int");
#endif

const int ncomp = 1;
Expand Down
2 changes: 1 addition & 1 deletion Src/Extern/HYPRE/AMReX_HypreABecLap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ HypreABecLap::solve (MultiFab& soln, const MultiFab& rhs, Real reltol, Real abst

amrex::Print() << "\n" << num_iterations
<< " Hypre PFMG Iterations, Relative Residual "
<< res << std::endl;
<< res << '\n';
}

getSolution(soln);
Expand Down
2 changes: 1 addition & 1 deletion Src/Extern/HYPRE/AMReX_HypreABecLap2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ HypreABecLap2::solve (MultiFab& soln, const MultiFab& rhs, Real reltol, Real abs

amrex::Print() << "\n" << num_iterations
<< " Hypre SS BoomerAMG Iterations, Relative Residual "
<< res << std::endl;
<< res << '\n';
}

getSolution(soln);
Expand Down
2 changes: 1 addition & 1 deletion Src/Extern/HYPRE/AMReX_HypreABecLap3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ HypreABecLap3::prepareSolver ()
}
#endif

static_assert(std::is_signed<HYPRE_Int>::value, "HYPRE_Int is assumed to be signed");
static_assert(std::is_signed_v<HYPRE_Int>, "HYPRE_Int is assumed to be signed");

// how many non-covered cells do we have?
ncells_grid.define(ba,dm);
Expand Down
16 changes: 8 additions & 8 deletions Src/Extern/HYPRE/AMReX_HypreIJIface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct HypreOptParse
if (pp.contains(key.c_str())) {
int val;
pp.query(key.c_str(), val);
func(solver, val);
std::forward<F>(func)(solver, val);
}
}

Expand All @@ -36,15 +36,15 @@ struct HypreOptParse
{
T val = default_val;
pp.queryAdd(key.c_str(), val);
func(solver, val);
std::forward<F>(func)(solver, val);
}

template <typename F, typename T>
void operator() (const std::string& key, F&& func, T default_val, int index)
{
T val = default_val;
pp.queryAdd(key.c_str(), val);
func(solver, val, index);
std::forward<F>(func)(solver, val, index);
}

template <typename T, typename F>
Expand All @@ -53,7 +53,7 @@ struct HypreOptParse
if (pp.contains(key.c_str())) {
T val;
pp.query(key.c_str(), val);
func(solver, val);
std::forward<F>(func)(solver, val);
}
}
};
Expand Down Expand Up @@ -165,7 +165,7 @@ void HypreIJIface::solve (
amrex::Print() << "HYPRE " << m_solver_name
<< ": Num. iterations = " << m_num_iterations
<< "; Relative residual = " << m_final_res_norm
<< std::endl;
<< '\n';
}
}

Expand All @@ -183,7 +183,7 @@ void HypreIJIface::parse_inputs (const std::string& prefix)
if (m_verbose > 2) {
amrex::Print() << "HYPRE: solver = " << m_solver_name
<< "; preconditioner = " << m_preconditioner_name
<< std::endl;
<< '\n';
}

if (m_preconditioner_name == "none") {
Expand Down Expand Up @@ -235,7 +235,7 @@ void HypreIJIface::init_solver (
void HypreIJIface::boomeramg_precond_configure (const std::string& prefix)
{
if (m_verbose > 2) {
amrex::Print() << "Creating BoomerAMG preconditioner" << std::endl;
amrex::Print() << "Creating BoomerAMG preconditioner" << '\n';
}
HYPRE_BoomerAMGCreate(&m_precond);

Expand Down Expand Up @@ -433,7 +433,7 @@ void HypreIJIface::boomeramg_solver_configure (const std::string& prefix)
void HypreIJIface::gmres_solver_configure (const std::string& prefix)
{
if (m_verbose > 2) {
amrex::Print() << "Creating GMRES solver" << std::endl;
amrex::Print() << "Creating GMRES solver" << '\n';
}
HYPRE_ParCSRGMRESCreate(m_comm, &m_solver);

Expand Down
2 changes: 1 addition & 1 deletion Src/Extern/HYPRE/AMReX_HypreNodeLap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ HypreNodeLap::HypreNodeLap (const BoxArray& grids_, const DistributionMapping& d
options_namespace(std::move(options_namespace_))
{
static_assert(AMREX_SPACEDIM > 1, "HypreNodeLap: 1D not supported");
static_assert(std::is_same<Real, HYPRE_Real>::value, "amrex::Real != HYPRE_Real");
static_assert(std::is_same_v<Real, HYPRE_Real>, "amrex::Real != HYPRE_Real");

int num_procs, myid;
MPI_Comm_size(comm, &num_procs);
Expand Down
4 changes: 2 additions & 2 deletions Src/Extern/HYPRE/AMReX_HypreSolver.H
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ HypreSolver<MSS>::HypreSolver (Vector<IndexType> const& a_index_type,
m_cell_offset.define(m_grids[0], m_dmap);
#endif

fill_local_id(a_marker);
fill_local_id(std::forward<Marker>(a_marker));

// At this point, m_local_id stores the ids local to each box.
// m_nrows_grid stores the number of unique points in each box.
Expand Down Expand Up @@ -267,7 +267,7 @@ HypreSolver<MSS>::HypreSolver (Vector<IndexType> const& a_index_type,
m_b = m_hypre_ij->b();
m_x = m_hypre_ij->x();

fill_matrix(a_filler);
fill_matrix(std::forward<Filler>(a_filler));
}

template <int MSS>
Expand Down
6 changes: 3 additions & 3 deletions Src/Extern/PETSc/AMReX_PETSc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ PETScABecLap::PETScABecLap (const BoxArray& grids, const DistributionMapping& dm
geom(geom_)
{
static_assert(AMREX_SPACEDIM > 1, "PETScABecLap: 1D not supported");
static_assert(std::is_same<Real, PetscScalar>::value, "amrex::Real != PetscScalar");
static_assert(std::is_same_v<Real, PetscScalar>, "amrex::Real != PetscScalar");

const int ncomp = 1;
int ngrow = 0;
Expand Down Expand Up @@ -168,7 +168,7 @@ PETScABecLap::solve (MultiFab& soln, const MultiFab& rhs, Real rel_tol, Real /*a
Real res;
KSPGetIterationNumber(solver->a, &niters);
KSPGetResidualNorm(solver->a, &res);
amrex::Print() <<"\n" << niters << " PETSc Iterations, Residual Norm " << res << std::endl;
amrex::Print() <<"\n" << niters << " PETSc Iterations, Residual Norm " << res << '\n';
}

getSolution(soln);
Expand All @@ -192,7 +192,7 @@ PETScABecLap::prepareSolver ()
}
#endif

static_assert(std::is_signed<PetscInt>::value, "PetscInt is assumed to be signed");
static_assert(std::is_signed_v<PetscInt>, "PetscInt is assumed to be signed");

// how many non-covered cells do we have?
ncells_grid.define(ba,dm);
Expand Down
2 changes: 1 addition & 1 deletion Src/Extern/SUNDIALS/AMReX_Sundials.H
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <AMReX_Sundials_Core.H>
#include <AMReX_SUNMemory.H>

static_assert(std::is_same<amrex::Real,sunrealtype>::value,
static_assert(std::is_same_v<amrex::Real,sunrealtype>,
"amrex::Real must be the same as SUNDIALS sunrealtype");

#endif

0 comments on commit 02f866d

Please sign in to comment.