Page MenuHomePhabricator

[cmake] Enable -Werror=return-type
ClosedPublic

Authored by kastiglione on Mar 8 2021, 5:06 PM.

Details

Summary

Turn -Wreturn-type into an error.

This is currently used by libcxx, libcxxabi, and libunwind, and would be a good default
for all of llvm. I'm not aware of any cases where this shouldn't be an error. This
ensures different build configs, merges, and downstream branches catch issues sooner.

Diff Detail

Event Timeline

kastiglione created this revision.Mar 8 2021, 5:06 PM
kastiglione requested review of this revision.Mar 8 2021, 5:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 8 2021, 5:06 PM
This revision is now accepted and ready to land.Mar 9 2021, 9:21 AM
vsk accepted this revision.Mar 9 2021, 9:34 AM
This revision was automatically updated to reflect the committed changes.
kastiglione added a comment.EditedMar 10 2021, 2:50 PM

Reverted because some versions of gcc can emit -Wreturn-type warnings on functions that have exhaustive switches over enums. A fix is to use llvm_unreachable but that's not currently done everywhere (and also seems like a poor/unnecessary practice).

Can you either enable it for Clang or fix llvm codebase so GCC is ok with it?

@xbolva00 yes I plan to do that. I'll quickly check into the gcc situation first, and but may just re-enable it for clang.