turran wrote: > What I would like is a new flag exactly like the current > `-Wcast-function-type`, but one that was just narrower in its emitted > warnings. > > I.e. currently `-Wcast-function-type` emits warnings for all sorts of casts > that are safe with Wasm ABI (like casting between `unsigned int` to `int` in > a function arg).. but I'd like to not get warnings for those. And only get > warnings for a narrower set of casts that will cause a trap at Wasm runtime. > That would help audit through the millions of lines of code that e.g. Unity3D > engine compiles through. (`-Wcast-function-type` is too much, and > `-Wbad-function-cast` is not enough, as per illustrated in #64526) > > Like was pointed out, of course detecting all scenarios that result to Wasm > VM trapping at runtime is not possible (e.g. casting `void(int,int) -> void* > -> void(int)` and then attempting to call), but that is besides the point. > Because we couldn't detect all such scenarios doesn't mean it wouldn't be > extremely useful to diagnose all the scenarios that can reasonably be > compile-time diagnosed.
Okay, I've re-read the issue you mentioned. Indeed, it makes sense to provide a diagnosis of such use cases. Maybe as part of another PR? This was more in the direction of a different number of arguments instead of a different type of arguments. https://github.com/llvm/llvm-project/pull/153168 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits