2021-08-07 Bruno Haible <[email protected]>
readline: Improve GCC 11 allocation-deallocation checking.
* lib/readline.h: Include <stdlib.h>.
(readline): Declare that deallocation must happen through 'free'.
diff --git a/lib/readline.h b/lib/readline.h
index 57acdf7..e4b6f9b 100644
--- a/lib/readline.h
+++ b/lib/readline.h
@@ -24,11 +24,13 @@
# include <stdio.h>
# include <readline/readline.h>
#else
+# include <stdlib.h>
/* Prints a prompt PROMPT and then reads and returns a single line of
text from the user. If PROMPT is NULL or the empty string, no
prompt is displayed. The returned line is allocated with malloc;
the caller should free the line when it has finished with it. */
-extern char *readline (const char *prompt);
+extern char *readline (const char *prompt)
+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
#endif
#endif /* GL_READLINE_H */