`check_c_compiler_flag` approves some flags despite compiler warnings.
For example, this command:
clang-18 --target=arm64 -msse4.2 -c -xc /dev/null
produces this diagnostic:
clang-18: warning: argument unused during compilation: '-msse4' [-Wunused-command-line-argument]
but with CC=clang-18 CFLAGS=--target=arm64
check_c_compiler_flag will still interpret -msse4
as a valid flag.
Apparently this quirky diagnostic example is a workaround for something else going on in LLVM and it may not persist forever (it should be promoted to an error), but the point is that there is diagnostic output yet the test still passes.
Adding -Werror=unused-command-line-argument
to CFLAGS
works around the problem.