Commit ea12f2d
committed
cstring: wrap const-generic string functions in parentheses to bypass glibc macros
When using glibc 2.43+ and defining _GNU_SOURCE, the header <string.h>
implicitly enables C23 source features. This activates the new type-generic
__glibc_const_generic macros for core functions like strchr, memchr,
strrchr, strstr, and strpbrk.
Consequently, if these functions are passed a `const char*` or `const void*`,
the macros enforce a `const` return type, even when compiling in older C standards.
Because our test functions act as wrappers that intentionally return mutable
pointers from const arguments, compiling this file was generating warnings.
Wrap the function identifiers in parentheses to suppresses preprocessor
macro expansion, forcing the legacy behavior.1 parent b133991 commit ea12f2d
1 file changed
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
0 commit comments