Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Update Compiler Warnings, Enable Warnings as Errors #484

Merged
merged 33 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
1b5986f
warnings as errors in github actions
gardner48 May 16, 2024
2cad780
remove -Wno-deprecated-declarations
gardner48 May 16, 2024
4e146d8
add -Wcast-qual to ENABLE_ALL_WARNINGS
gardner48 May 16, 2024
16485be
add -Wdouble-promotion to ENABLE_ALL_WARNINGS
gardner48 May 16, 2024
38ae328
add -Wmissing-declarations to ENABLE_ALL_WARNINGS
gardner48 May 16, 2024
1a251aa
add -Wshadow to ENABLE_ALL_WARNINGS
gardner48 May 16, 2024
9165c51
Merge branch 'develop' into ci/compiler-warnings
gardner48 May 16, 2024
c87410c
make some flags conditional, add conversion flags from Jeknins tests
gardner48 May 16, 2024
e44af52
Merge branch 'develop' into ci/compiler-warnings
gardner48 May 16, 2024
80a2e6e
Merge branch 'develop' into ci/compiler-warnings
gardner48 May 17, 2024
9ce019a
fix warnings in unit tests
gardner48 May 17, 2024
777635c
fix example warnings
gardner48 May 17, 2024
11964df
gko::lend is deprecated
gardner48 May 17, 2024
79891a3
work around ginkgo test compile error
gardner48 May 17, 2024
491a4c2
formatting
gardner48 May 17, 2024
45b1578
remove reference
gardner48 May 17, 2024
417134e
use gko::lend based on Ginkgo version
gardner48 May 17, 2024
64621b9
fixes for Ginkgo < 1.6
gardner48 May 17, 2024
989742e
rename shadowed variable in vec benchmark
gardner48 May 17, 2024
dc9d1a6
fix shadowed variables in trilinos vector, examples
gardner48 May 18, 2024
65ff531
fix warnings in profiling test
gardner48 May 18, 2024
03a4544
fix warnings in diffusion benchmark
gardner48 May 18, 2024
301da20
formatting
gardner48 May 18, 2024
10b3c84
fix more benchmark warnings
gardner48 May 18, 2024
cee6c0e
add include
gardner48 May 20, 2024
99109ca
skip -Wmissing-declarations with Fortran interfaces
gardner48 May 20, 2024
4ed7093
add comment
gardner48 May 20, 2024
b277bde
regen Fortran interfaces
gardner48 May 20, 2024
58683d1
skip -Wcast-qual with Fortran interfaces
gardner48 May 20, 2024
6b46209
move fused op prototypes to impl.h
gardner48 May 20, 2024
06ac344
formatting
gardner48 May 20, 2024
8e7ad10
fix warnings, linking error with gtest test
gardner48 May 20, 2024
1a6a210
add missing include
gardner48 May 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions cmake/SundialsSetupCompilers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,18 @@ endif()
if(ENABLE_ALL_WARNINGS)
message(STATUS "Enabling all compiler warnings")

set(CMAKE_C_FLAGS "-Wall -Wpedantic -Wextra -Wno-unused-parameter -Wno-deprecated-declarations -Wno-unused-function ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-Wall -Wpedantic -Wextra -Wno-unused-parameter -Wno-deprecated-declarations -Wno-unused-function ${CMAKE_CXX_FLAGS}")
if(SUNDIALS_PRECISION MATCHES "EXTENDED")
set(CMAKE_C_FLAGS "-Wdouble-promotion ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-Wdouble-promotion ${CMAKE_CXX_FLAGS}")
endif()

if((SUNDIALS_PRECISION MATCHES "DOUBLE") AND (SUNDIALS_INDEX_SIZE MATCHES "32"))
set(CMAKE_C_FLAGS "-Wconversion -Wno-sign-conversion ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-Wconversion -Wno-sign-conversion ${CMAKE_CXX_FLAGS}")
endif()

set(CMAKE_C_FLAGS "-Wall -Wpedantic -Wextra -Wshadow -Wmissing-declarations -Wcast-qual -Wno-unused-parameter -Wno-unused-function ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-Wall -Wpedantic -Wextra -Wshadow -Wmissing-declarations -Wcast-qual -Wno-unused-parameter -Wno-unused-function ${CMAKE_CXX_FLAGS}")
set(CMAKE_Fortran_FLAGS "-Wall -Wpedantic -Wno-unused-dummy-argument -Wno-c-binding-type -ffpe-summary=none ${CMAKE_Fortran_FLAGS}")
endif()

Expand Down
2 changes: 1 addition & 1 deletion examples/arkode/CXX_parallel/ark_heat2D_p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1720,7 +1720,7 @@ static int OpenOutput(UserData* udata)
static int WriteOutput(sunrealtype t, N_Vector u, UserData* udata)
{
int flag;
sunrealtype max;
sunrealtype max = ZERO;
bool outproc = (udata->myid_c == 0);

if (udata->output > 0)
Expand Down
30 changes: 4 additions & 26 deletions examples/arkode/CXX_parhyp/ark_heat2D_hypre_ls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,31 +470,9 @@ int main(int argc, char* argv[])
flag = ARKodeSetEpsLin(arkode_mem, udata->epslin);
if (check_flag(&flag, "ARKodeSetEpsLin", 1)) { return 1; }

// Select method order
if (udata->order > 1)
{
// Use an ARKode provided table
flag = ARKodeSetOrder(arkode_mem, udata->order);
if (check_flag(&flag, "ARKodeSetOrder", 1)) { return 1; }
}
else
{
// Use implicit Euler (requires fixed step size)
sunrealtype c[1], A[1], b[1];
ARKodeButcherTable B = NULL;

// Create implicit Euler Butcher table
c[0] = A[0] = b[0] = ONE;
B = ARKodeButcherTable_Create(1, 1, 0, c, A, b, NULL);
if (check_flag((void*)B, "ARKodeButcherTable_Create", 0)) { return 1; }

// Attach the Butcher table
flag = ARKStepSetTables(arkode_mem, 1, 0, B, NULL);
if (check_flag(&flag, "ARKStepSetTables", 1)) { return 1; }

// Free the Butcher table
ARKodeButcherTable_Free(B);
}
// Use an ARKode provided table
flag = ARKodeSetOrder(arkode_mem, udata->order);
if (check_flag(&flag, "ARKodeSetOrder", 1)) { return 1; }

// Set fixed step size or adaptivity method
if (udata->hfixed > ZERO)
Expand Down Expand Up @@ -2020,7 +1998,7 @@ static int OpenOutput(UserData* udata)
static int WriteOutput(sunrealtype t, N_Vector u, UserData* udata)
{
int flag;
sunrealtype max;
sunrealtype max = ZERO;
bool outproc = (udata->myid_c == 0);

if (udata->output > 0)
Expand Down
2 changes: 1 addition & 1 deletion examples/arkode/CXX_parhyp/ark_heat2D_hypre_pfmg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2534,7 +2534,7 @@ static int OpenOutput(UserData* udata)
static int WriteOutput(sunrealtype t, N_Vector u, UserData* udata)
{
int flag;
sunrealtype max;
sunrealtype max = ZERO;
bool outproc = (udata->myid_c == 0);

if (udata->output > 0)
Expand Down
33 changes: 17 additions & 16 deletions examples/arkode/CXX_serial/ark_advection_diffusion_reaction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ int SetIC(N_Vector y, UserData& udata);
// -----------------------------------------------------------------------------

// Check function return flag
int check_flag(int flag, const string funcname)
static int check_flag(int flag, const string funcname)
{
if (flag < 0)
{
Expand All @@ -277,15 +277,15 @@ int check_flag(int flag, const string funcname)
}

// Check if a function returned a NULL pointer
int check_ptr(void* ptr, const string funcname)
static int check_ptr(void* ptr, const string funcname)
{
if (ptr) { return 0; }
cerr << "ERROR: " << funcname << " returned NULL" << endl;
return 1;
}

// Print ERK integrator statistics
int OutputStatsERK(void* arkode_mem, UserData& udata)
static int OutputStatsERK(void* arkode_mem, UserData& udata)
{
int flag;

Expand All @@ -309,7 +309,7 @@ int OutputStatsERK(void* arkode_mem, UserData& udata)
}

// Print ARK integrator statistics
int OutputStatsARK(void* arkode_mem, UserData& udata)
static int OutputStatsARK(void* arkode_mem, UserData& udata)
{
int flag;

Expand Down Expand Up @@ -362,8 +362,8 @@ int OutputStatsARK(void* arkode_mem, UserData& udata)
}

// Print MRI integrator statistics
int OutputStatsMRIARK(void* arkode_mem, MRIStepInnerStepper fast_mem,
UserData& udata)
static int OutputStatsMRIARK(void* arkode_mem, MRIStepInnerStepper fast_mem,
UserData& udata)
{
int flag;

Expand Down Expand Up @@ -461,7 +461,7 @@ int OutputStatsMRIARK(void* arkode_mem, MRIStepInnerStepper fast_mem,
}

// Save current stats
int UpdateCVodeStats(CVodeInnerStepperContent* content)
static int UpdateCVodeStats(CVodeInnerStepperContent* content)
{
int flag;
long int nst, netf, nfe, nni, nncf, nsetups, nje;
Expand Down Expand Up @@ -498,8 +498,8 @@ int UpdateCVodeStats(CVodeInnerStepperContent* content)
}

// Print MRI integrator statistics
int OutputStatsMRICVODE(void* arkode_mem, MRIStepInnerStepper fast_mem,
UserData& udata)
static int OutputStatsMRICVODE(void* arkode_mem, MRIStepInnerStepper fast_mem,
UserData& udata)
{
int flag;

Expand Down Expand Up @@ -570,7 +570,7 @@ int OutputStatsMRICVODE(void* arkode_mem, MRIStepInnerStepper fast_mem,
}

// Print command line options
void InputHelp()
static void InputHelp()
{
cout << endl;
cout << "Command line options:" << endl;
Expand Down Expand Up @@ -662,8 +662,8 @@ inline void find_arg(vector<string>& args, const string key, bool& dest,
}
}

int ReadInputs(vector<string>& args, UserData& udata, UserOptions& uopts,
SUNContext ctx)
static int ReadInputs(vector<string>& args, UserData& udata, UserOptions& uopts,
SUNContext ctx)
{
if (find(args.begin(), args.end(), "--help") != args.end())
{
Expand Down Expand Up @@ -785,7 +785,7 @@ int ReadInputs(vector<string>& args, UserData& udata, UserOptions& uopts,
}

// Print user data
int PrintSetup(UserData& udata, UserOptions& uopts)
static int PrintSetup(UserData& udata, UserOptions& uopts)
{
cout << endl;
cout << "Problem parameters and options:" << endl;
Expand Down Expand Up @@ -1147,7 +1147,7 @@ int PrintSetup(UserData& udata, UserOptions& uopts)
}

// Initialize output
int OpenOutput(UserData& udata, UserOptions& uopts)
static int OpenOutput(UserData& udata, UserOptions& uopts)
{
// Header for status output
if (uopts.output)
Expand Down Expand Up @@ -1183,7 +1183,8 @@ int OpenOutput(UserData& udata, UserOptions& uopts)
}

// Write output
int WriteOutput(sunrealtype t, N_Vector y, UserData& udata, UserOptions& uopts)
static int WriteOutput(sunrealtype t, N_Vector y, UserData& udata,
UserOptions& uopts)
{
if (uopts.output)
{
Expand Down Expand Up @@ -1212,7 +1213,7 @@ int WriteOutput(sunrealtype t, N_Vector y, UserData& udata, UserOptions& uopts)
}

// Finalize output
int CloseOutput(UserOptions& uopts)
static int CloseOutput(UserOptions& uopts)
{
// Footer for status output
if (uopts.output)
Expand Down
2 changes: 1 addition & 1 deletion examples/cvode/CXX_parallel/cv_heat2D_p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1620,7 +1620,7 @@ static int OpenOutput(UserData* udata)
static int WriteOutput(sunrealtype t, N_Vector u, UserData* udata)
{
int flag;
sunrealtype max;
sunrealtype max = ZERO;
bool outproc = (udata->myid_c == 0);

if (udata->output > 0)
Expand Down
4 changes: 2 additions & 2 deletions examples/cvode/CXX_parhyp/cv_heat2D_hypre_ls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1498,7 +1498,7 @@ static int WaitRecv(UserData* udata)
// -----------------------------------------------------------------------------

// Initialize memory allocated within Userdata
UserData::UserData(sundials::Context& sunctx) : sunctx(sunctx)
UserData::UserData(sundials::Context& ctx) : sunctx(ctx)
{
// Diffusion coefficient
kx = ONE;
Expand Down Expand Up @@ -1932,7 +1932,7 @@ static int OpenOutput(UserData* udata)
static int WriteOutput(sunrealtype t, N_Vector u, UserData* udata)
{
int flag;
sunrealtype max;
sunrealtype max = ZERO;
bool outproc = (udata->myid_c == 0);

if (udata->output > 0)
Expand Down
4 changes: 2 additions & 2 deletions examples/cvode/CXX_parhyp/cv_heat2D_hypre_pfmg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1970,7 +1970,7 @@ static int WaitRecv(UserData* udata)
// -----------------------------------------------------------------------------

// Initialize memory allocated within Userdata
UserData::UserData(sundials::Context& sunctx) : sunctx(sunctx)
UserData::UserData(sundials::Context& ctx) : sunctx(ctx)
{
// Diffusion coefficient
kx = ONE;
Expand Down Expand Up @@ -2446,7 +2446,7 @@ static int OpenOutput(UserData* udata)
static int WriteOutput(sunrealtype t, N_Vector u, UserData* udata)
{
int flag;
sunrealtype max;
sunrealtype max = ZERO;
bool outproc = (udata->myid_c == 0);

if (udata->output > 0)
Expand Down
16 changes: 8 additions & 8 deletions examples/cvode/CXX_serial/cv_heat2D.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ UserData::~UserData()
// -----------------------------------------------------------------------------

// Compute the exact solution
int Solution(sunrealtype t, N_Vector u, UserData& udata)
static int Solution(sunrealtype t, N_Vector u, UserData& udata)
{
auto uarray = N_VGetArrayPointer(u);
if (check_ptr(uarray, "N_VGetArrayPointer")) { return -1; }
Expand Down Expand Up @@ -137,7 +137,7 @@ int Solution(sunrealtype t, N_Vector u, UserData& udata)
}

// Compute the solution error
int SolutionError(sunrealtype t, N_Vector u, N_Vector e, UserData& udata)
static int SolutionError(sunrealtype t, N_Vector u, N_Vector e, UserData& udata)
{
// Compute true solution
auto flag = Solution(t, e, udata);
Expand All @@ -151,7 +151,7 @@ int SolutionError(sunrealtype t, N_Vector u, N_Vector e, UserData& udata)
}

// Print command line options
void InputHelp()
static void InputHelp()
{
std::cout << std::endl
<< "Command line options:\n"
Expand All @@ -176,7 +176,7 @@ void InputHelp()
}

// Read command line inputs
int ReadInputs(std::vector<std::string>& args, UserData& udata)
static int ReadInputs(std::vector<std::string>& args, UserData& udata)
{
if (find(args.begin(), args.end(), "--help") != args.end())
{
Expand Down Expand Up @@ -212,7 +212,7 @@ int ReadInputs(std::vector<std::string>& args, UserData& udata)
}

// Print user data
void PrintUserData(UserData& udata)
static void PrintUserData(UserData& udata)
{
std::cout << std::endl
<< "2D Heat problem:\n"
Expand Down Expand Up @@ -243,7 +243,7 @@ void PrintUserData(UserData& udata)
}

// Initialize output
int OpenOutput(UserData& udata)
static int OpenOutput(UserData& udata)
{
// Header for status output
std::cout << std::scientific
Expand Down Expand Up @@ -280,7 +280,7 @@ int OpenOutput(UserData& udata)
}

// Write output
int WriteOutput(sunrealtype t, N_Vector u, N_Vector e, UserData& udata)
static int WriteOutput(sunrealtype t, N_Vector u, N_Vector e, UserData& udata)
{
// Compute the error
auto flag = SolutionError(t, u, e, udata);
Expand Down Expand Up @@ -325,7 +325,7 @@ int WriteOutput(sunrealtype t, N_Vector u, N_Vector e, UserData& udata)
}

// Finalize output
int CloseOutput(UserData& udata)
static int CloseOutput(UserData& udata)
{
// Footer for status output
std::cout << " ----------------------------------------------"
Expand Down
5 changes: 3 additions & 2 deletions examples/cvode/CXX_serial/cv_kpr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ inline int true_sol(sunrealtype t, sunrealtype* u, sunrealtype* v)
// -----------------------------------------------------------------------------

// Print command line options
void InputHelp()
static void InputHelp()
{
std::cout << std::endl;
std::cout << "Command line options:" << std::endl;
Expand All @@ -98,7 +98,8 @@ void InputHelp()
std::cout << " --nout : number of outputs\n";
}

int ReadInputs(std::vector<std::string>& args, Options& opts, SUNContext ctx)
static int ReadInputs(std::vector<std::string>& args, Options& opts,
SUNContext ctx)
{
if (find(args.begin(), args.end(), "--help") != args.end())
{
Expand Down
Loading
Loading