Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix numerous compiler warnings with mesh generation code #140

Open
czender opened this issue Jun 14, 2019 · 0 comments
Open

Fix numerous compiler warnings with mesh generation code #140

czender opened this issue Jun 14, 2019 · 0 comments
Assignees

Comments

@czender
Copy link
Member

czender commented Jun 14, 2019

@hmb1 please fix these compiler warnings:

gcc -std=c99 -pedantic -D_DEFAULT_SOURCE  -DNCO_BUILDENGINE='Traditional \(nco/bld/Makefile\)' -DLINUXAMD64 -DNO_NETCDF_2 -DNCO_VERSION='4.8.1-alpha05' -DHOSTNAME='grele' -DUSER='zender' -DNCO_ABORT_ON_ERROR -DHAVE_REGEX_H -DNCO_HAVE_REGEX_FUNCTIONALITY -DHAVE_GETPAGESIZE -DHAVE_GETRUSAGE -DNEED_STRCASESTR -DHAVE_NC_INQ_FORMAT -DHAVE_NC_RENAME_GRP -DHAVE_NC_INQ_PATH -DHAVE_NETCDF_MEM_H -DHAVE_MKSTEMP -DHAVE_GETOPT_H -DHAVE_GETOPT_LONG -DHAVE_NEW_CHUNKING_API -DENABLE_DAP -DENABLE_GSL -DHAVE_GSL_H -DENABLE_UDUNITS -DHAVE_UDUNITS_H -DHAVE_UDUNITS2_H -DENABLE_NETCDF4 -DHAVE_NETCDF4_H  -Di386 -I./ -I../src/nco  -I/usr/local/include -I/usr/local/include  -I/usr/include/udunits2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U_OPENMP -Wall -Wuninitialized -Werror=format-security -W -Wmissing-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -fno-common -g -g -Wno-switch -m64 -c ../src/nco/nco_kd.c -o /home/zender/obj/nco_kd.o
../src/nco/nco_kd.c: In function ‘find_min_max_node’:
../src/nco/nco_kd.c:1787:9: warning: variable ‘hort’ set but not used [-Wunused-but-set-variable]
   short hort;
         ^
../src/nco/nco_kd.c:1861:9: warning: variable ‘hort’ set but not used [-Wunused-but-set-variable]
   short hort;
         ^
../src/nco/nco_kd.c:1761:12: warning: variable ‘kd_minval’ set but not used [-Wunused-but-set-variable]
     double kd_minval = (*kd_minval_node)->size[j];
            ^
../src/nco/nco_kd.c: In function ‘kd_nearest_intersect’:
../src/nco/nco_kd.c:2722:30: warning: format ‘%p’ expects argument of type ‘void *’, but argument 4 has type ‘KDElem * {aka struct KDElem_defn *}’ [-Wformat=]
         (void)fprintf(stderr," dist to center: %f units. elem=%p item=%p. x(%.14f,%.14f) y(%.14f,%.14f)\n",
                              ^
../src/nco/nco_kd.c:2682:6: warning: unused variable ‘lcl_cnt’ [-Wunused-variable]
  int lcl_cnt=0;
      ^
../src/nco/nco_kd.c:2681:6: warning: variable ‘node_cnt’ set but not used [-Wunused-but-set-variable]
  int node_cnt;
      ^

and these

gcc -std=c99 -pedantic -D_DEFAULT_SOURCE  -DNCO_BUILDENGINE='Traditional \(nco/bld/Makefile\)' -DLINUXAMD64 -DNO_NETCDF_2 -DNCO_VERSION='4.8.1-alpha05' -DHOSTNAME='grele' -DUSER='zender' -DNCO_ABORT_ON_ERROR -DHAVE_REGEX_H -DNCO_HAVE_REGEX_FUNCTIONALITY -DHAVE_GETPAGESIZE -DHAVE_GETRUSAGE -DNEED_STRCASESTR -DHAVE_NC_INQ_FORMAT -DHAVE_NC_RENAME_GRP -DHAVE_NC_INQ_PATH -DHAVE_NETCDF_MEM_H -DHAVE_MKSTEMP -DHAVE_GETOPT_H -DHAVE_GETOPT_LONG -DHAVE_NEW_CHUNKING_API -DENABLE_DAP -DENABLE_GSL -DHAVE_GSL_H -DENABLE_UDUNITS -DHAVE_UDUNITS_H -DHAVE_UDUNITS2_H -DENABLE_NETCDF4 -DHAVE_NETCDF4_H  -Di386 -I./ -I../src/nco  -I/usr/local/include -I/usr/local/include  -I/usr/include/udunits2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U_OPENMP -Wall -Wuninitialized -Werror=format-security -W -Wmissing-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -fno-common -g -g -Wno-switch -m64 -c ../src/nco/nco_ply.c -o /home/zender/obj/nco_ply.o
../src/nco/nco_ply.c:13:1: warning: no previous prototype for ‘nco_poly_typ_sz’ [-Wmissing-prototypes]
 nco_poly_typ_sz(poly_typ_enm pl_typ)
 ^
../src/nco/nco_ply.c: In function ‘nco_poly_minmax_add’:
../src/nco/nco_ply.c:413:41: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
       if(  ! ( pl->dp_y_minmax[0] > 0.0 && pl->dp_y_minmax[1] > 0.0  ||
                                         ^
../src/nco/nco_ply.c:425:18: warning: declaration of ‘bDeg’ shadows a previous local [-Wshadow]
         nco_bool bDeg=True;
                  ^
../src/nco/nco_ply.c:398:14: note: shadowed declaration is here
     nco_bool bDeg = 1;
              ^
../src/nco/nco_ply.c:427:18: warning: unused variable ‘bInside’ [-Wunused-variable]
         nco_bool bInside=False;
                  ^
../src/nco/nco_ply.c:426:18: warning: unused variable ‘haveControl’ [-Wunused-variable]
         nco_bool haveControl=False;
                  ^
../src/nco/nco_ply.c: In function ‘nco_poly_wrp_splt’:
../src/nco/nco_ply.c:1024:7: warning: unused variable ‘cnt_left’ [-Wunused-variable]
   int cnt_left=0;
       ^
../src/nco/nco_ply.c: In function ‘nco_poly_minmax_2_lon_typ’:
../src/nco/nco_ply.c:1311:10: warning: variable ‘lon_min’ set but not used [-Wunused-but-set-variable]
   double lon_min;

and these

gcc -std=c99 -pedantic -D_DEFAULT_SOURCE  -DNCO_BUILDENGINE='Traditional \(nco/bld/Makefile\)' -DLINUXAMD64 -DNO_NETCDF_2 -DNCO_VERSION='4.8.1-alpha05' -DHOSTNAME='grele' -DUSER='zender' -DNCO_ABORT_ON_ERROR -DHAVE_REGEX_H -DNCO_HAVE_REGEX_FUNCTIONALITY -DHAVE_GETPAGESIZE -DHAVE_GETRUSAGE -DNEED_STRCASESTR -DHAVE_NC_INQ_FORMAT -DHAVE_NC_RENAME_GRP -DHAVE_NC_INQ_PATH -DHAVE_NETCDF_MEM_H -DHAVE_MKSTEMP -DHAVE_GETOPT_H -DHAVE_GETOPT_LONG -DHAVE_NEW_CHUNKING_API -DENABLE_DAP -DENABLE_GSL -DHAVE_GSL_H -DENABLE_UDUNITS -DHAVE_UDUNITS_H -DHAVE_UDUNITS2_H -DENABLE_NETCDF4 -DHAVE_NETCDF4_H  -Di386 -I./ -I../src/nco  -I/usr/local/include -I/usr/local/include  -I/usr/include/udunits2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U_OPENMP -Wall -Wuninitialized -Werror=format-security -W -Wmissing-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -fno-common -g -g -Wno-switch -m64 -c ../src/nco/nco_ply_lst.c -o /home/zender/obj/nco_ply_lst.o
../src/nco/nco_ply_lst.c: In function ‘nco_poly_lst_mk’:
../src/nco/nco_ply_lst.c:117:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(idx=0;idx<grd_sz; idx++)
                ^
../src/nco/nco_ply_lst.c:81:9: warning: unused parameter ‘lat_ctr’ [-Wunused-parameter]
 double *lat_ctr, /* I [dgr] Latitude  centers of source grid */
         ^
../src/nco/nco_ply_lst.c: In function ‘nco_poly_lst_mk_sph’:
../src/nco/nco_ply_lst.c:300:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(idx=0;idx<grd_sz; idx++)
                ^
../src/nco/nco_ply_lst.c: In function ‘nco_poly_lst_mk_vrl’:
../src/nco/nco_ply_lst.c:461:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(idx=0 ; idx<pl_cnt_out;idx++){
                  ^
../src/nco/nco_ply_lst.c:485:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(idx=0 ; idx<pl_cnt_in ;idx++ )
                  ^
../src/nco/nco_ply_lst.c:506:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(jdx=0; jdx <cnt_vrl ;jdx++){
                    ^
../src/nco/nco_ply_lst.c: In function ‘nco_poly_lst_mk_vrl_sph’:
../src/nco/nco_ply_lst.c:632:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(idx=0 ; idx<pl_cnt_out;idx++){
                  ^
../src/nco/nco_ply_lst.c:634:12: warning: unused variable ‘df’ [-Wunused-variable]
     double df=pl_lst_out[idx]->dp_x_minmax[1] - pl_lst_out[idx]->dp_x_minmax[0];
            ^
../src/nco/nco_ply_lst.c:659:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(idx=0 ; idx<pl_cnt_in ;idx++ ) {
                  ^
../src/nco/nco_ply_lst.c:684:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (jdx = 0; jdx < cnt_vrl; jdx++) {
                       ^
../src/nco/nco_ply_lst.c:717:19: warning: unused variable ‘pControl’ [-Wunused-variable]
            double pControl[NBR_SPH];
                   ^
../src/nco/nco_ply_lst.c:799:49: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if( nbr_vrl_blocks * NCO_VRL_BLOCKSIZE  <  pl_cnt_vrl+1  )
                                                 ^
../src/nco/nco_ply_lst.c:841:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (jdx = 0; jdx < cnt_vrl; jdx++)
                               ^
../src/nco/nco_ply_lst.c:880:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if( nbr_vrl_blocks * NCO_VRL_BLOCKSIZE > pl_cnt_vrl  )
                                          ^
../src/nco/nco_ply_lst.c:587:12: warning: unused variable ‘bInside’ [-Wunused-variable]
   nco_bool bInside=True;
            ^
../src/nco/nco_ply_lst.c: In function ‘nco_poly_lst_chk’:
../src/nco/nco_ply_lst.c:980:10: warning: unused variable ‘sum’ [-Wunused-variable]
   double sum=0.0;

and these

gcc -std=c99 -pedantic -D_DEFAULT_SOURCE  -DNCO_BUILDENGINE='Traditional \(nco/bld/Makefile\)' -DLINUXAMD64 -DNO_NETCDF_2 -DNCO_VERSION='4.8.1-alpha05' -DHOSTNAME='grele' -DUSER='zender' -DNCO_ABORT_ON_ERROR -DHAVE_REGEX_H -DNCO_HAVE_REGEX_FUNCTIONALITY -DHAVE_GETPAGESIZE -DHAVE_GETRUSAGE -DNEED_STRCASESTR -DHAVE_NC_INQ_FORMAT -DHAVE_NC_RENAME_GRP -DHAVE_NC_INQ_PATH -DHAVE_NETCDF_MEM_H -DHAVE_MKSTEMP -DHAVE_GETOPT_H -DHAVE_GETOPT_LONG -DHAVE_NEW_CHUNKING_API -DENABLE_DAP -DENABLE_GSL -DHAVE_GSL_H -DENABLE_UDUNITS -DHAVE_UDUNITS_H -DHAVE_UDUNITS2_H -DENABLE_NETCDF4 -DHAVE_NETCDF4_H  -Di386 -I./ -I../src/nco  -I/usr/local/include -I/usr/local/include  -I/usr/include/udunits2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U_OPENMP -Wall -Wuninitialized -Werror=format-security -W -Wmissing-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -fno-common -g -g -Wno-switch -m64 -c ../src/nco/nco_sph.c -o /home/zender/obj/nco_sph.o
../src/nco/nco_sph.c: In function ‘nco_sph_intersect’:
../src/nco/nco_sph.c:138:6: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      while( nx1= nco_sph_cross(P->shp[a1], P->shp[a], Pcross) <DOT_TOLERANCE   )
      ^
../src/nco/nco_sph.c:149:6: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      while(  nx2= nco_sph_cross(Q->shp[b1], Q->shp[b], Qcross) < DOT_TOLERANCE )
      ^
../src/nco/nco_sph.c:282:42: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
           if (code == '1' || code == 'v' && inflag != poly_vrl_unk) {
                                          ^
../src/nco/nco_sph.c:108:11: warning: variable ‘nx3’ set but not used [-Wunused-but-set-variable]
    double nx3;
           ^
../src/nco/nco_sph.c:104:13: warning: unused variable ‘isParallel’ [-Wunused-variable]
    nco_bool isParallel=False;
             ^
../src/nco/nco_sph.c: In function ‘nco_sph_seg_int’:
../src/nco/nco_sph.c:412:10: warning: variable ‘darc’ set but not used [-Wunused-but-set-variable]
   double darc;
          ^
../src/nco/nco_sph.c:404:10: warning: variable ‘nx_ci’ set but not used [-Wunused-but-set-variable]
   double nx_ci;
          ^
../src/nco/nco_sph.c:401:10: warning: variable ‘nx2’ set but not used [-Wunused-but-set-variable]
   double nx2;
          ^
../src/nco/nco_sph.c:394:86: warning: unused parameter ‘q’ [-Wunused-parameter]
 char  nco_sph_seg_int(double *a, double *b, double *c, double *d, double *p, double *q)
                                                                                      ^
../src/nco/nco_sph.c: In function ‘nco_sph_seg_parallel’:
../src/nco/nco_sph.c:564:10: warning: variable ‘nx3’ set but not used [-Wunused-but-set-variable]
   double nx3;
          ^
../src/nco/nco_sph.c:563:10: warning: variable ‘nx2’ set but not used [-Wunused-but-set-variable]
   double nx2;
          ^
../src/nco/nco_sph.c:562:10: warning: variable ‘nx1’ set but not used [-Wunused-but-set-variable]
   double nx1;
          ^
../src/nco/nco_sph.c:557:14: warning: unused variable ‘fnc_nm’ [-Wunused-variable]
   const char fnc_nm[] = "nco_sph_seg_parallel()";
              ^
../src/nco/nco_sph.c: In function ‘nco_sph_seg_vrt_int’:
../src/nco/nco_sph.c:699:10: warning: variable ‘nx_av’ set but not used [-Wunused-but-set-variable]
   double nx_av;
          ^
../src/nco/nco_sph.c:698:10: warning: variable ‘nx_ab’ set but not used [-Wunused-but-set-variable]
   double nx_ab;
          ^
../src/nco/nco_sph.c: At top level:
../src/nco/nco_sph.c:731:7: warning: no previous prototype for ‘nco_sph_seg_int_1’ [-Wmissing-prototypes]
 char  nco_sph_seg_int_1(double *a, double *b, double *c, double *d, double *p, double *q)
       ^
../src/nco/nco_sph.c:1150:10: warning: no previous prototype for ‘sxBetween’ [-Wmissing-prototypes]
 nco_bool sxBetween(double *a, double *b, double *c)
          ^
../src/nco/nco_sph.c: In function ‘nco_sph_parallel_lat’:
../src/nco/nco_sph.c:1170:78: warning: unused parameter ‘a’ [-Wunused-parameter]
 nco_sph_parallel_lat(double *p1, double *p2, double *q1, double *q2, double *a, double *b)
                                                                              ^
../src/nco/nco_sph.c:1170:89: warning: unused parameter ‘b’ [-Wunused-parameter]
 nco_sph_parallel_lat(double *p1, double *p2, double *q1, double *q2, double *a, double *b)
                                                                                         ^
../src/nco/nco_sph.c: In function ‘nco_sph_is_convex’:
../src/nco/nco_sph.c:1302:8: warning: unused variable ‘rad’ [-Wunused-variable]
 double rad=1.0;
        ^
../src/nco/nco_sph.c:1301:8: warning: unused variable ‘rad1_nco’ [-Wunused-variable]
 double rad1_nco=1.0;
        ^
../src/nco/nco_sph.c: In function ‘nco_sph_mk_control’:
../src/nco/nco_sph.c:1351:8: warning: unused variable ‘iret’ [-Wunused-variable]
    int iret=NCO_ERR;
        ^
../src/nco/nco_sph.c: In function ‘nco_rll_intersect’:
../src/nco/nco_sph.c:1781:10: warning: unused variable ‘Xcross’ [-Wunused-variable]
   double Xcross[NBR_SPH];
          ^
../src/nco/nco_sph.c:1774:10: warning: unused variable ‘nx3’ [-Wunused-variable]
   double nx3;
          ^
../src/nco/nco_sph.c:1773:10: warning: variable ‘nx2’ set but not used [-Wunused-but-set-variable]
   double nx2;
          ^
../src/nco/nco_sph.c:1772:10: warning: variable ‘nx1’ set but not used [-Wunused-but-set-variable]
   double nx1;
          ^
../src/nco/nco_sph.c: In function ‘nco_rll_seg_int’:
../src/nco/nco_sph.c:2102:85: warning: unused parameter ‘r1’ [-Wunused-parameter]
 nco_rll_seg_int(double *p0, double *p1, double *q0, double *q1, double *r0, double *r1)
                                                                                     ^
../src/nco/nco_sph.c: In function ‘nco_rll_seg_parallel’:
../src/nco/nco_sph.c:2154:7: warning: unused variable ‘q_sgn’ [-Wunused-variable]
   int q_sgn=1;
       ^
../src/nco/nco_sph.c:2153:7: warning: unused variable ‘p_sgn’ [-Wunused-variable]
   int p_sgn=1;
       ^
../src/nco/nco_sph.c: At top level:
../src/nco/nco_sph.c:2233:6: warning: no previous prototype for ‘nco_rll_add_pnt’ [-Wmissing-prototypes]
 void nco_rll_add_pnt(double **R, int *r, double *P)
      ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants