[clang] [compiler-rt] [Clang] Make `-Wreturn-type` default to an error in all language modes (PR #123470)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 23 11:07:06 PST 2025


AaronBallman wrote:

> > I think this is probably Clang 21 material
> 
> Yeah, probably

First off, I really appreciate this patch because (to me) it's not really defensible in 2025 that falling off the end of a function with a non-void return type is anything but an error. So thank you!

I do think this is Clang 21 material though because I suspect the fallout from this might be a challenge. Specifically, I wonder about `autoconf`; that tool often plays fast-and-loose with the generated code and it relies on the presence of diagnostics to say "nope, this is not supported". So I worry there will be autoconf scripts out there which do `int test() { malloc(1); }` to test for whether `malloc` exists and it now fails because it falls off the end of a non-void function and so it gives the wrong answer. However, I don't have evidence of this myself. Is that something you've looked into by any chance? If not, it would be worthwhile to know what the fallout is. CC @thesamesam who maybe has insights into what kind of fallout this will cause (or may be willing to do a test-run with the patch?)

https://github.com/llvm/llvm-project/pull/123470


More information about the cfe-commits mailing list