public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* Re: strlen
       [not found]                     ` <84867122-ec74-b87b-a459-3e7178ffc6d2@gmail.com>
@ 2021-07-07 17:33                       ` Alejandro Colomar (man-pages)
  2021-07-09 13:48                         ` strlen Jonny Grant
  0 siblings, 1 reply; 2+ messages in thread
From: Alejandro Colomar (man-pages) @ 2021-07-07 17:33 UTC (permalink / raw)
  To: Jonny Grant, Michael Kerrisk, Florian Weimer; +Cc: linux-man, Libc-alpha

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/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: strlen
  2021-07-07 17:33                       ` strlen Alejandro Colomar (man-pages)
@ 2021-07-09 13:48                         ` Jonny Grant
  0 siblings, 0 replies; 2+ messages in thread
From: Jonny Grant @ 2021-07-09 13:48 UTC (permalink / raw)
  To: Alejandro Colomar (man-pages), Michael Kerrisk, Florian Weimer
  Cc: linux-man, Libc-alpha



On 07/07/2021 18:33, Alejandro Colomar (man-pages) wrote:
> 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>.


May I ask, could a note be added to the NOTES section as well?

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-09 13:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <0bf239e9-cfc7-8889-ca00-b1d1566bd174@jguk.org>
     [not found] ` <87lfhpgxf8.fsf@mid.deneb.enyo.de>
     [not found]   ` <017a5a66-ba66-7cc8-c607-f851c2e54fc4@jguk.org>
     [not found]     ` <87363whf2z.fsf@mid.deneb.enyo.de>
     [not found]       ` <48e874cb-2b95-2783-ddfc-ae12d9aaf8f5@jguk.org>
     [not found]         ` <87bl7fozxi.fsf@mid.deneb.enyo.de>
     [not found]           ` <23679a28-5986-0af2-4d98-7de68ed0deec@jguk.org>
     [not found]             ` <53b3666b-d200-ef97-b050-cc38669c61cd@gmail.com>
     [not found]               ` <b6fccca1-6e2b-fb20-d9d6-9df94cd3f05f@gmail.com>
     [not found]                 ` <564825ed-1e1f-b344-da35-1b83c551ed5f@jguk.org>
     [not found]                   ` <b71170df-7c6b-4582-c3d1-84b811fe5259@gmail.com>
     [not found]                     ` <84867122-ec74-b87b-a459-3e7178ffc6d2@gmail.com>
2021-07-07 17:33                       ` strlen Alejandro Colomar (man-pages)
2021-07-09 13:48                         ` strlen Jonny Grant

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).