Fix canon-host.? properly: >From e86c5da600df51198134e0e9641234bcbaeee852 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@fb.com> Date: Sun, 24 Jun 2018 16:54:43 -0700 Subject: [PATCH] canon-host: take GCC9's advice rather than ignoring warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit
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. --- ChangeLog | 5 +++++ lib/canon-host.c | 6 ------ lib/canon-host.h | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index ad10fbc35..3890bcadc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2018-06-24 Jim Meyering <meyer...@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 diff --git a/lib/canon-host.c b/lib/canon-host.c index 64afe1a0a..f2a16a758 100644 --- a/lib/canon-host.c +++ b/lib/canon-host.c @@ -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" diff --git a/lib/canon-host.h b/lib/canon-host.h index 3f5a379f2..53ce67a8d 100644 --- a/lib/canon-host.h +++ b/lib/canon-host.h @@ -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); -- 2.18.0