[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gnulib-bug
Subject:    c-xvasprintf: Fix declarations
From:       Bruno Haible <bruno () clisp ! org>
Date:       2021-12-21 16:50:28
Message-ID: 6771633.uBEoKPz9u1 () omega
[Download RAW message or body]

clang on OpenBSD reports this nice warning:

../../gllib/c-xvasprintf.c:37:7: warning: null returned from function that requires a \
non-null return value [-Wnonnull]

Indeed, the wrong declaration of c_xasprintf could produce wrong code
for error handling.

This patch fixes it.


2021-12-21  Bruno Haible  <bruno@clisp.org>

	c-xvasprintf: Fix declarations (regression 2021-08-07).
	* lib/c-xvasprintf.h (c_xasprintf, c_xvasprintf): Remove
	_GL_ATTRIBUTE_RETURNS_NONNULL attribute.

diff --git a/lib/c-xvasprintf.h b/lib/c-xvasprintf.h
index 69e5c1bbe..ebb25b635 100644
--- a/lib/c-xvasprintf.h
+++ b/lib/c-xvasprintf.h
@@ -41,10 +41,10 @@ extern "C" {
    used in floating-point formatting directives is always '.'. */
 extern char *c_xasprintf (const char *format, ...)
   _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 1, 2))
-  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_RETURNS_NONNULL;
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
 extern char *c_xvasprintf (const char *format, va_list args)
   _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 1, 0))
-  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_RETURNS_NONNULL;
+  _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
 
 #ifdef __cplusplus
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic