public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ctime.3: Use VLA notation for [as]ctime_r() buffer
@ 2021-10-20 20:22 Alejandro Colomar
  2021-10-20 20:22 ` [PATCH 2/2] ctime.3, strftime.3, strptime.3, timegm.3: Add [[gnu::nonnull]] to <time.h> prototypes Alejandro Colomar
       [not found] ` <20211021092746.78bc82f8@inria.fr>
  0 siblings, 2 replies; 10+ messages in thread
From: Alejandro Colomar @ 2021-10-20 20:22 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, Jens Gustedt, Glibc

As N2417 (part of C2x) suggests.  This syntax is very informative,
and also, if used by library implementers, can improve static analysis.

Since it is backwards compatible with pointer syntax, we can do this.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Cc: Jens Gustedt <jens.gustedt@loria.fr>
Cc: Glibc <libc-alpha@sourceware.org>
---
 man3/ctime.3 | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/man3/ctime.3 b/man3/ctime.3
index 0e2068a09..0620741e9 100644
--- a/man3/ctime.3
+++ b/man3/ctime.3
@@ -41,10 +41,12 @@ localtime_r \- transform date and time to broken-down time or ASCII
 .B #include <time.h>
 .PP
 .BI "char *asctime(const struct tm *" tm );
-.BI "char *asctime_r(const struct tm *restrict " tm ", char *restrict " buf );
+.BI "char *asctime_r(const struct tm *restrict " tm ,
+.BI "                    char " buf "[static restrict 26]);"
 .PP
 .BI "char *ctime(const time_t *" timep );
-.BI "char *ctime_r(const time_t *restrict " timep ", char *restrict " buf );
+.BI "char *ctime_r(const time_t *restrict " timep ,
+.BI "                    char " buf "[static restrict 26]);"
 .PP
 .BI "struct tm *gmtime(const time_t *" timep );
 .BI "struct tm *gmtime_r(const time_t *restrict " timep ,
-- 
2.33.0


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

end of thread, other threads:[~2021-10-21 20:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-20 20:22 [PATCH 1/2] ctime.3: Use VLA notation for [as]ctime_r() buffer Alejandro Colomar
2021-10-20 20:22 ` [PATCH 2/2] ctime.3, strftime.3, strptime.3, timegm.3: Add [[gnu::nonnull]] to <time.h> prototypes Alejandro Colomar
2021-10-21  8:13   ` AW: " Walter Harms
2021-10-21  9:01     ` Alejandro Colomar (man-pages)
2021-10-21 17:40       ` Paul Eggert
2021-10-21 20:54         ` Alejandro Colomar (man-pages)
     [not found] ` <20211021092746.78bc82f8@inria.fr>
2021-10-21  9:12   ` [PATCH 1/2] ctime.3: Use VLA notation for [as]ctime_r() buffer Alejandro Colomar (man-pages)
     [not found]   ` <20c1e58b-ba2b-f9df-ab1f-f80725414cf5@gmail.com>
2021-10-21  9:13     ` Alejandro Colomar (man-pages)
     [not found]     ` <5782a3ea-9774-3acb-e365-1e4d03ed3358@gmail.com>
2021-10-21  9:14       ` Alejandro Colomar (man-pages)
     [not found]       ` <20211021110311.52541d69@inria.fr>
     [not found]         ` <ec620c5e-0952-fe16-353c-0210d3bea6e8@gmail.com>
2021-10-21  9:27           ` Alejandro Colomar (man-pages)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox