mac-theobio / McMasterPandemic

SEIR+ model
GNU General Public License v3.0
20 stars 5 forks source link

Explain or fix unused variable warnings coming from compilation of `macpan.cpp` #100

Closed stevencarlislewalker closed 2 years ago

stevencarlislewalker commented 2 years ago

When I compile https://github.com/mac-theobio/McMasterPandemic/commit/f0c8cb878e48e254c71238b966604d43812beb4d, I get the following warnings.

McMasterPandemic.cpp:47:8: warning: unused variable 'rowIndexPtr' [-Wunused-variable]
  int* rowIndexPtr = mat.innerIndexPtr();
       ^
McMasterPandemic.cpp:261:10: warning: unused variable 'outPtr' [-Wunused-variable]
    int* outPtr = ratemat.outerIndexPtr();
         ^
McMasterPandemic.cpp:260:11: warning: unused variable 'valPtr' [-Wunused-variable]
    Type* valPtr = ratemat.valuePtr();
          ^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmb_core.hpp:1145:6: note: in instantiation of member function 'objective_function<CppAD::AD<double>>::operator()' requested here
    F(); // Run through user template (modifies reportvector)
     ^
McMasterPandemic.cpp:260:11: warning: unused variable 'valPtr' [-Wunused-variable]
    Type* valPtr = ratemat.valuePtr();
          ^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmb_core.hpp:1376:34: note: in instantiation of member function 'objective_function<double>::operator()' requested here
      PROTECT( res = asSEXP( pf->operator()() ) );
                                 ^
McMasterPandemic.cpp:260:11: warning: unused variable 'valPtr' [-Wunused-variable]
    Type* valPtr = ratemat.valuePtr();
          ^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmb_core.hpp:916:20: note: in instantiation of member function 'objective_function<CppAD::AD<CppAD::AD<double>>>::operator()' requested here
    Type ans=this->operator()();
                   ^
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/TMB/include/tmb_core.hpp:1425:10: note: in instantiation of member function 'objective_function<CppAD::AD<CppAD::AD<double>>>::evalUserTemplate' requested here
  y[0]=F.evalUserTemplate();
         ^
McMasterPandemic.cpp:260:11: warning: unused variable 'valPtr' [-Wunused-variable]
    Type* valPtr = ratemat.valuePtr();
guanwg commented 2 years ago

Fix the above problem by removing the unused variables.