Skip to content

Comments

fix discards const from pointer target #322

Open
heitbaum wants to merge 3 commits intoalsa-project:masterfrom
heitbaum:const
Open

fix discards const from pointer target #322
heitbaum wants to merge 3 commits intoalsa-project:masterfrom
heitbaum:const

Conversation

@heitbaum
Copy link
Contributor

Since glibc-2.43:

For ISO C23, the functions bsearch, memchr, strchr, strpbrk, strrchr, strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr that return pointers into their input arrays now have definitions as macros that return a pointer to a const-qualified type when the input argument is a pointer to a const-qualified type.

https://lists.gnu.org/archive/html/info-gnu/2026-01/msg00005.html

../../alsactl/init_parse.c: In function 'elemid_get':
../../alsactl/init_parse.c:695:29: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  695 |                 char *pos = strchr(attr, ' ');
      |                             ^~~~~~
../../alsactl/init_parse.c: In function 'conf_name_filter':
../../alsactl/init_parse.c:1284:21: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
 1284 |         char *ext = strrchr(d->d_name, '.');
      |                     ^~~~~~~
../../aplay/aplay.c: In function 'create_path':
../../aplay/aplay.c:3226:23: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
 3226 |                 start = strchr(path + 1, '/');
      |                       ^
../../aplay/aplay.c:3228:23: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
 3228 |                 start = strchr(path, '/');
      |                       ^
../../topology/pre-process-object.c: In function 'tplg_pp_add_object_tuple_section':
../../topology/pre-process-object.c:562:14: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  562 |         type = strchr(token_ref, '.');
      |              ^
../../topology/pre-process-dapm.c:175:14: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  175 |         args = strchr(string, '.');
      |              ^

Since glibc-2.43:

For ISO C23, the functions bsearch, memchr, strchr, strpbrk, strrchr,
strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr that return pointers
into their input arrays now have definitions as macros that return a
pointer to a const-qualified type when the input argument is a pointer
to a const-qualified type.

https://lists.gnu.org/archive/html/info-gnu/2026-01/msg00005.html

Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
Since glibc-2.43:

For ISO C23, the functions bsearch, memchr, strchr, strpbrk, strrchr,
strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr that return pointers
into their input arrays now have definitions as macros that return a
pointer to a const-qualified type when the input argument is a pointer
to a const-qualified type.

https://lists.gnu.org/archive/html/info-gnu/2026-01/msg00005.html

Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
Since glibc-2.43:

For ISO C23, the functions bsearch, memchr, strchr, strpbrk, strrchr,
strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr that return pointers
into their input arrays now have definitions as macros that return a
pointer to a const-qualified type when the input argument is a pointer
to a const-qualified type.

https://lists.gnu.org/archive/html/info-gnu/2026-01/msg00005.html

Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant