Skip to content

Commit

Permalink
Check for compile warnings in CI (#1685)
Browse files Browse the repository at this point in the history
* fail on build warnings in ci

* fix a bunch of warnings

* fix one more warning
  • Loading branch information
baperry2 authored Jul 15, 2024
1 parent 72bfc17 commit 0277aff
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 16 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,21 @@ jobs:
export CCACHE_MAXSIZE=600M
ccache -z
cmake --build ${{runner.workspace}}/ERF/build-${{matrix.os}} --parallel ${{env.NPROCS}};
cmake --build ${{runner.workspace}}/ERF/build-${{matrix.os}} --parallel ${{env.NPROCS}} \
2>&1 | tee -a ${{runner.workspace}}/build-output.txt;
ccache -s
du -hs ~/.cache/ccache
- name: Report
run: |
egrep "warning:|error:" ${{runner.workspace}}/build-output.txt \
| egrep -v "Submodules/amrex" | egrep -v "lto-wrapper: warning:" | sort | uniq \
| awk 'BEGIN{i=0}{print $0}{i++}END{print "Warnings: "i}' > ${{runner.workspace}}/build-output-warnings.txt
cat ${{runner.workspace}}/build-output-warnings.txt
export return=$(tail -n 1 ${{runner.workspace}}/build-output-warnings.txt | awk '{print $2}')
exit ${return}
- name: Regression Tests
run: |
ctest -L regression -VV
Expand Down
2 changes: 1 addition & 1 deletion Exec/DevTests/Bomex/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ Problem::update_geostrophic_profile (const Real& /*time*/,
reduce_to_max_per_level(zlevels, z_phys_cc);
}

const Real coriolis = 2.0 * 2.0 * PI / 86400.0; // 0.376E-4;
// const Real coriolis = 2.0 * 2.0 * PI / 86400.0; // 0.376E-4;

// Only apply temperature source below nominal inversion height
for (int k = 0; k <= khi; k++) {
Expand Down
2 changes: 1 addition & 1 deletion Exec/DevTests/MetGrid/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ amrex_probinit(const amrex_real* problo, const amrex_real* probhi)
return std::make_unique<Problem>(problo, probhi);
}

Problem::Problem(const amrex::Real* problo, const amrex::Real* probhi)
Problem::Problem(const amrex::Real* /*problo*/, const amrex::Real* /*probhi*/)
{}
4 changes: 0 additions & 4 deletions Exec/DevTests/MovingTerrain/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ Problem::init_custom_pert(
{
const bool use_moisture = (sc.moisture_type != MoistureType::None);

const Real T_sfc = parms.T_0;
const Real rho_sfc = p_0 / (R_d*T_sfc);
//const Real thetabar = T_sfc;

Real H = geomdata.ProbHi()[2];
Real Ampl = parms.Ampl;
Real wavelength = 100.;
Expand Down
4 changes: 3 additions & 1 deletion Source/IO/ERF_Write1DProfiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ ERF::write_1D_profiles (Real time)
* @param h_avg_pw Profile for pressure perturbation * z-velocity on Host
*/
void
ERF::derive_diag_profiles(Real time,
ERF::derive_diag_profiles(Real /*time*/,
Gpu::HostVector<Real>& h_avg_u , Gpu::HostVector<Real>& h_avg_v , Gpu::HostVector<Real>& h_avg_w,
Gpu::HostVector<Real>& h_avg_rho , Gpu::HostVector<Real>& h_avg_th , Gpu::HostVector<Real>& h_avg_ksgs,
Gpu::HostVector<Real>& h_avg_kturb,
Expand Down Expand Up @@ -246,9 +246,11 @@ ERF::derive_diag_profiles(Real time,
Gpu::DeviceVector<Real> d_avg_v(hu_size, Real(0.0));
Gpu::DeviceVector<Real> d_avg_w(hu_size, Real(0.0));

#if 0
auto* avg_u_ptr = d_avg_u.data();
auto* avg_v_ptr = d_avg_v.data();
auto* avg_w_ptr = d_avg_w.data();
#endif

Gpu::copy(Gpu::hostToDevice, h_avg_u.begin(), h_avg_u.end(), d_avg_u.begin());
Gpu::copy(Gpu::hostToDevice, h_avg_v.begin(), h_avg_v.end(), d_avg_v.begin());
Expand Down
2 changes: 1 addition & 1 deletion Source/IO/ERF_Write1DProfiles_stag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ ERF::write_1D_profiles_stag (Real time)
* @param h_avg_pw Profile for pressure perturbation * z-velocity on Host
*/
void
ERF::derive_diag_profiles_stag (Real time,
ERF::derive_diag_profiles_stag (Real /*time*/,
Gpu::HostVector<Real>& h_avg_u , Gpu::HostVector<Real>& h_avg_v , Gpu::HostVector<Real>& h_avg_w,
Gpu::HostVector<Real>& h_avg_rho , Gpu::HostVector<Real>& h_avg_th , Gpu::HostVector<Real>& h_avg_ksgs,
Gpu::HostVector<Real>& h_avg_kturb,
Expand Down
4 changes: 1 addition & 3 deletions Source/IO/ERF_WriteScalarProfiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,10 @@ ERF::sum_integrated_quantities (Real time)
}

Real
ERF::cloud_fraction (Real time)
ERF::cloud_fraction (Real /*time*/)
{
BL_PROFILE("ERF::cloud_fraction()");

Real sum = 0.0;

int lev = 0;
// This holds all of qc
MultiFab qc(vars_new[lev][Vars::cons],make_alias,RhoQ2_comp,1);
Expand Down
2 changes: 1 addition & 1 deletion Source/Initialization/ERF_init_from_input_sounding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ init_bx_scalars_from_input_sounding_hse (const Box &bx,
Array4<Real> const &pi_hse_arr,
GeometryData const &geomdata,
Array4<const Real> const &z_cc_arr,
const Real& l_gravity,
const Real& /*l_gravity*/,
const Real& l_rdOcp,
const bool& l_moist,
InputSoundingData const &inputSoundingData)
Expand Down
4 changes: 2 additions & 2 deletions Source/SourceTerms/ERF_make_mom_sources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ void make_mom_sources (int /*level*/,
int /*nrk*/, Real dt,
Vector<MultiFab>& S_data,
const MultiFab & S_prim,
const MultiFab & xvel,
const MultiFab & yvel,
const MultiFab & /*xvel*/,
const MultiFab & /*yvel*/,
MultiFab & xmom_src,
MultiFab & ymom_src,
MultiFab & zmom_src,
Expand Down
1 change: 0 additions & 1 deletion Source/SourceTerms/ERF_make_sources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ void make_sources (int level,
// *************************************************************************************
if (solverChoice.custom_w_subsidence && (solverChoice.moisture_type != MoistureType::None)) {
const int nv = RhoQ1_comp;
const int nc = RhoQ2_comp;
if (solverChoice.custom_forcing_prim_vars) {
const int nr = Rho_comp;
ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
Expand Down

0 comments on commit 0277aff

Please sign in to comment.