HomeFreeBSD

cdefs: Use __has_feature to gate the definition of __nosanitize*

Description

cdefs: Use has_feature to gate the definition of nosanitize*

clang 12 does not implement the coverage sanitizer, and the build fails
when attribute((no_sanitize("coverage"))) is used.

Try to work around the problem by giving __nosanitize* a non-trivial
definition only when the corresponding sanitizer is actually enabled in
the build.

Tested by reading disassembly of pmap_update_strided() and pmap_enter()
in a kernel compiled with "options COVERAGE", and similar sanity checks
for the other sanitizers. I also test-booted KASAN and KMSAN kernels in
amd64 bhyve.

Suggested by: jrtc27
Reviewed by: imp
Fixes: a78bacf3b0ec ("cdefs: Add __nosanitizecoverage")
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D47193