On 7/7/21 7:23 PM, Alejandro Colomar (man-pages) wrote:
How do you think this should be handled?
Adding a line in NOTES for every such function? Adding [[gnu::nonnull]]
to every such prototype in SYNOPSIS (this might be too noisy)? Else?
As an example of how man pages could look like with the addition of
[[gnu::nonnull]], you can have a look at this manual page of mine:
[[
...
SYNOPSIS
#include <alx/base/stdlib.h>
[[gnu::nonnull]] [[gnu::warn_unused_result]]
int alx_callocs(type **ptr, ptrdiff_t nmemb);
[[gnu::malloc]] [[gnu::warn_unused_result]]
void *alx_mallocarray(ptrdiff_t nmemb, ssize_t size);
[[gnu::nonnull]] [[gnu::warn_unused_result]]
int alx_mallocarrays(type **ptr, ptrdiff_t nmemb);
[[gnu::nonnull]] [[gnu::warn_unused_result]]
int alx_mallocs(type **ptr, ssize_t nmemb);
[[gnu::warn_unused_result]]
void *alx_reallocarrayf(void *ptr, ptrdiff_t nmemb, ssize_t nmemb);
[[gnu::nonnull]] [[gnu::warn_unused_result]]
int alx_reallocarrayfs(type **ptr, ptrdiff_t nmemb);
[[gnu::nonnull]] [[gnu::warn_unused_result]]
int alx_reallocfs(type **ptr, ssize_t nmemb);
[[gnu::nonnull]] [[gnu::warn_unused_result]]
int alx_reallocs(type **ptr, ssize_t nmemb);
[[gnu::nonnull]]
int alx_frees(type **ptr);
...
]]
Source:
<https://github.com/alejandro-colomar/libalx/tree/main/share/man/base/man3>.
--
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/