oetiker / mrtg

MRTG - Multi Router Traffic Grapher
http://www.mrtg.org
250 stars 62 forks source link

Warnings with GCC 11 #41

Closed eribertomota closed 2 years ago

eribertomota commented 3 years ago

Dear @oetiker,

The following warnings are shown when building mrtg over GCC 11. Feel free to close this issue if not important for you to fix these warnings. Thanks!

Eriberto

gcc -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -ffile-prefix-map=/PKGS/mrtg2/mrtg=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -Wpointer-arith -Wcast-align -Wmissing-declarations -Wnested-externs -Winline -W -DHAVE_CONFIG_H -c ./src/rateup.c -o bin/rateup.o
/usr/bin/perl -0777 -p -i~ -e "s'^#!\s*/\S*perl'#! /usr/bin/perl'" ./bin/cfgmaker ./bin/indexmaker ./bin/mrtg
/usr/bin/perl -0777 -p -i~ -e 's@GRAPHFMT="...";@GRAPHFMT="png";@' ./bin/mrtg ./bin/indexmaker
./src/rateup.c: In function ‘image’:
./src/rateup.c:330:7: warning: variable ‘i_outp’ set but not used [-Wunused-but-set-variable]
  330 |   int i_outp, i_outpg;
      |       ^~~~~~
./src/rateup.c:329:70: warning: variable ‘i_outm’ set but not used [-Wunused-but-set-variable]
  329 |   int i_light, i_dark, i_blank, i_major, i_in, i_out, i_grid, i_inm, i_outm;
      |                                                                      ^~~~~~
./src/rateup.c:329:48: warning: variable ‘i_out’ set but not used [-Wunused-but-set-variable]
  329 |   int i_light, i_dark, i_blank, i_major, i_in, i_out, i_grid, i_inm, i_outm;
      |                                                ^~~~~
./src/rateup.c: In function ‘update’:
./src/rateup.c:1459:43: warning: left shift of negative value [-Wshift-negative-value]
 1459 |                 if (inr > - (long long) 1 << 32) {      /* wrapped 32-bit counter? */
      |                                           ^~
./src/rateup.c:1506:44: warning: left shift of negative value [-Wshift-negative-value]
 1506 |                 if (outr > - (long long) 1 << 32) {
      |                                            ^~
./src/rateup.c:239:15: warning: comparison of integer expressions of different signedness: ‘long long int’ and ‘long unsigned int’ [-Wsign-compare]
  239 |       if (avc != steptime) {\
      |               ^~
./src/rateup.c:1596:11: note: in expansion of macro ‘NEXT’
 1596 |           NEXT ((unsigned long) (now - plannow));
      |           ^~~~
./src/rateup.c:239:15: warning: comparison of integer expressions of different signedness: ‘long long int’ and ‘long unsigned int’ [-Wsign-compare]
  239 |       if (avc != steptime) {\
      |               ^~
./src/rateup.c:1633:11: note: in expansion of macro ‘NEXT’
 1633 |           NEXT ((unsigned long) (now - plannow));
      |           ^~~~
./src/rateup.c:239:15: warning: comparison of integer expressions of different signedness: ‘long long int’ and ‘long unsigned int’ [-Wsign-compare]
  239 |       if (avc != steptime) {\
      |               ^~
./src/rateup.c:1670:11: note: in expansion of macro ‘NEXT’
 1670 |           NEXT ((unsigned long) (now - plannow));
      |           ^~~~
./src/rateup.c:239:15: warning: comparison of integer expressions of different signedness: ‘long long int’ and ‘long unsigned int’ [-Wsign-compare]
  239 |       if (avc != steptime) {\
      |               ^~
./src/rateup.c:1707:11: note: in expansion of macro ‘NEXT’
 1707 |           NEXT ((unsigned long) (now - plannow));
      |           ^~~~
./src/rateup.c: In function ‘readhist’:
./src/rateup.c:1256:11: warning: ignoring return value of ‘fgets’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
 1256 |           fgets (buf, 256, fi);
      |           ^~~~~~~~~~~~~~~~~~~~
oetiker commented 3 years ago

it would be nice to see these fixed :)

eribertomota commented 3 years ago

I noticed that is possible to see the same warnings in GitHub CI results.

youpong commented 2 years ago

Fixed all warnings in GitHub CI results.

oetiker commented 2 years ago

thanks!

eribertomota commented 2 years ago

Good! Thanks!

I just uploaded the version 2.17.8+git20211109.9205d1d to Debian.

https://tracker.debian.org/pkg/mrtg