alyssajs / FLOPART

0 stars 2 forks source link

fix compilation warnings #7

Closed tdhock closed 3 years ago

tdhock commented 3 years ago

this is on windows with R-4.0.2 and Rtools40,

> remotes::install_github("alyssajs/FLOPART")
...
"C:/rtools40/mingw64/bin/"g++ -std=gnu++11  -I"c:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -UNDEBUG -g          -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c funPieceListLog.cpp -o funPieceListLog.o
funPieceListLog.cpp: In member function 'void PiecewisePoissonLossLog::set_to_min_less_of(PiecewisePoissonLossLog*, int)':
funPieceListLog.cpp:302:14: warning: unused variable 'right_left_equal' [-Wunused-variable]
         bool right_left_equal = right_left_diff < NEWTON_EPSILON;
              ^~~~~~~~~~~~~~~~
funPieceListLog.cpp: In member function 'double PiecewisePoissonLossLog::findCost(double)':
funPieceListLog.cpp:666:11: warning: unused variable 'verbose' [-Wunused-variable]
       int verbose = 0;
           ^~~~~~~
funPieceListLog.cpp: In member function 'void PiecewisePoissonLossLog::Minimize(MinimizeResult*)':
funPieceListLog.cpp:694:7: warning: unused variable 'verbose' [-Wunused-variable]
   int verbose=false;
       ^~~~~~~
funPieceListLog.cpp: In member function 'int PiecewisePoissonLossLog::check_min_of(PiecewisePoissonLossLog*, PiecewisePoissonLossLog*)':
funPieceListLog.cpp:718:7: warning: unused variable 'verbose' [-Wunused-variable]
   int verbose = 0;
       ^~~~~~~
funPieceListLog.cpp: In member function 'double PoissonLossPieceLog::get_larger_root(double)':
funPieceListLog.cpp:116:41: warning: 'closest_negative_mean' may be used uninitialized in this function [-Wmaybe-uninitialized]
       return log((closest_positive_mean + closest_negative_mean)/2);
                  ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
funPieceListLog.cpp:116:41: warning: 'closest_positive_mean' may be used uninitialized in this function [-Wmaybe-uninitialized]
funPieceListLog.cpp: In member function 'double PoissonLossPieceLog::get_smaller_root(double)':
funPieceListLog.cpp:190:41: warning: 'closest_negative_log_mean' may be used uninitialized in this function [-Wmaybe-uninitialized]
       return (closest_positive_log_mean + closest_negative_log_mean)/2;
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
funPieceListLog.cpp:190:41: warning: 'closest_positive_log_mean' may be used uninitialized in this function [-Wmaybe-uninitialized]
funPieceListLog.cpp: In member function 'void PiecewisePoissonLossLog::set_to_min_less_of(PiecewisePoissonLossLog*, int)':
funPieceListLog.cpp:23:17: warning: 'prev_best_log_mean' may be used uninitialized in this function [-Wmaybe-uninitialized]
   prev_log_mean = prev;
   ~~~~~~~~~~~~~~^~~~~~
funPieceListLog.cpp:275:10: note: 'prev_best_log_mean' was declared here
   double prev_best_log_mean;
          ^~~~~~~~~~~~~~~~~~
funPieceListLog.cpp:354:18: warning: 'next_left_cost' may be used uninitialized in this function [-Wmaybe-uninitialized]
           Rprintf("next_left_cost-mu_cost=%e right_cost-mu_cost=%e\n", next_left_cost-mu_cost, right_cost-mu_cost);
           ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
funPieceListLog.cpp: In member function 'void PiecewisePoissonLossLog::set_to_min_more_of(PiecewisePoissonLossLog*, int)':
funPieceListLog.cpp:23:17: warning: 'prev_best_log_mean' may be used uninitialized in this function [-Wmaybe-uninitialized]
   prev_log_mean = prev;
   ~~~~~~~~~~~~~~^~~~~~
funPieceListLog.cpp:486:10: note: 'prev_best_log_mean' was declared here
   double prev_best_log_mean;
          ^~~~~~~~~~~~~~~~~~

looks like there are two kinds,