Skip to content

Update to return a pointer to a const-qualified type#576

Merged
sahlberg merged 2 commits intosahlberg:masterfrom
heitbaum:glibc-2.43
Jan 26, 2026
Merged

Update to return a pointer to a const-qualified type#576
sahlberg merged 2 commits intosahlberg:masterfrom
heitbaum:glibc-2.43

Conversation

@heitbaum
Copy link
Contributor

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.

Fixes:
    ../../lib/libnfs.c: In function 'nfs_set_context_args':
    ../../lib/libnfs.c:301:30: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
      301 |                 char *strp = strchr(val, ',');
          |                              ^~~~~~
Fixes:
    ../../lib/nfs_v3.c: In function 'nfs3_mknod_async':
    ../../lib/nfs_v3.c:3260:13: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
     3260 |         ptr = strrchr(path, '/');
          |             ^
    ../../lib/nfs_v3.c: In function 'nfs3_unlink_async':
    ../../lib/nfs_v3.c:3361:13: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
     3361 |         ptr = strrchr(path, '/');
          |             ^
    ../../lib/nfs_v3.c: In function 'nfs3_rmdir_async':
    ../../lib/nfs_v3.c:3472:13: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
     3472 |         ptr = strrchr(path, '/');
          |             ^
    ../../lib/nfs_v3.c: In function 'nfs3_mkdir2_async':
    ../../lib/nfs_v3.c:3574:13: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
     3574 |         ptr = strrchr(path, '/');
          |             ^
@sahlberg sahlberg merged commit feddb34 into sahlberg:master Jan 26, 2026
7 of 11 checks passed
@heitbaum heitbaum deleted the glibc-2.43 branch January 26, 2026 22:43
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.

Compile of libnfs-6.0.2 fails to build against glibc-2.43

2 participants