[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-devel] [bug #52979] Adding (void) to avoid unused result warni
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-devel] [bug #52979] Adding (void) to avoid unused result warnings in asprintf |
Date: |
Sun, 28 Jan 2018 19:55:07 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0 |
Update of bug #52979 (project gnuastro):
Status: Postponed => Fixed
Assigned to: None => makhlaghi
Open/Closed: Open => Closed
_______________________________________________________
Follow-up Comment #1:
This bug is now fixed and pushed
<http://git.savannah.gnu.org/cgit/gnuastro.git/commit/?id=d6b4d9cd37> to the
main repo.
The return values of `asprintf' are now checked to see if they are not less
than zero (`asprintf' was able to allocate the memory).
Unfortunately adding a `(void)' didn't fix the problem. The warnings would
still remained after it (notice the void before `asprintf':
blank.c: In function 'gal_blank_as_string':
blank.c:388:17: warning: ignoring return value of 'asprintf', declared with
attribute warn_unused_result [-Wunused-result]
if(width) (void)asprintf(&blank, "%*s", width, GAL_BLANK_STRING);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The good thing is that now, if `asprintf' is unable to allocate the memory for
any reason, we won't continue with the program (and have some hard-to-fix
crash later). Also the Debian package builder is now clean from any warnings
and we can catch more specific issues if they come up.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?52979>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/