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

Complier warnings #41

Open
bkmgit opened this issue Dec 24, 2022 · 1 comment
Open

Complier warnings #41

bkmgit opened this issue Dec 24, 2022 · 1 comment

Comments

@bkmgit
Copy link
Contributor

bkmgit commented Dec 24, 2022

Compiler warnings when building on Fedora linux. Can create a pull request to fix most of these if of interest.

giza-axis.c: In function 'giza_axis':
giza-axis.c:106:21: warning: variable 'draw_invert' set but not used [-Wunused-but-set-variable]
  106 |       draw_log = 0, draw_invert = -1, draw_axis = 1;
      |                     ^~~~~~~~~~~

giza-box-time.c: In function '_giza_tbx4':
giza-box-time.c:898:13: warning: 'disp' may be used uninitialized [-Wmaybe-uninitialized]
  898 |             giza_annotate_float(axloc, disp, coord, fjust, text);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
giza-box-time.c:660:44: note: 'disp' was declared here
  660 |     double       time, coord, fjust, rval, disp;
      |                                            ^~~~

giza-cursor-routines.c:43:56: warning: argument 3 of type 'double *' declared as a pointer [-Wvla-parameter]
   43 | _giza_mark_with_cursor (int maxpts, int *npts, double* xpts, double* ypts,
      |                                                ~~~~~~~~^~~~
In file included from giza-cursor-routines.c:28:
giza-cursor-private.h:25:60: note: previously declared as a variable length array 'double[maxpts]'
   25 | void _giza_mark_with_cursor (int maxpts, int *npts, double xpts[maxpts], double ypts[maxpts],
      |                                                     ~~~~~~~^~~~~~~~~~~~
giza-cursor-routines.c:43:70: warning: argument 4 of type 'double *' declared as a pointer [-Wvla-parameter]
   43 | _giza_mark_with_cursor (int maxpts, int *npts, double* xpts, double* ypts,
      |                                                              ~~~~~~~~^~~~
giza-cursor-private.h:25:81: note: previously declared as a variable length array 'double[maxpts]'
   25 | void _giza_mark_with_cursor (int maxpts, int *npts, double xpts[maxpts], double ypts[maxpts],
      |                                                                          ~~~~~~~^~~~~~~~~~~~
giza-cursor-routines.c:207:61: warning: argument 3 of type 'float *' declared as a pointer [-Wvla-parameter]
  207 | _giza_mark_with_cursor_float (int maxpts, int *npts, float* xpts, float* ypts,
      |                                                      ~~~~~~~^~~~
giza-cursor-private.h:27:65: note: previously declared as a variable length array 'float[maxpts]'
   27 | void _giza_mark_with_cursor_float (int maxpts, int *npts, float xpts[maxpts], float ypts[maxpts],
      |                                                           ~~~~~~^~~~~~~~~~~~
giza-cursor-routines.c:207:74: warning: argument 4 of type 'float *' declared as a pointer [-Wvla-parameter]
  207 | _giza_mark_with_cursor_float (int maxpts, int *npts, float* xpts, float* ypts,
      |                                                                   ~~~~~~~^~~~
giza-cursor-private.h:27:85: note: previously declared as a variable length array 'float[maxpts]'
   27 | void _giza_mark_with_cursor_float (int maxpts, int *npts, float xpts[maxpts], float ypts[maxpts],
      |                                                                               ~~~~~~^~~~~~~~~~~~

giza-drivers.c: In function 'giza_query_device':
giza-drivers.c:705:12: warning: 'strncat' output may be truncated copying 4 bytes from a string of length 11 [-Wstringop-truncation]
  705 |            strncat(returnval,devType,4*sizeof(char));
      |            ^

giza-io.c: In function '_giza_write_log_file':
giza-io.c:207:25: warning: '%s' directive writing up to 79 bytes into a region of size 72 [-Wformat-overflow=]
  207 |    sprintf(msg,"writing %s",string);
      |                         ^~  ~~~~~~
In file included from /usr/include/stdio.h:906,
                 from giza-io.c:29:
In function 'sprintf',
    inlined from '_giza_write_log_file' at giza-io.c:207:4:
/usr/include/bits/stdio2.h:30:10: note: '__sprintf_chk' output between 9 and 88 bytes into a destination of size 80
   30 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   31 |                                   __glibc_objsize (__s), __fmt,
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   32 |                                   __va_arg_pack ());
      |                                   ~~~~~~~~~~~~~~~~~

giza-scanner.l:81:42: warning: '_giza_greek_to_utf' declared 'static' but never defined [-Wunused-function]
   81 | static char const*                       _giza_greek_to_utf(char letter);
      |                                          ^~~~~~~~~~~~~~~~~~
lex.yy.c:1386:16: warning: 'input' defined but not used [-Wunused-function]
 1386 | #else
      |                ^    
lex.yy.c:1342:17: warning: 'yyunput' defined but not used [-Wunused-function]
 1342 | 
      |                 ^      

giza-pgplot.f90:178:28:

  178 | integer function PGBEG (UNIT, FILE, NXSUB, NYSUB)
      |                            1
Warning: Unused dummy argument 'unit' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:257:66:

  257 | subroutine PGCONB (A, IDIM, JDIM, I1, I2, J1, J2, C, NC, TR, BLANK)
      |                                                                  1
Warning: Unused dummy argument 'blank' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:274:20:

  274 | subroutine PGCONF (A, IDIM, JDIM, I1, I2, J1, J2, C1, C2, TR)
      |                    1
Warning: Unused dummy argument 'a' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:274:52:

  274 | subroutine PGCONF (A, IDIM, JDIM, I1, I2, J1, J2, C1, C2, TR)
      |                                                    1
Warning: Unused dummy argument 'c1' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:274:56:

  274 | subroutine PGCONF (A, IDIM, JDIM, I1, I2, J1, J2, C1, C2, TR)
      |                                                        1
Warning: Unused dummy argument 'c2' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:274:36:

  274 | subroutine PGCONF (A, IDIM, JDIM, I1, I2, J1, J2, C1, C2, TR)
      |                                    1
Warning: Unused dummy argument 'i1' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:274:40:

  274 | subroutine PGCONF (A, IDIM, JDIM, I1, I2, J1, J2, C1, C2, TR)
      |                                        1
Warning: Unused dummy argument 'i2' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:274:44:

  274 | subroutine PGCONF (A, IDIM, JDIM, I1, I2, J1, J2, C1, C2, TR)
      |                                            1
Warning: Unused dummy argument 'j1' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:274:48:

  274 | subroutine PGCONF (A, IDIM, JDIM, I1, I2, J1, J2, C1, C2, TR)
      |                                                1
Warning: Unused dummy argument 'j2' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:274:60:

  274 | subroutine PGCONF (A, IDIM, JDIM, I1, I2, J1, J2, C1, C2, TR)
      |                                                            1
Warning: Unused dummy argument 'tr' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:285:70:

  285 | subroutine PGCONL (A, IDIM, JDIM, I1, I2, J1, J2, C, TR, LABEL, INTVAL, MININT)
      |                                                                      1
Warning: Unused dummy argument 'intval' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:285:62:

  285 | subroutine PGCONL (A, IDIM, JDIM, I1, I2, J1, J2, C, TR, LABEL, INTVAL, MININT)
      |                                                              1
Warning: Unused dummy argument 'label' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:285:78:

  285 | subroutine PGCONL (A, IDIM, JDIM, I1, I2, J1, J2, C, TR, LABEL, INTVAL, MININT)
      |                                                                              1
Warning: Unused dummy argument 'minint' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:340:20:

  340 | subroutine PGCONX (A, IDIM, JDIM, I1, I2, J1, J2, C, NC, PLOT)
      |                    1
Warning: Unused dummy argument 'a' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:340:51:

  340 | subroutine PGCONX (A, IDIM, JDIM, I1, I2, J1, J2, C, NC, PLOT)
      |                                                   1
Warning: Unused dummy argument 'c' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:340:36:

  340 | subroutine PGCONX (A, IDIM, JDIM, I1, I2, J1, J2, C, NC, PLOT)
      |                                    1
Warning: Unused dummy argument 'i1' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:340:40:

  340 | subroutine PGCONX (A, IDIM, JDIM, I1, I2, J1, J2, C, NC, PLOT)
      |                                        1
Warning: Unused dummy argument 'i2' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:340:44:

  340 | subroutine PGCONX (A, IDIM, JDIM, I1, I2, J1, J2, C, NC, PLOT)
      |                                            1
Warning: Unused dummy argument 'j1' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:340:48:

  340 | subroutine PGCONX (A, IDIM, JDIM, I1, I2, J1, J2, C, NC, PLOT)
      |                                                1
Warning: Unused dummy argument 'j2' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:340:55:

  340 | subroutine PGCONX (A, IDIM, JDIM, I1, I2, J1, J2, C, NC, PLOT)
      |                                                       1
Warning: Unused dummy argument 'nc' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:340:61:

  340 | subroutine PGCONX (A, IDIM, JDIM, I1, I2, J1, J2, C, NC, PLOT)
      |                                                             1
Warning: Unused dummy argument 'plot' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:582:68:

  582 | subroutine PGHI2D (DATA, NXV, NYV, IX1, IX2, IY1, IY2, X, IOFF, BIAS, CENTER, YLIMS)
      |                                                                    1
Warning: Unused dummy argument 'bias' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:582:76:

  582 | subroutine PGHI2D (DATA, NXV, NYV, IX1, IX2, IY1, IY2, X, IOFF, BIAS, CENTER, YLIMS)
      |                                                                            1
Warning: Unused dummy argument 'center' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:582:23:

  582 | subroutine PGHI2D (DATA, NXV, NYV, IX1, IX2, IY1, IY2, X, IOFF, BIAS, CENTER, YLIMS)
      |                       1
Warning: Unused dummy argument 'data' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:582:62:

  582 | subroutine PGHI2D (DATA, NXV, NYV, IX1, IX2, IY1, IY2, X, IOFF, BIAS, CENTER, YLIMS)
      |                                                              1
Warning: Unused dummy argument 'ioff' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:582:48:

  582 | subroutine PGHI2D (DATA, NXV, NYV, IX1, IX2, IY1, IY2, X, IOFF, BIAS, CENTER, YLIMS)
      |                                                1
Warning: Unused dummy argument 'iy1' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:582:53:

  582 | subroutine PGHI2D (DATA, NXV, NYV, IX1, IX2, IY1, IY2, X, IOFF, BIAS, CENTER, YLIMS)
      |                                                     1
Warning: Unused dummy argument 'iy2' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:582:56:

  582 | subroutine PGHI2D (DATA, NXV, NYV, IX1, IX2, IY1, IY2, X, IOFF, BIAS, CENTER, YLIMS)
      |                                                        1
Warning: Unused dummy argument 'x' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:582:83:

  582 | subroutine PGHI2D (DATA, NXV, NYV, IX1, IX2, IY1, IY2, X, IOFF, BIAS, CENTER, YLIMS)
      |                                                                                   1
Warning: Unused dummy argument 'ylims' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:859:20:

  859 | subroutine PGPNTS (N, X, Y, SYMBOL, NS)
      |                    1
Warning: Unused dummy argument 'n' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:859:38:

  859 | subroutine PGPNTS (N, X, Y, SYMBOL, NS)
      |                                      1
Warning: Unused dummy argument 'ns' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:859:34:

  859 | subroutine PGPNTS (N, X, Y, SYMBOL, NS)
      |                                  1
Warning: Unused dummy argument 'symbol' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:859:23:

  859 | subroutine PGPNTS (N, X, Y, SYMBOL, NS)
      |                       1
Warning: Unused dummy argument 'x' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:859:26:

  859 | subroutine PGPNTS (N, X, Y, SYMBOL, NS)
      |                          1
Warning: Unused dummy argument 'y' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:1057:37:

 1057 | subroutine PGQDT(N, TYPE, TLEN, DESCR, DLEN, INTER)
      |                                     1
Warning: Dummy argument 'descr' at (1) was declared INTENT(OUT) but was not set [-Wunused-dummy-argument]
giza-pgplot.f90:1057:43:

 1057 | subroutine PGQDT(N, TYPE, TLEN, DESCR, DLEN, INTER)
      |                                           1
Warning: Dummy argument 'dlen' at (1) was declared INTENT(OUT) but was not set [-Wunused-dummy-argument]
giza-pgplot.f90:1057:50:

 1057 | subroutine PGQDT(N, TYPE, TLEN, DESCR, DLEN, INTER)
      |                                                  1
Warning: Dummy argument 'inter' at (1) was declared INTENT(OUT) but was not set [-Wunused-dummy-argument]
giza-pgplot.f90:1057:18:

 1057 | subroutine PGQDT(N, TYPE, TLEN, DESCR, DLEN, INTER)
      |                  1
Warning: Unused dummy argument 'n' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:1057:30:

 1057 | subroutine PGQDT(N, TYPE, TLEN, DESCR, DLEN, INTER)
      |                              1
Warning: Dummy argument 'tlen' at (1) was declared INTENT(OUT) but was not set [-Wunused-dummy-argument]
giza-pgplot.f90:1057:24:

 1057 | subroutine PGQDT(N, TYPE, TLEN, DESCR, DLEN, INTER)
      |                        1
Warning: Dummy argument 'type' at (1) was declared INTENT(OUT) but was not set [-Wunused-dummy-argument]
giza-pgplot.f90:1157:22:

 1157 | subroutine PGQITF (ITF)
      |                      1
Warning: Dummy argument 'itf' at (1) was declared INTENT(OUT) but was not set [-Wunused-dummy-argument]
giza-pgplot.f90:1471:21:

 1471 | subroutine PGSCRL (DX, DY)
      |                     1
Warning: Unused dummy argument 'dx' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:1471:25:

 1471 | subroutine PGSCRL (DX, DY)
      |                         1
Warning: Unused dummy argument 'dy' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:1481:20:

 1481 | subroutine PGSCRN(CI, NAME, IER)
      |                    1
Warning: Unused dummy argument 'ci' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:1481:31:

 1481 | subroutine PGSCRN(CI, NAME, IER)
      |                               1
Warning: Dummy argument 'ier' at (1) was declared INTENT(OUT) but was not set [-Wunused-dummy-argument]
giza-pgplot.f90:1481:26:

 1481 | subroutine PGSCRN(CI, NAME, IER)
      |                          1
Warning: Unused dummy argument 'name' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:1533:22:

 1533 | subroutine PGSITF (ITF)
      |                      1
Warning: Unused dummy argument 'itf' at (1) [-Wunused-dummy-argument]
giza-pgplot.f90:1546:16:

 1546 |  integer :: ierr
      |                1
Warning: Unused variable 'ierr' declared at (1) [-Wunused-variable]

test-openclose.c: In function 'main':
test-openclose.c:28:7: warning: variable 'ierr' set but not used [-Wunused-but-set-variable]
   28 |   int ierr;
      |       ^~~~

test-vector.c: In function 'main':
test-vector.c:55:28: warning: passing argument 3 of 'giza_vector_float' from incompatible pointer type [-Wincompatible-pointer-types]
   55 |   giza_vector_float (n, m, hori, vert, 0, 1, 0, 1, scale, 0, affine, 1000.);
      |                            ^~~~
      |                            |
      |                            float (*)[n]
In file included from test-vector.c:25:
../../src/giza.h:350:47: note: expected 'const float *' but argument is of type 'float (*)[n]'
  350 | giza_vector_float (int n, int m, const float* horizontal, const float* vertical,
      |                                  ~~~~~~~~~~~~~^~~~~~~~~~
test-vector.c:55:34: warning: passing argument 4 of 'giza_vector_float' from incompatible pointer type [-Wincompatible-pointer-types]
   55 |   giza_vector_float (n, m, hori, vert, 0, 1, 0, 1, scale, 0, affine, 1000.);
      |                                  ^~~~
      |                                  |
      |                                  float (*)[n]
../../src/giza.h:350:72: note: expected 'const float *' but argument is of type 'float (*)[n]'
  350 | giza_vector_float (int n, int m, const float* horizontal, const float* vertical,
      |                                                           ~~~~~~~~~~~~~^~~~~~~~
@danieljprice
Copy link
Owner

Hi thanks for flagging the issue and sorry for the slow response. Some of these are easily fixed and I would very much welcome a P-R fixing them.

the trickiest ones are the unused dummy arguments, I guess they could be switched off using -Wno-unused-dummy-argument but we cannot change the API to these routines and really this just indicates some unimplemented functionality that should really be implemented...

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

No branches or pull requests

2 participants