Skip to content

Commit

Permalink
Fix missing statics and dead code identified with -Wmissing-declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven-Roberts committed May 16, 2024
1 parent c031884 commit ba9074c
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 286 deletions.
4 changes: 2 additions & 2 deletions examples/arkode/C_serial/ark_damped_harmonic_symplectic.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ int main(int argc, char* argv[])
return 0;
}

sunrealtype omega(sunrealtype t) { return cos(t / SUN_RCONST(2.0)); }
static sunrealtype omega(sunrealtype t) { return cos(t / SUN_RCONST(2.0)); }

sunrealtype F(sunrealtype t) { return SUN_RCONST(0.018) * sin(t / PI); }
static sunrealtype F(sunrealtype t) { return SUN_RCONST(0.018) * sin(t / PI); }

sunrealtype Hamiltonian(N_Vector yvec, sunrealtype t)
{
Expand Down
6 changes: 3 additions & 3 deletions examples/arkode/C_serial/ark_harmonic_symplectic.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ typedef struct
sunrealtype dt;
} ProgramArgs;

void PrintHelp(void)
static void PrintHelp(void)
{
fprintf(stderr, "ark_harmonic_symplectic: an ARKODE example demonstrating "
"the SPRKStep time-stepping module solving a simple harmonic "
Expand All @@ -48,7 +48,7 @@ void PrintHelp(void)
/* clang-format on */
}

int ParseArgs(int argc, char* argv[], ProgramArgs* args)
static int ParseArgs(int argc, char* argv[], ProgramArgs* args)
{
int argi = 0;

Expand Down Expand Up @@ -110,7 +110,7 @@ int ParseArgs(int argc, char* argv[], ProgramArgs* args)
opt == 2 means function allocates memory so check if returned
NULL pointer
*/
int check_retval(void* returnvalue, const char* funcname, int opt)
static int check_retval(void* returnvalue, const char* funcname, int opt)
{
int* retval;

Expand Down
11 changes: 6 additions & 5 deletions examples/arkode/C_serial/ark_kepler.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ typedef struct
const char* method_name;
} ProgramArgs;

int ComputeConvergence(int num_dt, sunrealtype* orders,
sunrealtype expected_order, sunrealtype a11,
sunrealtype a12, sunrealtype a21, sunrealtype a22,
sunrealtype b1, sunrealtype b2, sunrealtype* ord_avg,
sunrealtype* ord_max, sunrealtype* ord_est)
static int ComputeConvergence(int num_dt, sunrealtype* orders,
sunrealtype expected_order, sunrealtype a11,
sunrealtype a12, sunrealtype a21, sunrealtype a22,
sunrealtype b1, sunrealtype b2,
sunrealtype* ord_avg, sunrealtype* ord_max,
sunrealtype* ord_est)
{
/* Compute/print overall estimated convergence rate */
int i = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/arkode/arkode_relaxation.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,8 @@ static int arkRelaxBrentSolve(ARKodeMem ark_mem)
}

/* Compute and apply relaxation parameter */
int arkRelaxSolve(ARKodeMem ark_mem, ARKodeRelaxMem relax_mem,
sunrealtype* relax_val_out)
static int arkRelaxSolve(ARKodeMem ark_mem, ARKodeRelaxMem relax_mem,
sunrealtype* relax_val_out)
{
int retval;

Expand Down
24 changes: 12 additions & 12 deletions src/arkode/arkode_sprk.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "arkode/arkode_butcher.h"
#include "arkode_impl.h"

ARKodeSPRKTable ARKodeSymplecticEuler(void)
static ARKodeSPRKTable ARKodeSymplecticEuler(void)
{
ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(1);
if (!sprk_table) { return NULL; }
Expand All @@ -43,7 +43,7 @@ ARKodeSPRKTable ARKodeSymplecticEuler(void)
https://doi.org/10.1016/0021-9991(91)90299-Z.
*/

ARKodeSPRKTable ARKodeSymplecticLeapfrog2(void)
static ARKodeSPRKTable ARKodeSymplecticLeapfrog2(void)
{
ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(2);
if (!sprk_table) { return NULL; }
Expand All @@ -56,7 +56,7 @@ ARKodeSPRKTable ARKodeSymplecticLeapfrog2(void)
return sprk_table;
}

ARKodeSPRKTable ARKodeSymplecticPseudoLeapfrog2(void)
static ARKodeSPRKTable ARKodeSymplecticPseudoLeapfrog2(void)
{
ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(2);
if (!sprk_table) { return NULL; }
Expand All @@ -69,7 +69,7 @@ ARKodeSPRKTable ARKodeSymplecticPseudoLeapfrog2(void)
return sprk_table;
}

ARKodeSPRKTable ARKodeSymplecticCandyRozmus4(void)
static ARKodeSPRKTable ARKodeSymplecticCandyRozmus4(void)
{
ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(4);
if (!sprk_table) { return NULL; }
Expand Down Expand Up @@ -108,7 +108,7 @@ ARKodeSPRKTable ARKodeSymplecticCandyRozmus4(void)
https://accelconf.web.cern.ch/p83/PDF/PAC1983_2669.PDF
*/

ARKodeSPRKTable ARKodeSymplecticRuth3(void)
static ARKodeSPRKTable ARKodeSymplecticRuth3(void)
{
ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(3);
if (!sprk_table) { return NULL; }
Expand All @@ -130,7 +130,7 @@ ARKodeSPRKTable ARKodeSymplecticRuth3(void)
Nonlinearity. 5, 541–562 (1992). https://doi.org/10.1088/0951-7715/5/2/011
*/

ARKodeSPRKTable ARKodeSymplecticMcLachlan2(void)
static ARKodeSPRKTable ARKodeSymplecticMcLachlan2(void)
{
ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(2);
if (!sprk_table) { return NULL; }
Expand All @@ -145,7 +145,7 @@ ARKodeSPRKTable ARKodeSymplecticMcLachlan2(void)
return sprk_table;
}

ARKodeSPRKTable ARKodeSymplecticMcLachlan3(void)
static ARKodeSPRKTable ARKodeSymplecticMcLachlan3(void)
{
sunrealtype w = 0.0;
sunrealtype y = 0.0;
Expand Down Expand Up @@ -174,7 +174,7 @@ ARKodeSPRKTable ARKodeSymplecticMcLachlan3(void)
return sprk_table;
}

ARKodeSPRKTable ARKodeSymplecticMcLachlan4(void)
static ARKodeSPRKTable ARKodeSymplecticMcLachlan4(void)
{
ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(4);
if (!sprk_table) { return NULL; }
Expand All @@ -191,7 +191,7 @@ ARKodeSPRKTable ARKodeSymplecticMcLachlan4(void)
return sprk_table;
}

ARKodeSPRKTable ARKodeSymplecticMcLachlan5(void)
static ARKodeSPRKTable ARKodeSymplecticMcLachlan5(void)
{
ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(6);
if (!sprk_table) { return NULL; }
Expand Down Expand Up @@ -221,7 +221,7 @@ ARKodeSPRKTable ARKodeSymplecticMcLachlan5(void)
*/

ARKodeSPRKTable ARKodeSymplecticYoshida6(void)
static ARKodeSPRKTable ARKodeSymplecticYoshida6(void)
{
ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(8);
if (!sprk_table) { return NULL; }
Expand Down Expand Up @@ -260,7 +260,7 @@ ARKodeSPRKTable ARKodeSymplecticYoshida6(void)
*/

ARKodeSPRKTable ARKodeSymplecticSuzukiUmeno816(void)
static ARKodeSPRKTable ARKodeSymplecticSuzukiUmeno816(void)
{
ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(16);
if (!sprk_table) { return NULL; }
Expand Down Expand Up @@ -310,7 +310,7 @@ ARKodeSPRKTable ARKodeSymplecticSuzukiUmeno816(void)
*/

ARKodeSPRKTable ARKodeSymplecticSofroniou10(void)
static ARKodeSPRKTable ARKodeSymplecticSofroniou10(void)
{
ARKodeSPRKTable sprk_table = ARKodeSPRKTable_Alloc(36);
if (!sprk_table) { return NULL; }
Expand Down
15 changes: 0 additions & 15 deletions src/arkode/arkode_sprkstep_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,16 +414,6 @@ int SPRKStepPrintAllStats(void* arkode_mem, FILE* outfile, SUNOutputFormat fmt)
return (ARKodePrintAllStats(arkode_mem, outfile, fmt));
}

void SPRKStepPrintMem(void* arkode_mem, FILE* outfile)
{
ARKodePrintMem(arkode_mem, outfile);
}

int SPRKStepSetMaxNumConstrFails(void* arkode_mem, int maxfails)
{
return (ARKodeSetMaxNumConstrFails(arkode_mem, maxfails));
}

int SPRKStepWriteParameters(void* arkode_mem, FILE* fp)
{
return (ARKodeWriteParameters(arkode_mem, fp));
Expand All @@ -436,11 +426,6 @@ int SPRKStepGetStepStats(void* arkode_mem, long int* nsteps,
return (ARKodeGetStepStats(arkode_mem, nsteps, hinused, hlast, hcur, tcur));
}

int SPRKStepGetNumConstrFails(void* arkode_mem, long int* nconstrfails)
{
return (ARKodeGetNumConstrFails(arkode_mem, nconstrfails));
}

void SPRKStepFree(void** arkode_mem) { ARKodeFree(arkode_mem); }

/*===============================================================
Expand Down
2 changes: 0 additions & 2 deletions src/ida/ida_ic.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@
*/

extern int IDAInitialSetup(IDAMem IDA_mem);
extern sunrealtype IDAWrmsNorm(IDAMem IDA_mem, N_Vector x, N_Vector w,
sunbooleantype mask);

static int IDAnlsIC(IDAMem IDA_mem);
static int IDANewtonIC(IDAMem IDA_mem);
Expand Down
7 changes: 0 additions & 7 deletions src/idas/idas_ic.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,6 @@
*/

extern int IDAInitialSetup(IDAMem IDA_mem);
extern sunrealtype IDAWrmsNorm(IDAMem IDA_mem, N_Vector x, N_Vector w,
sunbooleantype mask);
extern sunrealtype IDASensWrmsNorm(IDAMem IDA_mem, N_Vector* xS, N_Vector* wS,
sunbooleantype mask);
extern sunrealtype IDASensWrmsNormUpdate(IDAMem IDA_mem, sunrealtype old_nrm,
N_Vector* xS, N_Vector* wS,
sunbooleantype mask);

extern int IDASensEwtSet(IDAMem IDA_mem, N_Vector* yScur, N_Vector* weightS);

Expand Down
3 changes: 2 additions & 1 deletion src/nvector/manyvector/nvector_manyvector.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,8 @@ MPI_Comm N_VGetCommunicator_MPIManyVector(N_Vector v)
}
#else
/* This function retrieves the MPI Communicator from a ManyVector object. */
SUNComm N_VGetCommunicator_ManyVector(N_Vector v) { return SUN_COMM_NULL; }
//TODO: is this needed?
//SUNComm N_VGetCommunicator_ManyVector(N_Vector v) { return SUN_COMM_NULL; }
#endif

/* This function retrieves the global length of a ManyVector object. */
Expand Down
17 changes: 0 additions & 17 deletions src/sundials/sundials_adaptcontroller.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,6 @@ SUNAdaptController SUNAdaptController_NewEmpty(SUNContext sunctx)
return (C);
}

/* -----------------------------------------------------------------
* Free a generic SUNAdaptController (assumes content is already empty)
* ----------------------------------------------------------------- */

void SUNAdaptController_DestroyEmpty(SUNAdaptController C)
{
if (C == NULL) { return; }

/* free non-NULL ops structure */
if (C->ops) { free(C->ops); }
C->ops = NULL;

/* free overall SUNAdaptController object and return */
free(C);
return;
}

/* -----------------------------------------------------------------
* Required functions in the 'ops' structure for non-NULL controller
* ----------------------------------------------------------------- */
Expand Down
61 changes: 0 additions & 61 deletions src/sundials/sundials_band.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,64 +38,33 @@ sunindextype SUNDlsMat_BandGBTRF(SUNDlsMat A, sunindextype* p)
return (SUNDlsMat_bandGBTRF(A->cols, A->M, A->mu, A->ml, A->s_mu, p));
}

sunindextype BandGBTRF(SUNDlsMat A, sunindextype* p)
{
return (SUNDlsMat_bandGBTRF(A->cols, A->M, A->mu, A->ml, A->s_mu, p));
}

void SUNDlsMat_BandGBTRS(SUNDlsMat A, sunindextype* p, sunrealtype* b)
{
SUNDlsMat_bandGBTRS(A->cols, A->M, A->s_mu, A->ml, p, b);
}

void BandGBTRS(SUNDlsMat A, sunindextype* p, sunrealtype* b)
{
SUNDlsMat_bandGBTRS(A->cols, A->M, A->s_mu, A->ml, p, b);
}

void SUNDlsMat_BandCopy(SUNDlsMat A, SUNDlsMat B, sunindextype copymu,
sunindextype copyml)
{
SUNDlsMat_bandCopy(A->cols, B->cols, A->M, A->s_mu, B->s_mu, copymu, copyml);
}

void BandCopy(SUNDlsMat A, SUNDlsMat B, sunindextype copymu, sunindextype copyml)
{
SUNDlsMat_bandCopy(A->cols, B->cols, A->M, A->s_mu, B->s_mu, copymu, copyml);
}

void SUNDlsMat_BandScale(sunrealtype c, SUNDlsMat A)
{
SUNDlsMat_bandScale(c, A->cols, A->M, A->mu, A->ml, A->s_mu);
}

void BandScale(sunrealtype c, SUNDlsMat A)
{
SUNDlsMat_bandScale(c, A->cols, A->M, A->mu, A->ml, A->s_mu);
}

void SUNDlsMat_BandMatvec(SUNDlsMat A, sunrealtype* x, sunrealtype* y)
{
SUNDlsMat_bandMatvec(A->cols, x, y, A->M, A->mu, A->ml, A->s_mu);
}

void BandMatvec(SUNDlsMat A, sunrealtype* x, sunrealtype* y)
{
SUNDlsMat_bandMatvec(A->cols, x, y, A->M, A->mu, A->ml, A->s_mu);
}

/*
* -----------------------------------------------------
* Functions working on sunrealtype**
* -----------------------------------------------------
*/

sunindextype bandGBTRF(sunrealtype** a, sunindextype n, sunindextype mu,
sunindextype ml, sunindextype smu, sunindextype* p)
{
return (SUNDlsMat_bandGBTRF(a, n, mu, ml, smu, p));
}

sunindextype SUNDlsMat_bandGBTRF(sunrealtype** a, sunindextype n,
sunindextype mu, sunindextype ml,
sunindextype smu, sunindextype* p)
Expand Down Expand Up @@ -212,12 +181,6 @@ sunindextype SUNDlsMat_bandGBTRF(sunrealtype** a, sunindextype n,
return (0);
}

void bandGBTRS(sunrealtype** a, sunindextype n, sunindextype smu,
sunindextype ml, sunindextype* p, sunrealtype* b)
{
SUNDlsMat_bandGBTRS(a, n, smu, ml, p, b);
}

void SUNDlsMat_bandGBTRS(sunrealtype** a, sunindextype n, sunindextype smu,
sunindextype ml, sunindextype* p, sunrealtype* b)
{
Expand Down Expand Up @@ -252,13 +215,6 @@ void SUNDlsMat_bandGBTRS(sunrealtype** a, sunindextype n, sunindextype smu,
}
}

void bandCopy(sunrealtype** a, sunrealtype** b, sunindextype n,
sunindextype a_smu, sunindextype b_smu, sunindextype copymu,
sunindextype copyml)
{
SUNDlsMat_bandCopy(a, b, n, a_smu, b_smu, copymu, copyml);
}

void SUNDlsMat_bandCopy(sunrealtype** a, sunrealtype** b, sunindextype n,
sunindextype a_smu, sunindextype b_smu,
sunindextype copymu, sunindextype copyml)
Expand All @@ -276,12 +232,6 @@ void SUNDlsMat_bandCopy(sunrealtype** a, sunrealtype** b, sunindextype n,
}
}

void bandScale(sunrealtype c, sunrealtype** a, sunindextype n, sunindextype mu,
sunindextype ml, sunindextype smu)
{
SUNDlsMat_bandScale(c, a, n, mu, ml, smu);
}

void SUNDlsMat_bandScale(sunrealtype c, sunrealtype** a, sunindextype n,
sunindextype mu, sunindextype ml, sunindextype smu)
{
Expand All @@ -297,24 +247,13 @@ void SUNDlsMat_bandScale(sunrealtype c, sunrealtype** a, sunindextype n,
}
}

void bandAddIdentity(sunrealtype** a, sunindextype n, sunindextype smu)
{
SUNDlsMat_bandAddIdentity(a, n, smu);
}

void SUNDlsMat_bandAddIdentity(sunrealtype** a, sunindextype n, sunindextype smu)
{
sunindextype j;

for (j = 0; j < n; j++) { a[j][smu] += ONE; }
}

void bandMatvec(sunrealtype** a, sunrealtype* x, sunrealtype* y, sunindextype n,
sunindextype mu, sunindextype ml, sunindextype smu)
{
SUNDlsMat_bandMatvec(a, x, y, n, mu, ml, smu);
}

void SUNDlsMat_bandMatvec(sunrealtype** a, sunrealtype* x, sunrealtype* y,
sunindextype n, sunindextype mu, sunindextype ml,
sunindextype smu)
Expand Down
Loading

0 comments on commit ba9074c

Please sign in to comment.