git: 9e659ecfb231 - stable/13 - Expose POSIX functions incorporated into C23
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 18 Jan 2025 20:20:06 UTC
The branch stable/13 has been updated by shurd:
URL: https://cgit.FreeBSD.org/src/commit/?id=9e659ecfb231819c5426c992885367032a8c4e94
commit 9e659ecfb231819c5426c992885367032a8c4e94
Author: Stephen Hurd <shurd@FreeBSD.org>
AuthorDate: 2024-12-01 17:34:40 +0000
Commit: Stephen Hurd <shurd@FreeBSD.org>
CommitDate: 2025-01-18 20:19:16 +0000
Expose POSIX functions incorporated into C23
C23 has incoporated a small number of POSIX functions, so these
should be exposed for C23, regardless of POSIX.
Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D47856
(cherry picked from commit 59677aecb67bbedcfa2ee5d7d2b189193cdc4af7)
---
include/string.h | 8 +++++---
include/time.h | 2 ++
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/include/string.h b/include/string.h
index ccc820d8b4b6..1d42b54e43ec 100644
--- a/include/string.h
+++ b/include/string.h
@@ -52,7 +52,7 @@ typedef __size_t size_t;
#endif
__BEGIN_DECLS
-#if __XSI_VISIBLE >= 600
+#if __XSI_VISIBLE >= 600 || __ISO_C_VISIBLE >= 2023
void *memccpy(void * __restrict, const void * __restrict, int, size_t);
#endif
void *memchr(const void *, int, size_t) __pure;
@@ -86,7 +86,7 @@ int strcmp(const char *, const char *) __pure;
int strcoll(const char *, const char *);
char *strcpy(char * __restrict, const char * __restrict);
size_t strcspn(const char *, const char *) __pure;
-#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
+#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE || __ISO_C_VISIBLE >= 2023
char *strdup(const char *) __malloc_like;
#endif
char *strerror(int);
@@ -104,8 +104,10 @@ void strmode(int, char *);
char *strncat(char * __restrict, const char * __restrict, size_t);
int strncmp(const char *, const char *, size_t) __pure;
char *strncpy(char * __restrict, const char * __restrict, size_t);
-#if __POSIX_VISIBLE >= 200809
+#if __POSIX_VISIBLE >= 200809 || __ISO_C_VISIBLE >= 2023
char *strndup(const char *, size_t) __malloc_like;
+#endif
+#if __POSIX_VISIBLE >= 200809
size_t strnlen(const char *, size_t) __pure;
#endif
#if __BSD_VISIBLE
diff --git a/include/time.h b/include/time.h
index 45d3a253ed61..e99872ef6a3d 100644
--- a/include/time.h
+++ b/include/time.h
@@ -157,6 +157,8 @@ int clock_nanosleep(clockid_t, int, const struct timespec *, struct timespec *);
#if __POSIX_VISIBLE >= 199506
char *asctime_r(const struct tm *, char *);
char *ctime_r(const time_t *, char *);
+#endif
+#if __POSIX_VISIBLE >= 199506 || __ISO_C_VISIBLE >= 2023
struct tm *gmtime_r(const time_t *, struct tm *);
struct tm *localtime_r(const time_t *, struct tm *);
#endif