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 10:28:26 +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-08-13 20:08:49 +03:30
2026-06-21 17:48:49 +01:00
2023-11-01 16:44:30 -06:00
2025-11-30 20:21:52 +01: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
2026-04-23 00:58:54 +02:00
2026-04-23 00:58:54 +02:00
2026-04-23 00:58:54 +02:00
2023-11-26 22:23:28 -07:00
2025-12-09 00:34:57 +02:00
2026-06-21 17:48:49 +01:00
2023-12-25 14:59:50 +01:00
2026-08-13 20:08:49 +03:30
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
2026-08-13 20:08:49 +03:30
2023-11-01 16:44:30 -06:00
2026-06-21 17:48:49 +01:00
2023-11-01 16:44:30 -06:00
2024-07-16 00:12:28 -05:00
2024-11-14 23:10:00 +01:00
2023-11-01 16:44:30 -06:00
2026-06-21 17:48:49 +01:00
2024-05-13 00:23:50 -05:00
2024-05-13 00:23:50 -05:00
2024-05-13 00:23:50 -05: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
2024-05-13 00:23:50 -05:00
2026-08-13 20:08:49 +03:30
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
2025-12-09 00:34:57 +02:00
2023-11-26 22:23:28 -07:00
2023-11-26 22:23:28 -07:00
2024-07-13 00:16:24 -05:00
2026-08-13 20:08:49 +03:30
2024-07-13 00:16:24 -05:00
2023-10-27 10:13:50 -06:00
2024-07-13 00:16:24 -05: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
2024-05-13 00:23:50 -05:00
2023-11-26 22:23:28 -07:00
2024-07-13 00:16:24 -05: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-08-13 20:08:49 +03:30
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
2026-08-13 20:08:49 +03:30
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-08-31 14:52:31 +03: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
2026-01-14 12:10:33 -05:00
2024-11-14 23:10:00 +01:00
2024-01-05 20:54:13 -08:00
2023-11-01 16:44:30 -06: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-08-16 11:54:42 -06: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-08-16 11:54:42 -06:00
2023-11-01 16:44:30 -06:00
2023-08-16 11:54:42 -06:00
2023-11-26 22:23:59 -07:00
2023-08-16 11:55:10 -06:00
2023-11-01 16:44:30 -06:00
2023-08-16 11:55:10 -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
2026-08-13 20:08:49 +03:30
2023-08-16 11:54:42 -06:00
2023-08-16 11:54:42 -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