Suggestion: Clang warning specific to WebAssembly function signature matching

2 views
Skip to first unread message

John Dallman

unread,
May 15, 2026, 9:05:58 AM (3 days ago) May 15
to emscripte...@googlegroups.com
The codebase I'm porting to WebAssembly is mostly C, rather than C++, and parts of it are decades old. I'm having to clean up places where it gets clever with function calling, to get rid of function signature mismatches.

I'm currently using the emcc option -Werror=cast-function-type to find them at compile time. However, this is stricter than WebAssembly apparently requires: I've been given to understand that the arguments all get smushed down to i32, i64, f32 or f64, with pointers being passed as the appropriate i-type. Structs are passed by pointer.  

Would it be possible to add a Clang warning (configurable as an error) that was looser than -Werror=cast-function-type and just matched to the strictness that WebAssembly requires? 

If we had that, it could be turned on automatically when targeting WebAssembly, which would be convenient for people starting on WebAssembly work.  

Thanks, 

John Dallman 
Reply all
Reply to author
Forward
0 new messages