Page MenuHomeFreeBSD

stdlib.h: Fix qsort_r compatibility with GCC 12.
Needs ReviewPublic

Authored by jhb on Wed, Nov 16, 5:41 PM.



GCC 12 (unlike GCC 9) does not match a function argument passed to the
old qsort_r() API (as is used in the qsort_r_compat test) to a
function pointer type via generic. It treats the function type as a
distinct type from a function pointer. As a workaround, add a second
generic() condition which matches on the function type that also
falls back to __qsort_r_compat.

Diff Detail

rG FreeBSD src repository
Lint Skipped
Tests Skipped
Build Status
Buildable 48394
Build 45280: arc lint + arc unit

Event Timeline

jhb requested review of this revision.Wed, Nov 16, 5:41 PM

This breaks the build with clang as clang says a _Generic selector can only have an object type and a function pointer type isn't valid. GCC 9 was happy with the existing version, so this might be some regression in GCC 10, 11, or 12.