Mercurial > gnulib
changeset 39716:e8a021a8664e
canon-host: take GCC9's advice rather than ignoring warning
Pádraig Brady suggested not to ignore this GCC9 advice.
* lib/canon-host.c: Undo preceding change.
* lib/canon-host.h: Instead, declare with _GL_ATTRIBUTE_MALLOC.
author | Jim Meyering <meyering@fb.com> |
---|---|
date | Sun, 24 Jun 2018 16:54:43 -0700 |
parents | 13210948175b |
children | d4d7547d5731 |
files | ChangeLog lib/canon-host.c lib/canon-host.h |
diffstat | 3 files changed, 7 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sun Jun 24 15:58:09 2018 -0700 +++ b/ChangeLog Sun Jun 24 16:54:43 2018 -0700 @@ -1,5 +1,10 @@ 2018-06-24 Jim Meyering <meyering@fb.com> + canon-host: take GCC9's advice rather than ignoring warning + Pádraig Brady suggested not to ignore this GCC9 advice. + * lib/canon-host.c: Undo preceding change. + * lib/canon-host.h: Instead, declare with _GL_ATTRIBUTE_MALLOC. + parse-datetime.y: avoid spurious GCC 9 warning * lib/parse-datetime.y (parse_datetime2): Save RELATIVE_TIME_0 into a function local prior to the first "goto fail". The prior use would
--- a/lib/canon-host.c Sun Jun 24 15:58:09 2018 -0700 +++ b/lib/canon-host.c Sun Jun 24 16:54:43 2018 -0700 @@ -17,12 +17,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ -/* Without this pragma, gcc version 9.0.0 20180616 suggests that - the canon_* functions might be candidateifor attribute 'malloc' */ -#if 9 <= __GNUC__ -# pragma GCC diagnostic ignored "-Wsuggest-attribute=malloc" -#endif - #include <config.h> #include "canon-host.h"
--- a/lib/canon-host.h Sun Jun 24 15:58:09 2018 -0700 +++ b/lib/canon-host.h Sun Jun 24 16:54:43 2018 -0700 @@ -20,8 +20,8 @@ #ifndef CANON_HOST_H # define CANON_HOST_H 1 -char *canon_host (char const *host); -char *canon_host_r (char const *host, int *cherror); +char *canon_host (char const *host) _GL_ATTRIBUTE_MALLOC; +char *canon_host_r (char const *host, int *cherror) _GL_ATTRIBUTE_MALLOC; const char *ch_strerror (void); # define ch_strerror_r(cherror) gai_strerror (cherror);