checks: Fix -Wunused-result compiler warnings#2166
Conversation
|
Please consider splitting this to modules and library would be helpful. Not only that it will be smaller PRs, but the |
|
@BadAssassin opened similar PR to this one (#2232), but considers this one better, so that seems like +1 for merging this PR. |
|
I just took a fresh look at this and corrected a regression on bitmap.c which happened during rebase. Almost exclusively these fixes are file I/O related, handling return values from calls with read()/fread(), write()/fwrite(), fgets(), fscanf(), getcwd(). In general it can be said that what up till now silently failed will now at least be accompanied with a message. I believe this is ready to be merged. |
|
Looks good to me 👍 Not sure what the scope of this PR is but a quick grep through the main branch, after pulling commits from this PR, reveals some The command I used is |
👍
The aim of this PR is as the title suggests, to fix -Wunused-result compiler warnings. One step in a campaign eliminating all |
|
This been up over half a year. If there are no objections, I will merge this in the next couple of days. |
* -Wunused-result compiler warnings addressed in following parts: GRASS Modules: d.mon g.proj g.rename ps.map r.fill.dir r.grow.distance r.in.ascii r.in.bin r.in.gridatb r.in.mat r.param.scale r.topmodel v.vol.rst GRASS Library parts: lib/bitmap lib/cairodriver lib/db/dbmi_driver lib/gis lib/rst/interp_float lib/vector/Vlib/ Almost exclusively these fixes are file I/O related, handling return values from calls with read()/fread(), write()/fwrite(), fgets(), fscanf(), getcwd(). In addition, potential overflow of int before it is converted to size_t was avoided in r.in.mat/main.c
* -Wunused-result compiler warnings addressed in following parts: GRASS Modules: d.mon g.proj g.rename ps.map r.fill.dir r.grow.distance r.in.ascii r.in.bin r.in.gridatb r.in.mat r.param.scale r.topmodel v.vol.rst GRASS Library parts: lib/bitmap lib/cairodriver lib/db/dbmi_driver lib/gis lib/rst/interp_float lib/vector/Vlib/ Almost exclusively these fixes are file I/O related, handling return values from calls with read()/fread(), write()/fwrite(), fgets(), fscanf(), getcwd(). In addition, potential overflow of int before it is converted to size_t was avoided in r.in.mat/main.c
* -Wunused-result compiler warnings addressed in following parts: GRASS Modules: d.mon g.proj g.rename ps.map r.fill.dir r.grow.distance r.in.ascii r.in.bin r.in.gridatb r.in.mat r.param.scale r.topmodel v.vol.rst GRASS Library parts: lib/bitmap lib/cairodriver lib/db/dbmi_driver lib/gis lib/rst/interp_float lib/vector/Vlib/ Almost exclusively these fixes are file I/O related, handling return values from calls with read()/fread(), write()/fwrite(), fgets(), fscanf(), getcwd(). In addition, potential overflow of int before it is converted to size_t was avoided in r.in.mat/main.c
Fixes #2128.
Also reported in #2156.
Affects:
Modules
GRASS Library parts