Files
freebsd/include
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
..
…
2026-02-02 21:20:16 +00: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
2025-09-11 17:12:22 +02: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
2026-06-22 15:23:48 +02:00
…
…
…
2023-11-26 22:23:28 -07:00
2024-10-14 10:26:17 -07:00
2023-08-16 11:54:23 -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
…
2024-08-26 18:27:29 +02:00
2026-05-27 00:05:45 +01:00
…
2026-01-19 18:49:57 +02: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
2026-07-06 14:23:50 +02:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2025-06-11 17:16:22 -06:00
2023-11-26 22:23:28 -07:00
2026-01-06 20:26:59 -05:00
2026-03-06 01:46:53 +02: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
2025-11-28 16:19:53 +01:00
…
2026-05-10 17:53:20 +03:00
2023-11-26 22:23:28 -07:00
…
…
…
2023-08-16 11:54:23 -06:00
…