When WITH_SORT_THREADS is set, usr.bin/sort build fails with this errors:
/usr/src/usr.bin/sort/radixsort.c:144:17: error: mutex 'g_ls_mutex' is not held on every path through here [-Werror,-Wthread-safety-analysis] new_ls->next = g_ls; ^ /usr/src/usr.bin/sort/radixsort.c:141:3: note: mutex acquired here pthread_mutex_lock(&g_ls_mutex); ^ /usr/src/usr.bin/sort/radixsort.c:149:3: error: releasing mutex 'g_ls_mutex' that was not held [-Werror,-Wthread-safety-analysis] pthread_mutex_unlock(&g_ls_mutex); ^ 2 errors generated. *** Error code 1
It seems to be ThreadSafetyAnasysis false positive (http://clang.llvm.org/docs/ThreadSafetyAnalysis.html#conditional-locks).
Patch fixes build by setting NO_WERROR when WITH_SORT_THREADS is set.