WebAssembly is not able to emit tail calls unless the tail-call target feature
is enabled and when it is not enabled, trying to compile musttail calls produces
a fatal error in the backend. To reflect this reality, disable support for the
[[clang::musttail]] attribute when targeting WebAssembly without the
tail-call feature.
Marked draft for further discussion because I'm not sure getting this:
test.cpp:10:7: warning: unknown attribute 'musttail' ignored [-Wunknown-attributes] [[clang::musttail]] return bar(x * 10);
is actually better developer experience than getting a fatal error with a
description of the WebAssembly-specific problem. Users can also check for the
presence of the __wasm_tail_call__ macro as an alternative to checking
__has_cpp_attribute(clang::musttail) with this patch, but I'm not sure that's
documented anywhere.