grass-addons icon indicating copy to clipboard operation
grass-addons copied to clipboard

v.kriging: fix compilation warnings

Open tmszi opened this issue 2 years ago • 2 comments

Fix compilation warnings:

utils_kriging.c: In function ‘crossvalidation’:
utils_kriging.c:716:32: warning: passing argument 3 of ‘submatrix’ from incompatible pointer type [-Wincompatible-pointer-types]
  716 |                                &xD->report);   // create submatrix using indices
      |                                ^~~~~~~~~~~
      |                                |
      |                                struct write **
utils_kriging.c:415:37: note: expected ‘struct write *’ but argument is of type ‘struct write **’
  415 |                       struct write *report)
      |                       ~~~~~~~~~~~~~~^~~~~~
utils_kriging.c: In function ‘compare_NN’:
utils_kriging.c:837:26: warning: initialization of ‘double *’ from incompatible pointer type ‘int *’ [-Wincompatible-pointer-types]
  837 |     double *list_value = list->value;
      |                          ^~~~
utils_kriging.c:838:30: warning: initialization of ‘double *’ from incompatible pointer type ‘int *’ [-Wincompatible-pointer-types]
  838 |     double *list_new_value = list_new->value;
      |                              ^~~~~~~~
utils_kriging.c: In function ‘make_subsamples’:
utils_kriging.c:862:28: warning: initialization of ‘struct write *’ from incompatible pointer type ‘struct write **’ [-Wincompatible-pointer-types]
  862 |     struct write *report = &xD->report;
      |                            ^
utils_raster.c: In function ‘open_layer’:
utils_raster.c:6:28: warning: initialization of ‘struct write *’ from incompatible pointer type ‘struct write **’ [-Wincompatible-pointer-types]
    6 |     struct write *report = &xD->report;
      |                            ^
utils_raster.c: In function ‘write2layer’:
utils_raster.c:37:28: warning: initialization of ‘struct write *’ from incompatible pointer type ‘struct write **’ [-Wincompatible-pointer-types]
   37 |     struct write *report = &xD->report;

line 100 print warning too:

utils_kriging.c: In function ‘LMS_variogram’:
utils_kriging.c:100:73: warning: format ‘%f’ expects a matching ‘double’ argument [-Wformat=]
  100 |             fprintf(report->fp, "gamma(h, vert) = %f * h + %f * vert + %f\n",
      |                                                                        ~^
      |                                                                         |
      |                                                                         double

line 94 and 100 look the same (fprintf() func has same string arg):

https://github.com/OSGeo/grass-addons/blob/5633a4b704932c46e813862741e6f744846da764/src/vector/v.kriging/utils_kriging.c#L91-L103

Is there a difference between the number of bivariate and univariate variogram parameters?

tmszi avatar Jul 26 '23 07:07 tmszi

@tmszi Compilation on Ubuntu 22.04, GRASS GIS 8.4dev works for me. Ready to merge?

ecodiv avatar May 31 '24 20:05 ecodiv

Is this PR expected to solve the warning on line utils_kriging.c:100:73 too? https://github.com/OSGeo/grass-addons/actions/runs/9323949717/job/25668192575?pr=934#step:13:4125

Apart from that, indeed there aren't any other warnings when searching for 'kriging' in the logs

echoix avatar Jun 01 '24 18:06 echoix