anujkhare/iregnet

compilation warnings

tdhock opened this issue · 0 comments

Hi @anujkhare @theadityasam I am getting these compiler warnings on my system. Although the code compiles/installs, it would be good to fix those warnings when you get a chance.

c:/Rtools/mingw_64/bin/g++  -I"c:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG  -I"C:/Users/th798/R/win-library/3.6/Rcpp/include"        -O2 -Wall  -mtune=generic -c distributions.cpp -o distributions.o
distributions.cpp: In function 'double compute_grad_response(double*, double*, double*, const double*, const double*, const double*, double, const IREG_CENSORING*, long long unsigned int, IREG_DIST, double*, bool)':
distributions.cpp:69:9: warning: enumeration value 'IREG_DIST_LOG_GAUSSIAN' not handled in switch [-Wswitch]
   switch(dist) {
         ^
distributions.cpp:69:9: warning: enumeration value 'IREG_DIST_LOG_LOGISTIC' not handled in switch [-Wswitch]
distributions.cpp:69:9: warning: enumeration value 'IREG_DIST_EXPONENTIAL' not handled in switch [-Wswitch]
distributions.cpp:69:9: warning: enumeration value 'IREG_DIST_WEIBULL' not handled in switch [-Wswitch]
distributions.cpp:69:9: warning: enumeration value 'IREG_DIST_UNKNOWN' not handled in switch [-Wswitch]
distributions.cpp: In function 'Rcpp::List iregnet_compute_gradients(Rcpp::NumericMatrix, Rcpp::NumericMatrix, Rcpp::NumericVector, double, Rcpp::String)':
distributions.cpp:426:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (ull j = 0; j < n_vars; ++j) {
                     ^
distributions.cpp:428:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (ull i = 0; i < n_obs; ++i) {
                       ^
distributions.cpp: In function 'double compute_grad_response(double*, double*, double*, const double*, const double*, const double*, double, const IREG_CENSORING*, long long unsigned int, IREG_DIST, double*, bool)':
distributions.cpp:229:25: warning: 'ddsig' may be used uninitialized in this function [-Wmaybe-uninitialized]
       ddsig_sum += ddsig;
                         ^
distributions.cpp:228:23: warning: 'dsig' may be used uninitialized in this function [-Wmaybe-uninitialized]
       dsig_sum += dsig;
                       ^
distributions.cpp:219:26: warning: 'ddg' may be used uninitialized in this function [-Wmaybe-uninitialized]
     if (dsig == 0 || ddg == 0)
                          ^
distributions.cpp:222:30: warning: 'dg' may be used uninitialized in this function [-Wmaybe-uninitialized]
       response = eta[i] - dg / ddg;
                              ^
c:/Rtools/mingw_64/bin/g++  -I"c:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG  -I"C:/Users/th798/R/win-library/3.6/Rcpp/include"        -O2 -Wall  -mtune=generic -c iregnet_fit.cpp -o iregnet_fit.o
iregnet_fit.cpp: In function 'Rcpp::List fit_cpp(Rcpp::NumericMatrix, Rcpp::NumericMatrix, Rcpp::String, Rcpp::NumericVector, int, Rcpp::IntegerVector, bool, double, double, bool, bool, bool, double, double, int, double)':
iregnet_fit.cpp:126:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(ull i = 0; i < num_lambda; ++i) {
                      ^
iregnet_fit.cpp:339:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (ull m = 0; m <= end_ind; ++m) {
                     ^
iregnet_fit.cpp:212:10: warning: variable 'lambda_max_unscaled' set but not used [-Wunused-but-set-variable]
   double lambda_max_unscaled;
          ^
iregnet_fit.cpp: In function 'double get_y_means(Rcpp::NumericMatrix&, IREG_CENSORING*, double*)':
iregnet_fit.cpp:382:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (ull i = 0; i < y.nrow(); ++i) {
                     ^
iregnet_fit.cpp: In function 'void get_censoring_types(Rcpp::NumericMatrix&, IREG_CENSORING*)':
iregnet_fit.cpp:407:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (ull i = 0; i < y.nrow(); ++i) {
                     ^
iregnet_fit.cpp: In function 'void standardize_x(Rcpp::NumericMatrix&, double*, double*, bool)':
iregnet_fit.cpp:467:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (ull i = int(intercept); i < X.ncol(); ++i) {  // don't standardize intercept col.
                                  ^
iregnet_fit.cpp:469:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (ull j = 0; j < X.nrow(); ++j) {
                       ^
iregnet_fit.cpp:474:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (ull j = 0; j < X.nrow(); ++j) {
                       ^
iregnet_fit.cpp:482:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (ull j = 0; j < X.nrow(); ++j) {
                       ^
iregnet_fit.cpp: In function 'void standardize_y(Rcpp::NumericMatrix&, double*, double&)':
iregnet_fit.cpp:491:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (ull i = 0; i < y.nrow() * y.ncol(); ++i) {
                     ^
iregnet_fit.cpp:494:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (ull i = 0; i < y.nrow(); ++i)
                     ^
iregnet_fit.cpp: In function 'double get_init_var(double*, IREG_CENSORING*, long long unsigned int, IREG_DIST)':
iregnet_fit.cpp:503:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < n; ++i) {
                     ^
iregnet_fit.cpp:508:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < n; ++i) {
                     ^
iregnet_fit.cpp:513:10: warning: enumeration value 'IREG_DIST_GAUSSIAN' not handled in switch [-Wswitch]
   switch (dist) {
          ^
iregnet_fit.cpp:513:10: warning: enumeration value 'IREG_DIST_LOG_GAUSSIAN' not handled in switch [-Wswitch]
iregnet_fit.cpp:513:10: warning: enumeration value 'IREG_DIST_LOG_LOGISTIC' not handled in switch [-Wswitch]
iregnet_fit.cpp:513:10: warning: enumeration value 'IREG_DIST_EXPONENTIAL' not handled in switch [-Wswitch]
iregnet_fit.cpp:513:10: warning: enumeration value 'IREG_DIST_WEIBULL' not handled in switch [-Wswitch]
iregnet_fit.cpp:513:10: warning: enumeration value 'IREG_DIST_UNKNOWN' not handled in switch [-Wswitch]
c:/Rtools/mingw_64/bin/g++ -shared -s -static-libgcc -o iregnet.dll tmp.def RcppExports.o distributions.o iregnet_fit.o -Lc:/PROGRA~1/R/R-36~1.1/bin/x64 -lR
installing to C:/Users/th798/R/win-library/3.6/00LOCK-iregnet/00new/iregnet/libs/x64