coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] expr: fix build failure with -Werror=suggest-attribute=malloc


From: Carlos Santos
Subject: [PATCH] expr: fix build failure with -Werror=suggest-attribute=malloc
Date: Mon, 25 Jun 2018 00:00:14 -0300

Add attribute 'malloc' to mpz_get_str to prevent a compilation error:

  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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/expr.c b/src/expr.c
index f4dbf1792..94eb9e78f 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -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;
-- 
2.17.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]