Files
freebsd/lib/libc/string
Faraz Vahedi d08296c7ab libc: Implement qualifier-preserving standard library functions
Several standard library functions are specified to return an unqualified
pointer while accepting a pointer to a potentially const-qualified object.
N3020 addresses this behaviour, discarding qualifiers due to incompatible
pointer types, by introducing qualifier-preserving macros for the affected
set of standard library functions.

Add `__qualsel()` helper to `<sys/cdefs.h>`, implemented using the generic
selection, and define qualifier-preserving macros for that set of functions
in `<string.h>`, `<wchar.h>`, and `<stdlib.h>`.

Macros are gated on `_STDC_VERSION__ >= 202311L && !__cplusplus`, therefore
there is no behavioural change for earlier C modes or C++ translation units.
The kernel is likewise unaffected, as it does not include userland headers.

As function-like macros, they are transparent except at a call site where
the address-of operator is applied, the macro is suppressed via `#undef`,
or the identifier appears in parenthesised form; all of which cause the
underlying function designator to be used instead.

Reviewed by:	fuz
Approved by:	fuz (mentor)
MFC after:	1 month
Pull Request:	https://github.com/freebsd/freebsd-src/pull/2288
2026-08-13 20:08:49 +03:30
..
2023-11-26 22:23:28 -07:00
2026-06-21 17:48:49 +01:00
2024-05-13 00:23:50 -05:00
2026-06-21 17:48:49 +01:00
2023-11-01 16:44:30 -06:00
2023-11-26 22:23:28 -07:00
2023-11-01 16:44:30 -06:00
2023-11-01 16:44:30 -06:00
2023-11-26 22:23:28 -07:00
2026-06-21 17:48:49 +01:00
2023-11-01 16:44:30 -06:00
2024-11-20 12:15:11 -05:00
2023-11-26 22:23:28 -07:00
2026-06-21 17:48:49 +01:00
2023-11-01 16:44:30 -06:00
2023-11-01 16:44:30 -06:00
2026-06-21 17:48:49 +01:00
2023-11-01 16:44:30 -06:00
…
2023-11-01 16:44:30 -06:00
2026-06-21 17:48:49 +01:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-01 16:44:30 -06:00
2023-11-26 22:23:28 -07:00
2023-11-01 16:44:30 -06:00
2023-11-01 16:44:30 -06:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-01 16:44:30 -06:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-01 16:44:30 -06:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2024-03-15 14:52:47 -07:00
2023-11-01 16:44:30 -06:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-01 16:44:30 -06:00
2023-11-01 16:44:30 -06:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-01 16:44:30 -06:00
2023-11-01 16:44:30 -06:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2023-11-01 16:44:30 -06:00
2023-11-26 22:23:28 -07:00
2023-11-01 16:44:30 -06:00
2024-07-13 00:16:25 -05:00
2024-07-13 00:16:25 -05:00
2023-11-01 16:44:30 -06:00
2024-07-13 00:16:25 -05:00
2023-11-01 16:44:30 -06:00
2023-11-26 22:23:58 -07:00
2023-11-26 22:23:28 -07:00
2023-11-01 16:44:30 -06:00
2024-07-13 00:16:25 -05:00
2023-11-01 16:44:30 -06:00
2024-07-13 00:16:25 -05:00
2024-07-13 00:16:25 -05:00
2023-08-16 11:54:42 -06:00
2023-11-01 16:44:30 -06:00
2024-07-13 00:16:25 -05:00
2023-11-26 22:23:58 -07:00
2024-07-13 00:16:25 -05:00
2023-11-01 16:44:30 -06:00
2023-11-01 16:44:30 -06:00
2023-08-16 11:54:42 -06:00
2023-11-01 16:44:30 -06:00
2023-11-01 16:44:30 -06:00
2023-11-26 22:23:28 -07:00
2023-11-01 16:44:30 -06:00
2024-07-13 00:16:25 -05:00
2024-07-13 00:16:25 -05:00
2024-07-13 00:16:25 -05:00
2024-07-13 00:16:25 -05:00