]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: fix -Werror=suggest-attribute=malloc in expr.c
authorCarlos Santos <casantos@datacom.com.br>
Mon, 25 Jun 2018 03:00:14 +0000 (00:00 -0300)
committerPádraig Brady <P@draigBrady.com>
Mon, 25 Jun 2018 04:23:05 +0000 (21:23 -0700)
Add attribute 'malloc' to mpz_get_str to prevent
the following on GCC 8.1.1

  src/expr.c:117:1: error: function might be candidate for attribute
    'malloc' if it is known to return normally
      [-Werror=suggest-attribute=malloc]
   mpz_get_str (char const *str, int base, mpz_t z)
   ^~~~~~~~~~~
  cc1: all warnings being treated as errors

* src/expr.c (mpz_get_str): Add _GL_ATTRIBUTE_MALLOC.

src/expr.c

index f4dbf17927aa30724010ae72eebd5eac62d1d1a9..94eb9e78ff5feaadfbdb054ce0586e1fa5deec4d 100644 (file)
@@ -113,7 +113,7 @@ mpz_tdiv_r (mpz_t r, mpz_t a0, mpz_t b0)
   /* Some x86-style hosts raise an exception for INT_MIN % -1.  */
   r[0] = a < - INTMAX_MAX && b == -1 ? 0 : a % b;
 }
-static char *
+static char * _GL_ATTRIBUTE_MALLOC
 mpz_get_str (char const *str, int base, mpz_t z)
 {
   (void) str; (void) base;