Skip to content

Commit

Permalink
Use attributes for df1b2-separable.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnoel committed Dec 12, 2023
1 parent 40a7b9f commit e663760
Show file tree
Hide file tree
Showing 36 changed files with 87 additions and 87 deletions.
2 changes: 1 addition & 1 deletion src/df1b2-separable/df1b2chkder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ adtimer* ad_comm::ptm1 = nullptr;
* \param
*/
void laplace_approximation_calculator::
check_derivatives(__attribute__((unused)) const dvector& _x, __attribute__((unused)) function_minimizer* pfmin, __attribute__((unused)) double f)
check_derivatives([[maybe_unused]] const dvector& _x, [[maybe_unused]] function_minimizer* pfmin, [[maybe_unused]] double f)
{
#ifdef DIAG
cerr << "need to define this" << endl;
Expand Down
18 changes: 9 additions & 9 deletions src/df1b2-separable/df1b2f15.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void df1b2_init_vector::allocate(int mmin,int mmax,const adstring&s)
* Description not yet available.
* \param
*/
void df1b2_init_vector::allocate(int mmin,int mmax,int ps, __attribute__((unused)) const adstring&s)
void df1b2_init_vector::allocate(int mmin,int mmax,int ps, [[maybe_unused]] const adstring&s)
{
set_phase_start(ps);
df1b2vector::allocate(mmin,mmax);
Expand Down Expand Up @@ -109,7 +109,7 @@ int initial_df1b2params::set_index(void)
* \param
*/
void df1b2_init_vector::set_value(const init_df1b2vector& _x,
const int& _ii, __attribute__((unused)) const df1b2variable& pen)
const int& _ii, [[maybe_unused]] const df1b2variable& pen)
{
ADUNCONST(init_df1b2vector,x)
ADUNCONST(int,ii)
Expand Down Expand Up @@ -220,7 +220,7 @@ void df1b2_init_matrix::set_index(int aflag,const int& _ii)
* \param
*/
void df1b2_init_matrix::set_value(const init_df1b2vector& _x,
const int& _ii, __attribute__((unused)) const df1b2variable& pen)
const int& _ii, [[maybe_unused]] const df1b2variable& pen)
{
ADUNCONST(init_df1b2vector,x)
ADUNCONST(int,ii)
Expand All @@ -245,7 +245,7 @@ void df1b2_init_matrix::set_value(const init_df1b2vector& _x,
* \param
*/
void df1b2_init_number::set_value(const init_df1b2vector& _x,const int& _ii,
__attribute__((unused)) const df1b2variable& pen)
[[maybe_unused]] const df1b2variable& pen)
{
ADUNCONST(init_df1b2vector,x)
ADUNCONST(int,ii)
Expand All @@ -259,7 +259,7 @@ void df1b2_init_number::set_value(const init_df1b2vector& _x,const int& _ii,
* Description not yet available.
* \param
*/
void df1b2_init_number::allocate(__attribute__((unused)) const adstring& s)
void df1b2_init_number::allocate([[maybe_unused]] const adstring& s)
{
if (!df1b2variable::noallocate)
{
Expand All @@ -272,7 +272,7 @@ void df1b2_init_number::allocate(__attribute__((unused)) const adstring& s)
* Description not yet available.
* \param
*/
void df1b2_init_number::allocate(int _n, __attribute__((unused)) const adstring& s)
void df1b2_init_number::allocate(int _n, [[maybe_unused]] const adstring& s)
{
df1b2variable::allocate();
set_phase_start(_n);
Expand All @@ -282,7 +282,7 @@ void df1b2_init_number::allocate(int _n, __attribute__((unused)) const adstring&
* Description not yet available.
* \param
*/
void df1b2variable::allocate(__attribute__((unused)) const char *s)
void df1b2variable::allocate([[maybe_unused]] const char *s)
{
df1b2variable::allocate();
}
Expand Down Expand Up @@ -707,7 +707,7 @@ void df1b2_init_bounded_vector::allocate(int mmin,int mmax,
* \param
*/
void df1b2_init_bounded_vector::allocate(int mmin,int mmax,
double _minb,double _maxb, __attribute__((unused)) const char* s)
double _minb,double _maxb, [[maybe_unused]] const char* s)
{
allocate(mmin,mmax,_minb,_maxb);
}
Expand All @@ -717,7 +717,7 @@ void df1b2_init_bounded_vector::allocate(int mmin,int mmax,
* \param
*/
void df1b2_init_bounded_vector::allocate(int mmin,int mmax,
double _minb,double _maxb,int n, __attribute__((unused)) const char * s)
double _minb,double _maxb,int n, [[maybe_unused]] const char * s)
{
allocate(mmin,mmax,_minb,_maxb);
set_phase_start(n);
Expand Down
6 changes: 3 additions & 3 deletions src/df1b2-separable/df1b2f25.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* Description not yet available.
* \param
*/
void df1b2_init_number::sd_scale(const dvector& _d, __attribute__((unused)) const dvector& x,
void df1b2_init_number::sd_scale(const dvector& _d, [[maybe_unused]] const dvector& x,
const int& _ii)
{
int& ii=(int&) _ii;
Expand Down Expand Up @@ -82,7 +82,7 @@ void df1b2_init_bounded_number::sd_scale(const dvector& _d,const dvector& x,
* Description not yet available.
* \param
*/
void df1b2_init_vector::sd_scale(const dvector& _v, __attribute__((unused)) const dvector& x,
void df1b2_init_vector::sd_scale(const dvector& _v, [[maybe_unused]] const dvector& x,
const int& _ii)
{
if (allocated())
Expand All @@ -104,7 +104,7 @@ void df1b2_init_vector::sd_scale(const dvector& _v, __attribute__((unused)) cons
* Description not yet available.
* \param
*/
void df1b2_init_matrix::sd_scale(const dvector& _v, __attribute__((unused)) const dvector& x,
void df1b2_init_matrix::sd_scale(const dvector& _v, [[maybe_unused]] const dvector& x,
const int& _ii)
{
if (allocated())
Expand Down
6 changes: 3 additions & 3 deletions src/df1b2-separable/df1b2fn2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ double d3F(P_USER_FUNCTION pu,const init_df1b2vector& _x,int i,int j,int k,
* Description not yet available.
* \param
*/
dmatrix check_second_derivatives(__attribute__((unused)) const init_df1b2vector& x)
dmatrix check_second_derivatives([[maybe_unused]] const init_df1b2vector& x)
{
f1b2gradlist->set_no_derivatives();
#ifdef OPT_LIB
Expand All @@ -831,7 +831,7 @@ dmatrix check_second_derivatives(__attribute__((unused)) const init_df1b2vector&
* Description not yet available.
* \param
*/
d3_array check_third_derivatives(__attribute__((unused)) const init_df1b2vector& x)
d3_array check_third_derivatives([[maybe_unused]] const init_df1b2vector& x)
{
f1b2gradlist->set_no_derivatives();
#ifdef OPT_LIB
Expand Down Expand Up @@ -932,7 +932,7 @@ void re_objective_function_value::allocate(void)
* Description not yet available.
* \param
*/
void re_objective_function_value::allocate(__attribute__((unused)) const char * s)
void re_objective_function_value::allocate([[maybe_unused]] const char * s)
{
pobjfun=this;
df1b2variable::allocate();
Expand Down
4 changes: 2 additions & 2 deletions src/df1b2-separable/df1b2fn5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ df1b2variable::df1b2variable(void)
* Description not yet available.
* \param
*/
df1b2variable::df1b2variable(__attribute__((unused)) const newadkludge* z)
df1b2variable::df1b2variable([[maybe_unused]] const newadkludge* z)
{
ptr=0;
ncopies=0;
Expand Down Expand Up @@ -154,7 +154,7 @@ void df1b2variable::allocate(void)
* Description not yet available.
* \param
*/
df1b2variable::df1b2variable(__attribute__((unused)) adkludge1 * adkludgexxx)
df1b2variable::df1b2variable([[maybe_unused]] adkludge1 * adkludgexxx)
{
// vectors are all 1,...,nvar
ptr = (double*) pool->alloc();
Expand Down
6 changes: 3 additions & 3 deletions src/df1b2-separable/df1b2fnl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ funnel_init_df1b2variable::funnel_init_df1b2variable
* Description not yet available.
* \param
*/
void funnel_init_df1b2variable::allocate(__attribute__((unused)) const df1b2variable& x)
void funnel_init_df1b2variable::allocate([[maybe_unused]] const df1b2variable& x)
{
cerr << "Haven't defined htis yet" << endl;
ad_exit(1);
Expand Down Expand Up @@ -851,7 +851,7 @@ void funnel_init_df1b2vector::set_index(imatrix& y,int& ii)
* \param
*/
void funnel_init_df1b2vector::set_value(const init_df1b2vector& _x,
const int& _ii, __attribute__((unused)) const df1b2variable& _pen)
const int& _ii, [[maybe_unused]] const df1b2variable& _pen)
{
ADUNCONST(int,ii)
ADUNCONST(init_df1b2vector,x)
Expand Down Expand Up @@ -942,7 +942,7 @@ void funnel_init_bounded_df1b2vector::set_index(imatrix& y,int& ii)
* \param
*/
void funnel_init_bounded_df1b2vector::set_value(const init_df1b2vector& _x,
const int& _ii, __attribute__((unused)) const df1b2variable& _pen)
const int& _ii, [[maybe_unused]] const df1b2variable& _pen)
{
ADUNCONST(int,ii)
ADUNCONST(init_df1b2vector,x)
Expand Down
32 changes: 16 additions & 16 deletions src/df1b2-separable/df1b2fun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ double ADdiff_fun(double x,double y)
* Description not yet available.
* \param
*/
double ADzero_fun(__attribute__((unused)) double x, __attribute__((unused)) double y)
double ADzero_fun([[maybe_unused]] double x, [[maybe_unused]] double y)
{
return 0.0;
}
Expand All @@ -583,7 +583,7 @@ double ADzero_fun(__attribute__((unused)) double x, __attribute__((unused)) doub
* Description not yet available.
* \param
*/
double ADzero_fun(__attribute__((unused)) double x)
double ADzero_fun([[maybe_unused]] double x)
{
return 0.0;
}
Expand All @@ -592,7 +592,7 @@ double ADzero_fun(__attribute__((unused)) double x)
* Description not yet available.
* \param
*/
double AD1_fun(__attribute__((unused)) double x)
double AD1_fun([[maybe_unused]] double x)
{
return 1.0;
}
Expand All @@ -601,7 +601,7 @@ double AD1_fun(__attribute__((unused)) double x)
* Description not yet available.
* \param
*/
double AD1_fun(__attribute__((unused)) double x, __attribute__((unused)) double y)
double AD1_fun([[maybe_unused]] double x, [[maybe_unused]] double y)
{
return 1.0;
}
Expand All @@ -610,7 +610,7 @@ double AD1_fun(__attribute__((unused)) double x, __attribute__((unused)) double
* Description not yet available.
* \param
*/
double ADm1_fun(__attribute__((unused)) double x, __attribute__((unused)) double y)
double ADm1_fun([[maybe_unused]] double x, [[maybe_unused]] double y)
{
return -1.0;
}
Expand All @@ -628,7 +628,7 @@ double AD_id(double x)
* Description not yet available.
* \param
*/
double ADfirst_arg(double x, __attribute__((unused)) double y)
double ADfirst_arg(double x, [[maybe_unused]] double y)
{
return x;
}
Expand All @@ -637,7 +637,7 @@ double ADfirst_arg(double x, __attribute__((unused)) double y)
* Description not yet available.
* \param
*/
double ADsecond_arg_plus1(__attribute__((unused)) double x, double y)
double ADsecond_arg_plus1([[maybe_unused]] double x, double y)
{
return y+1;
}
Expand All @@ -646,7 +646,7 @@ double ADsecond_arg_plus1(__attribute__((unused)) double x, double y)
* Description not yet available.
* \param
*/
double ADsecond_arg(__attribute__((unused)) double x, double y)
double ADsecond_arg([[maybe_unused]] double x, double y)
{
return y;
}
Expand All @@ -655,7 +655,7 @@ double ADsecond_arg(__attribute__((unused)) double x, double y)
* Description not yet available.
* \param
*/
double AD_div_1(__attribute__((unused)) double x, double y)
double AD_div_1([[maybe_unused]] double x, double y)
{
return 1.0/y;
}
Expand All @@ -682,7 +682,7 @@ double AD_div_22(double x,double y)
* Description not yet available.
* \param
*/
double AD_div_122(__attribute__((unused)) double x, double y)
double AD_div_122([[maybe_unused]] double x, double y)
{
return 2.0/(y*y*y);
}
Expand All @@ -691,7 +691,7 @@ double AD_div_122(__attribute__((unused)) double x, double y)
* Description not yet available.
* \param
*/
double AD_div_12(__attribute__((unused)) double x, double y)
double AD_div_12([[maybe_unused]] double x, double y)
{
return -1.0/(y*y);
}
Expand All @@ -700,7 +700,7 @@ double AD_div_12(__attribute__((unused)) double x, double y)
* Description not yet available.
* \param
*/
double AD_div_11(__attribute__((unused)) double x, __attribute__((unused)) double y)
double AD_div_11([[maybe_unused]] double x, [[maybe_unused]] double y)
{
return 0.0;
}
Expand All @@ -709,7 +709,7 @@ double AD_div_11(__attribute__((unused)) double x, __attribute__((unused)) doubl
* Description not yet available.
* \param
*/
double AD_div_111(__attribute__((unused)) double x, __attribute__((unused)) double y)
double AD_div_111([[maybe_unused]] double x, [[maybe_unused]] double y)
{
return 0.0;
}
Expand All @@ -718,7 +718,7 @@ double AD_div_111(__attribute__((unused)) double x, __attribute__((unused)) doub
* Description not yet available.
* \param
*/
double AD_div_112(__attribute__((unused)) double x, __attribute__((unused)) double y)
double AD_div_112([[maybe_unused]] double x, [[maybe_unused]] double y)
{
return 0.0;
}
Expand Down Expand Up @@ -815,7 +815,7 @@ double ADsix_id_fun(double x)
* Description not yet available.
* \param
*/
double ADsix_fun(__attribute__((unused)) double x)
double ADsix_fun([[maybe_unused]] double x)
{
return 6.0;
}
Expand All @@ -824,7 +824,7 @@ double ADsix_fun(__attribute__((unused)) double x)
* Description not yet available.
* \param
*/
double ADtwo_fun(__attribute__((unused)) double x)
double ADtwo_fun([[maybe_unused]] double x)
{
return 2.0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/df1b2-separable/df1b2gh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
double do_gauss_hermite_block_diagonal(const dvector& x,
const dvector& u0,const dmatrix& Hess,const dvector& _xadjoint,
const dvector& _uadjoint, __attribute__((unused)) const dmatrix& _Hessadjoint,
const dvector& _uadjoint, [[maybe_unused]] const dmatrix& _Hessadjoint,
function_minimizer * pmin)
{
ADUNCONST(dvector,xadjoint)
Expand Down
2 changes: 1 addition & 1 deletion src/df1b2-separable/df1b2ghmult.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
double do_gauss_hermite_block_diagonal_multi(const dvector& x,
const dvector& u0,const dmatrix& Hess,const dvector& _xadjoint,
const dvector& _uadjoint, __attribute__((unused)) const dmatrix& _Hessadjoint,
const dvector& _uadjoint, [[maybe_unused]] const dmatrix& _Hessadjoint,
function_minimizer * pmin)
{
ADUNCONST(dvector,xadjoint)
Expand Down
2 changes: 1 addition & 1 deletion src/df1b2-separable/df1b2im3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
double calculate_importance_sample_block_diagonal(const dvector& x,
const dvector& u0,const dmatrix& Hess,const dvector& _xadjoint,
const dvector& _uadjoint, __attribute__((unused)) const dmatrix& _Hessadjoint,
const dvector& _uadjoint, [[maybe_unused]] const dmatrix& _Hessadjoint,
function_minimizer * pmin)
{
ADUNCONST(dvector,xadjoint)
Expand Down
2 changes: 1 addition & 1 deletion src/df1b2-separable/df1b2im3f.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
double calculate_importance_sample_block_diagonal_funnel(const dvector& x,
const dvector& u0,const dmatrix& Hess,const dvector& _xadjoint,
const dvector& _uadjoint, __attribute__((unused)) const dmatrix& _Hessadjoint,
const dvector& _uadjoint, [[maybe_unused]] const dmatrix& _Hessadjoint,
function_minimizer * pmin)
{
ADUNCONST(dvector,xadjoint)
Expand Down
2 changes: 1 addition & 1 deletion src/df1b2-separable/df1b2im4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
double calculate_importance_sample_block_diagonal_option2(const dvector& x,
const dvector& u0,const dmatrix& Hess,const dvector& _xadjoint,
const dvector& _uadjoint, __attribute__((unused)) const dmatrix& _Hessadjoint,
const dvector& _uadjoint, [[maybe_unused]] const dmatrix& _Hessadjoint,
function_minimizer * pmin)
{
ADUNCONST(dvector,xadjoint)
Expand Down
2 changes: 1 addition & 1 deletion src/df1b2-separable/df1b2im5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
double calculate_importance_sample_block_diagonal_option_antithetical
(const dvector& x,const dvector& u0,const dmatrix& Hess,
const dvector& _xadjoint,const dvector& _uadjoint,
__attribute__((unused)) const dmatrix& _Hessadjoint,function_minimizer * pmin)
[[maybe_unused]] const dmatrix& _Hessadjoint,function_minimizer * pmin)
{
ADUNCONST(dvector,xadjoint)
ADUNCONST(dvector,uadjoint)
Expand Down
2 changes: 1 addition & 1 deletion src/df1b2-separable/df1b2impspf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class dvar_hs_smatrix;
*/
double calculate_importance_sample_shess(const dvector& x,const dvector& u0,
const dmatrix& Hess,const dvector& _xadjoint,const dvector& _uadjoint,
__attribute__((unused)) const dmatrix& _Hessadjoint,function_minimizer * pmin)
[[maybe_unused]] const dmatrix& _Hessadjoint,function_minimizer * pmin)
{
ADUNCONST(dvector,xadjoint)
ADUNCONST(dvector,uadjoint)
Expand Down
Loading

0 comments on commit e663760

Please sign in to comment.